提交 5aaaef44 编写于 作者: Q qiaolongfei

rename PServerController to ParameterServerController

上级 3f6c2b36
...@@ -25,14 +25,14 @@ set(PSERVER_SOURCES ...@@ -25,14 +25,14 @@ set(PSERVER_SOURCES
ParameterClient2.cpp ParameterClient2.cpp
ParameterServer2.cpp ParameterServer2.cpp
SparseParameterDistribution.cpp SparseParameterDistribution.cpp
PServerController.cpp) ParameterServerController.cpp)
set(PSERVER_HEADERS set(PSERVER_HEADERS
BaseClient.h BaseClient.h
ParameterClient2.h ParameterClient2.h
ParameterServer2.h ParameterServer2.h
SparseParameterDistribution.h SparseParameterDistribution.h
PServerController.h) ParameterServerController.h)
add_library(paddle_pserver STATIC add_library(paddle_pserver STATIC
${PSERVER_SOURCES}) ${PSERVER_SOURCES})
......
...@@ -13,15 +13,15 @@ See the License for the specific language governing permissions and ...@@ -13,15 +13,15 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include <fstream> #include <fstream>
#include "PServerController.h" #include "ParameterServerController.h"
using namespace paddle; // NOLINT using namespace paddle; // NOLINT
int main(int argc, char** argv) { int main(int argc, char** argv) {
initMain(argc, argv); initMain(argc, argv);
std::unique_ptr<PServerController> pServerPtr( std::unique_ptr<ParameterServerController> pServerPtr(
paddle::PServerController::createByGflags()); paddle::ParameterServerController::createByGflags());
pServerPtr->start(); pServerPtr->start();
pServerPtr->join(); pServerPtr->join();
......
...@@ -12,11 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -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 See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "PServerController.h" #include "ParameterServerController.h"
namespace paddle { namespace paddle {
PServerController::PServerController(const ParameterServerConfig& config) { ParameterServerController::ParameterServerController(
const ParameterServerConfig& config) {
// round robin to load balance RDMA server ENGINE // round robin to load balance RDMA server ENGINE
std::vector<std::string> devices; std::vector<std::string> devices;
int rdmaCpu = 0; int rdmaCpu = 0;
...@@ -58,9 +59,9 @@ PServerController::PServerController(const ParameterServerConfig& config) { ...@@ -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; ParameterServerConfig config;
config.set_nics(FLAGS_nics); config.set_nics(FLAGS_nics);
...@@ -72,12 +73,12 @@ PServerController* PServerController::createByGflags() { ...@@ -72,12 +73,12 @@ PServerController* PServerController::createByGflags() {
return create(config); return create(config);
} }
PServerController* PServerController::create( ParameterServerController* ParameterServerController::create(
const ParameterServerConfig& config) { const ParameterServerConfig& config) {
return new PServerController(config); return new ParameterServerController(config);
} }
void PServerController::start() { void ParameterServerController::start() {
LOG(INFO) << "pserver sizes : " << pservers_.size(); LOG(INFO) << "pserver sizes : " << pservers_.size();
int i = 0; int i = 0;
for (const auto& pserver : pservers_) { for (const auto& pserver : pservers_) {
...@@ -87,7 +88,7 @@ void PServerController::start() { ...@@ -87,7 +88,7 @@ void PServerController::start() {
} }
} }
void PServerController::join() { void ParameterServerController::join() {
LOG(INFO) << "pserver sizes : " << pservers_.size(); LOG(INFO) << "pserver sizes : " << pservers_.size();
int i = 0; int i = 0;
for (const auto& pserver : pservers_) { for (const auto& pserver : pservers_) {
......
...@@ -21,39 +21,41 @@ limitations under the License. */ ...@@ -21,39 +21,41 @@ limitations under the License. */
namespace paddle { namespace paddle {
class PServerController final { class ParameterServerController final {
public: 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. * @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. * compatibility with the old usage of configuration by gflags.
*/ */
static PServerController* createByGflags(); static ParameterServerController* createByGflags();
/** /**
* @brief create PServerUtil with ParameterServerConfig, remove gflags * @brief create ParameterServerController with ParameterServerConfig, remove
* from ParameterServer. Init all pservers thread according to the config. * 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(); 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(); void join();
......
...@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and ...@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include <fenv.h> #include <fenv.h>
#include "paddle/pserver/PServerController.h" #include "paddle/pserver/ParameterServerController.h"
#include "paddle/utils/Excepts.h" #include "paddle/utils/Excepts.h"
#include "paddle/utils/PythonUtil.h" #include "paddle/utils/PythonUtil.h"
...@@ -37,9 +37,9 @@ int main(int argc, char** argv) { ...@@ -37,9 +37,9 @@ int main(int argc, char** argv) {
initMain(argc, argv); initMain(argc, argv);
initPython(argc, argv); initPython(argc, argv);
std::unique_ptr<PServerController> pServerPtr(nullptr); std::unique_ptr<ParameterServerController> pServerPtr(nullptr);
if (FLAGS_start_pserver) { if (FLAGS_start_pserver) {
pServerPtr.reset(paddle::PServerController::createByGflags()); pServerPtr.reset(paddle::ParameterServerController::createByGflags());
pServerPtr->start(); pServerPtr->start();
} }
Trainer trainer; Trainer trainer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册