提交 93e74f89 编写于 作者: Q qiaolongfei

rename PServerUtil to PServerController

上级 77839826
......@@ -25,14 +25,14 @@ set(PSERVER_SOURCES
ParameterClient2.cpp
ParameterServer2.cpp
SparseParameterDistribution.cpp
PServerUtil.cpp)
PServerController.cpp)
set(PSERVER_HEADERS
BaseClient.h
ParameterClient2.h
ParameterServer2.h
SparseParameterDistribution.h
PServerUtil.h)
PServerController.h)
add_library(paddle_pserver STATIC
${PSERVER_SOURCES})
......
......@@ -12,11 +12,11 @@ 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 "PServerUtil.h"
#include "PServerController.h"
namespace paddle {
PServerUtil::PServerUtil(const ParameterServerConfig& config) {
PServerController::PServerController(const ParameterServerConfig& config) {
// round robin to load balance RDMA server ENGINE
std::vector<std::string> devices;
int rdmaCpu = 0;
......@@ -58,9 +58,9 @@ PServerUtil::PServerUtil(const ParameterServerConfig& config) {
}
}
PServerUtil::~PServerUtil() { this->join(); }
PServerController::~PServerController() { this->join(); }
ParameterServerConfig* PServerUtil::initConfig() {
ParameterServerConfig* PServerController::initConfigByGflags() {
ParameterServerConfig* config = new ParameterServerConfig();
config->set_nics(FLAGS_nics);
config->set_port(FLAGS_port);
......@@ -69,16 +69,17 @@ ParameterServerConfig* PServerUtil::initConfig() {
return config;
}
PServerUtil* PServerUtil::createWithGflags() {
auto& pServerConfig = *paddle::PServerUtil::initConfig();
PServerController* PServerController::createByGflags() {
auto& pServerConfig = *paddle::PServerController::initConfigByGflags();
return create(pServerConfig);
}
PServerUtil* PServerUtil::create(const ParameterServerConfig& config) {
return new PServerUtil(config);
PServerController* PServerController::create(
const ParameterServerConfig& config) {
return new PServerController(config);
}
void PServerUtil::start() {
void PServerController::start() {
LOG(INFO) << "pserver sizes : " << pservers_.size();
int i = 0;
for (const auto& pserver : pservers_) {
......@@ -88,7 +89,7 @@ void PServerUtil::start() {
}
}
void PServerUtil::join() {
void PServerController::join() {
LOG(INFO) << "pserver sizes : " << pservers_.size();
int i = 0;
for (const auto& pserver : pservers_) {
......
......@@ -21,31 +21,31 @@ limitations under the License. */
namespace paddle {
class PServerUtil {
class PServerController {
public:
DISABLE_COPY(PServerUtil);
DISABLE_COPY(PServerController);
/**
* @brief Ctor, Create a PServerUtil from ParameterServerConfig.
*/
explicit PServerUtil(const ParameterServerConfig& config);
explicit PServerController(const ParameterServerConfig& config);
/**
* @brief Dtor.
*/
~PServerUtil();
~PServerController();
/**
* @brief create PServerUtil from gflags, this is used for
* compatibility with the old usage of configuration by gflags.
*/
static PServerUtil* createWithGflags();
static PServerController* createByGflags();
/**
* @brief create PServerUtil with ParameterServerConfig, remove gflags
* from ParameterServer. Init all pservers thread according to the config.
*/
static PServerUtil* create(const ParameterServerConfig& config);
static PServerController* create(const ParameterServerConfig& config);
/**
* @brief start all pserver thread in this PServerUtil.
......@@ -64,7 +64,7 @@ private:
* @brief create ParameterServerConfig from gflags, this is used for
* compatibility with the old usage of configuration by gflags.
*/
static ParameterServerConfig* initConfig();
static ParameterServerConfig* initConfigByGflags();
};
} // namespace paddle
......@@ -13,16 +13,15 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include <fstream>
#include "PServerUtil.h"
#include "paddle/trainer/ParamUtil.h"
#include "PServerController.h"
using namespace paddle; // NOLINT
int main(int argc, char** argv) {
initMain(argc, argv);
std::unique_ptr<PServerUtil> pServerPtr(
paddle::PServerUtil::createWithGflags());
std::unique_ptr<PServerController> pServerPtr(
paddle::PServerController::createByGflags());
pServerPtr->start();
pServerPtr->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/PServerUtil.h"
#include "paddle/pserver/PServerController.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<PServerUtil> pServerPtr(nullptr);
std::unique_ptr<PServerController> pServerPtr(nullptr);
if (FLAGS_start_pserver) {
pServerPtr.reset(paddle::PServerUtil::createWithGflags());
pServerPtr.reset(paddle::PServerController::createByGflags());
pServerPtr->start();
}
Trainer trainer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册