|
|
|
@ -23,30 +23,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "paddle/fluid/operators/distributed/request_handler.h"
|
|
|
|
#include "paddle/fluid/operators/distributed/request_handler.h"
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_int32(rpc_server_profile_period);
|
|
|
|
|
|
|
|
DECLARE_string(rpc_server_profile_path);
|
|
|
|
DECLARE_string(rpc_server_profile_path);
|
|
|
|
|
|
|
|
|
|
|
|
namespace paddle {
|
|
|
|
namespace paddle {
|
|
|
|
namespace operators {
|
|
|
|
namespace operators {
|
|
|
|
namespace distributed {
|
|
|
|
namespace distributed {
|
|
|
|
|
|
|
|
|
|
|
|
class RPCServerProfiler {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
RPCServerProfiler(int profile_period, const std::string& profile_log_path);
|
|
|
|
|
|
|
|
void OneStep();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
const int profile_period_;
|
|
|
|
|
|
|
|
std::string profile_log_path_;
|
|
|
|
|
|
|
|
int step_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RPCServer {
|
|
|
|
class RPCServer {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
explicit RPCServer(const std::string& address, int client_num)
|
|
|
|
explicit RPCServer(const std::string& address, int client_num)
|
|
|
|
: cur_cond_(0),
|
|
|
|
: cur_cond_(0),
|
|
|
|
profiler_(FLAGS_rpc_server_profile_period,
|
|
|
|
|
|
|
|
FLAGS_rpc_server_profile_path),
|
|
|
|
|
|
|
|
bind_address_(address),
|
|
|
|
bind_address_(address),
|
|
|
|
exit_flag_(false),
|
|
|
|
exit_flag_(false),
|
|
|
|
selected_port_(0),
|
|
|
|
selected_port_(0),
|
|
|
|
@ -86,7 +72,6 @@ class RPCServer {
|
|
|
|
void Complete();
|
|
|
|
void Complete();
|
|
|
|
|
|
|
|
|
|
|
|
void ResetBarrierCounter();
|
|
|
|
void ResetBarrierCounter();
|
|
|
|
RPCServerProfiler& Profiler() { return profiler_; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool NeedResetAllVars();
|
|
|
|
bool NeedResetAllVars();
|
|
|
|
|
|
|
|
|
|
|
|
@ -101,7 +86,6 @@ class RPCServer {
|
|
|
|
std::unordered_map<std::string, int> rpc_cond_map_;
|
|
|
|
std::unordered_map<std::string, int> rpc_cond_map_;
|
|
|
|
std::atomic<int> cur_cond_;
|
|
|
|
std::atomic<int> cur_cond_;
|
|
|
|
std::condition_variable rpc_cond_;
|
|
|
|
std::condition_variable rpc_cond_;
|
|
|
|
RPCServerProfiler profiler_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
std::string bind_address_;
|
|
|
|
std::string bind_address_;
|
|
|
|
|