diff --git a/paddle/pserver/CMakeLists.txt b/paddle/pserver/CMakeLists.txt index ac52b8dbeced70aa556970e8f685df68e6b4e354..b7f85ea1a6dfda2a37c315ba15c6ca1979cf4131 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 6e683cdd2c2c88450af90254e73cee0dced83440..114505252211d9a45418e0e298c188785638f1c2 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 8d2e026bca79d5e906e945d4c4c7a8de30bbd607..ec24bc7e573dce2cca484d0deabf4710fd19a25c 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 cecf7290094a25aa3c3149ac60e0cee1d01d59fb..ee249de9d802de141e5848be472b6def513a77d3 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 3ce3d67842ddaa195fdcae0b087bdf715abb967a..ccf67f96fa8f50bc8ff22c67f505aa42c3d47663 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;