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

rename PServerController to ParameterServerController

上级 3f6c2b36
......@@ -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})
......
......@@ -13,15 +13,15 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include <fstream>
#include "PServerController.h"
#include "ParameterServerController.h"
using namespace paddle; // NOLINT
int main(int argc, char** argv) {
initMain(argc, argv);
std::unique_ptr<PServerController> pServerPtr(
paddle::PServerController::createByGflags());
std::unique_ptr<ParameterServerController> pServerPtr(
paddle::ParameterServerController::createByGflags());
pServerPtr->start();
pServerPtr->join();
......
......@@ -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<std::string> 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_) {
......
......@@ -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();
......
......@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include <fenv.h>
#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<PServerController> pServerPtr(nullptr);
std::unique_ptr<ParameterServerController> pServerPtr(nullptr);
if (FLAGS_start_pserver) {
pServerPtr.reset(paddle::PServerController::createByGflags());
pServerPtr.reset(paddle::ParameterServerController::createByGflags());
pServerPtr->start();
}
Trainer trainer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册