sendrecv.proto 3.0 KB
Newer Older
T
tangwei12 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";
package paddle;
option cc_generic_services = true;
option cc_enable_arenas = true;

enum PsCmdID {
  PS_PULL_DENSE_TABLE = 0;
  PS_PUSH_DENSE_TABLE = 1;
  PS_PULL_SPARSE_TABLE = 2;
  PS_PUSH_SPARSE_TABLE = 3;
  PS_SHRINK_TABLE = 4;
  PS_SAVE_ONE_TABLE = 5;
  PS_SAVE_ALL_TABLE = 6;
  PS_LOAD_ONE_TABLE = 7;
  PS_LOAD_ALL_TABLE = 8;
  PS_CLEAR_ONE_TABLE = 9;
  PS_CLEAR_ALL_TABLE = 10;
  PS_PUSH_DENSE_PARAM = 11;
  PS_STOP_SERVER = 12;
  PS_SAVE_ONE_CACHE_TABLE = 13;
  PS_GET_CACHE_THRESHOLD = 14;
  PS_CACHE_SHUFFLE = 15;
  PS_COPY_TABLE = 16;
  PS_COPY_TABLE_BY_FEASIGN = 17;
  PS_PULL_SPARSE_TABLE_WITH_DEPENDENCY = 18;
  PS_PUSH_SPARSE_TABLE_WITH_DEPENDENCY = 19;
  PS_PRINT_TABLE_STAT = 20;
  PS_SAVE_ONE_TABLE_PREFIX = 21;
  PS_SAVE_ONE_TABLE_WITH_WHITELIST = 22;
  PS_LOAD_ONE_TABLE_WITH_WHITELIST = 23;
  PS_PULL_GEO_PARAM = 24;
  PS_BARRIER = 25;
  PS_PUSH_SPARSE_PARAM = 26;
  PS_START_PROFILER = 27;
  PS_STOP_PROFILER = 28;
}

message PsRequestMessage {
  required uint32 cmd_id = 1;
  optional uint32 table_id = 2;
  repeated bytes params = 3;
  optional int32 client_id = 4;
  optional bytes data = 5;
};

message PsResponseMessage {
  required int32 err_code = 1 [ default = 0 ];
  required string err_msg = 2 [ default = "" ];
  optional bytes data = 3;
};

enum VarType {
  LOD_TENSOR = 0;
  SELECTED_ROWS = 1;
}

message VariableMessage {
  enum Type {
    // Pod Types
    BOOL = 0;
    INT16 = 1;
    INT32 = 2;
    INT64 = 3;
    FP16 = 4;
    FP32 = 5;
    FP64 = 6;
  }

  message LodData { repeated int64 lod_data = 1; }
  optional string varname = 1;
  // TODO(Yancey1989): reference framework::proto::VarDesc::VarType
  optional VarType type = 2;
  // bool persistable is not needed for sending.
  // tensor info:
  optional Type data_type = 3;
  repeated int64 dims = 4;

  // lod details:
  optional int64 lod_level = 5;
  repeated LodData lod = 6;
  // selected_rows height, aka. original dim0
  optional int64 slr_height = 7;
  // tensor data
  optional bytes data = 8;
}

// for SendAndRecv RPC method
message MultiVariableMessage {
  // message flags
  required string message_name = 1;
  repeated string send_var_names = 2;
  repeated string recv_var_names = 3;
  repeated VariableMessage var_messages = 4;
};

service PsService {
  rpc service(PsRequestMessage) returns (PsResponseMessage);
  rpc SendAndRecvVariable(MultiVariableMessage) returns (MultiVariableMessage);
};