sendrecv.proto 4.0 KB
Newer Older
T
tangwei12 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// 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";
T
tangwei12 已提交
16
package paddle.distributed;
T
tangwei12 已提交
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
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;
50
  PS_PUSH_GLOBAL_STEP = 29;
S
seemingwang 已提交
51
  PS_PULL_GRAPH_LIST = 30;
52
  PS_GRAPH_SAMPLE_NEIGHBORS = 31;
S
seemingwang 已提交
53 54
  PS_GRAPH_SAMPLE_NODES = 32;
  PS_GRAPH_GET_NODE_FEAT = 33;
55 56 57
  PS_GRAPH_CLEAR = 34;
  PS_GRAPH_ADD_GRAPH_NODE = 35;
  PS_GRAPH_REMOVE_GRAPH_NODE = 36;
S
seemingwang 已提交
58
  PS_GRAPH_SET_NODE_FEAT = 37;
S
seemingwang 已提交
59
  PS_GRAPH_SAMPLE_NODES_FROM_ONE_SERVER = 38;
60
  PS_GRAPH_USE_NEIGHBORS_SAMPLE_CACHE = 39;
61
  PS_GRAPH_LOAD_GRAPH_SPLIT_CONFIG = 40;
62 63 64 65 66 67
  PEER_ROLE_IS_WORKER = 41;
  PEER_ROLE_IS_SWITCH = 42;
  PS_SAVE_WITH_SCOPE = 43;
  PS_SAVE_WITH_SHARD = 44;
  PS_QUERY_WITH_SCOPE = 45;
  PS_QUERY_WITH_SHARD = 46;
Z
zhaocaibei123 已提交
68 69
  // pserver2pserver cmd start from 100
  PS_S2S_MSG = 101;
T
tangwei12 已提交
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 114 115 116 117 118 119 120 121 122 123 124 125 126 127
}

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;
128
  optional bytes data = 5;
129
  repeated int64 vars_len = 6;
130
  optional int32 group_id = 7;
T
tangwei12 已提交
131 132 133 134 135
};

service PsService {
  rpc service(PsRequestMessage) returns (PsResponseMessage);
  rpc SendAndRecvVariable(MultiVariableMessage) returns (MultiVariableMessage);
136 137 138 139
  rpc SendToWorker(MultiVariableMessage) returns (PsResponseMessage);
  rpc SendToSwitch(MultiVariableMessage) returns (PsResponseMessage);
  rpc SendS2S(MultiVariableMessage) returns (PsResponseMessage);
  rpc RecvFromSwitch(MultiVariableMessage) returns (MultiVariableMessage);
S
seemingwang 已提交
140
};