From 77839826a4030efd5f692c4e6ab2cf8cc011a363 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Tue, 3 Jan 2017 17:09:59 +0800 Subject: [PATCH] change FLAGS to proto config in PServerUtil --- paddle/pserver/PServerUtil.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/paddle/pserver/PServerUtil.cpp b/paddle/pserver/PServerUtil.cpp index 68a9174330..bf4cf0771c 100644 --- a/paddle/pserver/PServerUtil.cpp +++ b/paddle/pserver/PServerUtil.cpp @@ -23,35 +23,36 @@ PServerUtil::PServerUtil(const ParameterServerConfig& config) { int onlineCpus = rdma::numCpus(); int numPorts = config.ports_num() + config.ports_num_for_sparse(); - if (FLAGS_nics.empty()) { + if (config.nics().empty()) { pservers_.resize(numPorts); for (int i = 0; i < numPorts; ++i) { - if (FLAGS_rdma_tcp == "rdma") { + if (config.rdma_tcp() == "rdma") { pservers_[i].reset( - new ParameterServer2(std::string(), FLAGS_port + i, rdmaCpu++)); + new ParameterServer2(std::string(), config.port() + i, rdmaCpu++)); rdmaCpu = rdmaCpu % onlineCpus; } else { - pservers_[i].reset(new ParameterServer2(std::string(), FLAGS_port + i)); + pservers_[i].reset( + new ParameterServer2(std::string(), config.port() + i)); } CHECK(pservers_[i]->init()) << "Fail to initialize parameter server" - << FLAGS_port + i; + << config.port() + i; } } else { - str::split(FLAGS_nics, ',', &devices); + str::split(config.nics(), ',', &devices); pservers_.resize(devices.size() * numPorts); for (int i = 0; i < numPorts; ++i) { for (size_t j = 0; j < devices.size(); ++j) { - if (FLAGS_rdma_tcp == "rdma") { + if (config.rdma_tcp() == "rdma") { pservers_[i * devices.size() + j].reset(new ParameterServer2( - getIpAddr(devices[j]), FLAGS_port + i, rdmaCpu++)); + getIpAddr(devices[j]), config.port() + i, rdmaCpu++)); rdmaCpu = rdmaCpu % onlineCpus; } else { pservers_[i * devices.size() + j].reset( - new ParameterServer2(getIpAddr(devices[j]), FLAGS_port + i)); + new ParameterServer2(getIpAddr(devices[j]), config.port() + i)); } CHECK(pservers_[i * devices.size() + j]->init()) << "Fail to initialize parameter server" << devices[j] - << FLAGS_port + i; + << config.port() + i; } } } -- GitLab