diff --git a/paddle/pserver/PServerController.cpp b/paddle/pserver/PServerController.cpp index 2d00019ceff6d01cbbfd30b67a31e353c8f1e0cb..8d2e026bca79d5e906e945d4c4c7a8de30bbd607 100644 --- a/paddle/pserver/PServerController.cpp +++ b/paddle/pserver/PServerController.cpp @@ -60,18 +60,16 @@ PServerController::PServerController(const ParameterServerConfig& config) { PServerController::~PServerController() { this->join(); } -ParameterServerConfig* PServerController::initConfigByGflags() { - ParameterServerConfig* config = new ParameterServerConfig(); - config->set_nics(FLAGS_nics); - config->set_port(FLAGS_port); - config->set_ports_num(FLAGS_ports_num); - config->set_rdma_tcp(FLAGS_rdma_tcp); - return config; -} - PServerController* PServerController::createByGflags() { - auto& pServerConfig = *paddle::PServerController::initConfigByGflags(); - return create(pServerConfig); + ParameterServerConfig config; + + config.set_nics(FLAGS_nics); + config.set_rdma_tcp(FLAGS_rdma_tcp); + config.set_port(FLAGS_port); + config.set_ports_num(FLAGS_ports_num); + config.set_ports_num_for_sparse(FLAGS_ports_num_for_sparse); + + return create(config); } PServerController* PServerController::create( diff --git a/paddle/pserver/PServerController.h b/paddle/pserver/PServerController.h index 6fb7e0a31ab2264848cba3c2ad3a5f779bdb4501..cecf7290094a25aa3c3149ac60e0cee1d01d59fb 100644 --- a/paddle/pserver/PServerController.h +++ b/paddle/pserver/PServerController.h @@ -21,7 +21,7 @@ limitations under the License. */ namespace paddle { -class PServerController { +class PServerController final { public: DISABLE_COPY(PServerController); @@ -58,13 +58,7 @@ public: void join(); private: - std::vector> pservers_; - - /** - * @brief create ParameterServerConfig from gflags, this is used for - * compatibility with the old usage of configuration by gflags. - */ - static ParameterServerConfig* initConfigByGflags(); + std::vector> pservers_; }; } // namespace paddle