From 5aaaef446818e52106f652d8b070c803cbbcce20 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Fri, 6 Jan 2017 00:57:21 +0800 Subject: [PATCH] rename PServerController to ParameterServerController --- paddle/pserver/CMakeLists.txt | 4 +-- paddle/pserver/ParameterServer2Main.cpp | 6 ++--- ...ller.cpp => ParameterServerController.cpp} | 17 ++++++------ ...ntroller.h => ParameterServerController.h} | 26 ++++++++++--------- paddle/trainer/TrainerMain.cpp | 6 ++--- 5 files changed, 31 insertions(+), 28 deletions(-) rename paddle/pserver/{PServerController.cpp => ParameterServerController.cpp} (85%) rename paddle/pserver/{PServerController.h => ParameterServerController.h} (56%) diff --git a/paddle/pserver/CMakeLists.txt b/paddle/pserver/CMakeLists.txt index ac52b8dbec..b7f85ea1a6 100644 --- a/paddle/pserver/CMakeLists.txt +++ b/paddle/pserver/CMakeLists.txt @@ -25,14 +25,14 @@ set(PSERVER_SOURCES ParameterClient2.cpp ParameterServer2.cpp SparseParameterDistribution.cpp - PServerController.cpp) + ParameterServerController.cpp) set(PSERVER_HEADERS BaseClient.h ParameterClient2.h ParameterServer2.h SparseParameterDistribution.h - PServerController.h) + ParameterServerController.h) add_library(paddle_pserver STATIC ${PSERVER_SOURCES}) diff --git a/paddle/pserver/ParameterServer2Main.cpp b/paddle/pserver/ParameterServer2Main.cpp index 6e683cdd2c..1145052522 100644 --- a/paddle/pserver/ParameterServer2Main.cpp +++ b/paddle/pserver/ParameterServer2Main.cpp @@ -13,15 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include "PServerController.h" +#include "ParameterServerController.h" using namespace paddle; // NOLINT int main(int argc, char** argv) { initMain(argc, argv); - std::unique_ptr pServerPtr( - paddle::PServerController::createByGflags()); + std::unique_ptr pServerPtr( + paddle::ParameterServerController::createByGflags()); pServerPtr->start(); pServerPtr->join(); diff --git a/paddle/pserver/PServerController.cpp b/paddle/pserver/ParameterServerController.cpp similarity index 85% rename from paddle/pserver/PServerController.cpp rename to paddle/pserver/ParameterServerController.cpp index 8d2e026bca..ec24bc7e57 100644 --- a/paddle/pserver/PServerController.cpp +++ b/paddle/pserver/ParameterServerController.cpp @@ -12,11 +12,12 @@ 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. */ -#include "PServerController.h" +#include "ParameterServerController.h" namespace paddle { -PServerController::PServerController(const ParameterServerConfig& config) { +ParameterServerController::ParameterServerController( + const ParameterServerConfig& config) { // round robin to load balance RDMA server ENGINE std::vector devices; int rdmaCpu = 0; @@ -58,9 +59,9 @@ PServerController::PServerController(const ParameterServerConfig& config) { } } -PServerController::~PServerController() { this->join(); } +ParameterServerController::~ParameterServerController() { this->join(); } -PServerController* PServerController::createByGflags() { +ParameterServerController* ParameterServerController::createByGflags() { ParameterServerConfig config; config.set_nics(FLAGS_nics); @@ -72,12 +73,12 @@ PServerController* PServerController::createByGflags() { return create(config); } -PServerController* PServerController::create( +ParameterServerController* ParameterServerController::create( const ParameterServerConfig& config) { - return new PServerController(config); + return new ParameterServerController(config); } -void PServerController::start() { +void ParameterServerController::start() { LOG(INFO) << "pserver sizes : " << pservers_.size(); int i = 0; for (const auto& pserver : pservers_) { @@ -87,7 +88,7 @@ void PServerController::start() { } } -void PServerController::join() { +void ParameterServerController::join() { LOG(INFO) << "pserver sizes : " << pservers_.size(); int i = 0; for (const auto& pserver : pservers_) { diff --git a/paddle/pserver/PServerController.h b/paddle/pserver/ParameterServerController.h similarity index 56% rename from paddle/pserver/PServerController.h rename to paddle/pserver/ParameterServerController.h index cecf729009..ee249de9d8 100644 --- a/paddle/pserver/PServerController.h +++ b/paddle/pserver/ParameterServerController.h @@ -21,39 +21,41 @@ limitations under the License. */ namespace paddle { -class PServerController final { +class ParameterServerController final { public: - DISABLE_COPY(PServerController); + DISABLE_COPY(ParameterServerController); /** - * @brief Ctor, Create a PServerUtil from ParameterServerConfig. + * @brief Ctor, Create a ParameterServerController from ParameterServerConfig. */ - explicit PServerController(const ParameterServerConfig& config); + explicit ParameterServerController(const ParameterServerConfig& config); /** * @brief Dtor. */ - ~PServerController(); + ~ParameterServerController(); /** - * @brief create PServerUtil from gflags, this is used for + * @brief create ParameterServerController from gflags, this is used for * compatibility with the old usage of configuration by gflags. */ - static PServerController* createByGflags(); + static ParameterServerController* createByGflags(); /** - * @brief create PServerUtil with ParameterServerConfig, remove gflags - * from ParameterServer. Init all pservers thread according to the config. + * @brief create ParameterServerController with ParameterServerConfig, remove + * gflags from ParameterServer. Init all pservers thread according to the + * config. */ - static PServerController* create(const ParameterServerConfig& config); + static ParameterServerController* create(const ParameterServerConfig& config); /** - * @brief start all pserver thread in this PServerUtil. + * @brief start all pserver thread in this ParameterServerController. */ void start(); /** - * @brief join and wait for all pserver thread in this PServerUtil. + * @brief join and wait for all pserver thread in this + * ParameterServerController. */ void join(); diff --git a/paddle/trainer/TrainerMain.cpp b/paddle/trainer/TrainerMain.cpp index 3ce3d67842..ccf67f96fa 100644 --- a/paddle/trainer/TrainerMain.cpp +++ b/paddle/trainer/TrainerMain.cpp @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include "paddle/pserver/PServerController.h" +#include "paddle/pserver/ParameterServerController.h" #include "paddle/utils/Excepts.h" #include "paddle/utils/PythonUtil.h" @@ -37,9 +37,9 @@ int main(int argc, char** argv) { initMain(argc, argv); initPython(argc, argv); - std::unique_ptr pServerPtr(nullptr); + std::unique_ptr pServerPtr(nullptr); if (FLAGS_start_pserver) { - pServerPtr.reset(paddle::PServerController::createByGflags()); + pServerPtr.reset(paddle::ParameterServerController::createByGflags()); pServerPtr->start(); } Trainer trainer; -- GitLab