Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
93e74f89
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
93e74f89
编写于
1月 04, 2017
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename PServerUtil to PServerController
上级
77839826
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
26 addition
and
26 deletion
+26
-26
paddle/pserver/CMakeLists.txt
paddle/pserver/CMakeLists.txt
+2
-2
paddle/pserver/PServerController.cpp
paddle/pserver/PServerController.cpp
+11
-10
paddle/pserver/PServerController.h
paddle/pserver/PServerController.h
+7
-7
paddle/pserver/ParameterServer2Main.cpp
paddle/pserver/ParameterServer2Main.cpp
+3
-4
paddle/trainer/TrainerMain.cpp
paddle/trainer/TrainerMain.cpp
+3
-3
未找到文件。
paddle/pserver/CMakeLists.txt
浏览文件 @
93e74f89
...
...
@@ -25,14 +25,14 @@ set(PSERVER_SOURCES
ParameterClient2.cpp
ParameterServer2.cpp
SparseParameterDistribution.cpp
PServer
Util
.cpp
)
PServer
Controller
.cpp
)
set
(
PSERVER_HEADERS
BaseClient.h
ParameterClient2.h
ParameterServer2.h
SparseParameterDistribution.h
PServer
Util
.h
)
PServer
Controller
.h
)
add_library
(
paddle_pserver STATIC
${
PSERVER_SOURCES
}
)
...
...
paddle/pserver/PServer
Util
.cpp
→
paddle/pserver/PServer
Controller
.cpp
浏览文件 @
93e74f89
...
...
@@ -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 "PServer
Util
.h"
#include "PServer
Controller
.h"
namespace
paddle
{
PServer
Util
::
PServerUtil
(
const
ParameterServerConfig
&
config
)
{
PServer
Controller
::
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) {
}
}
PServer
Util
::~
PServerUtil
()
{
this
->
join
();
}
PServer
Controller
::~
PServerController
()
{
this
->
join
();
}
ParameterServerConfig
*
PServer
Util
::
initConfig
()
{
ParameterServerConfig
*
PServer
Controller
::
initConfigByGflags
()
{
ParameterServerConfig
*
config
=
new
ParameterServerConfig
();
config
->
set_nics
(
FLAGS_nics
);
config
->
set_port
(
FLAGS_port
);
...
...
@@ -69,16 +69,17 @@ ParameterServerConfig* PServerUtil::initConfig() {
return
config
;
}
PServer
Util
*
PServerUtil
::
createWith
Gflags
()
{
auto
&
pServerConfig
=
*
paddle
::
PServer
Util
::
initConfig
();
PServer
Controller
*
PServerController
::
createBy
Gflags
()
{
auto
&
pServerConfig
=
*
paddle
::
PServer
Controller
::
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
PServer
Util
::
start
()
{
void
PServer
Controller
::
start
()
{
LOG
(
INFO
)
<<
"pserver sizes : "
<<
pservers_
.
size
();
int
i
=
0
;
for
(
const
auto
&
pserver
:
pservers_
)
{
...
...
@@ -88,7 +89,7 @@ void PServerUtil::start() {
}
}
void
PServer
Util
::
join
()
{
void
PServer
Controller
::
join
()
{
LOG
(
INFO
)
<<
"pserver sizes : "
<<
pservers_
.
size
();
int
i
=
0
;
for
(
const
auto
&
pserver
:
pservers_
)
{
...
...
paddle/pserver/PServer
Util
.h
→
paddle/pserver/PServer
Controller
.h
浏览文件 @
93e74f89
...
...
@@ -21,31 +21,31 @@ limitations under the License. */
namespace
paddle
{
class
PServer
Util
{
class
PServer
Controller
{
public:
DISABLE_COPY
(
PServer
Util
);
DISABLE_COPY
(
PServer
Controller
);
/**
* @brief Ctor, Create a PServerUtil from ParameterServerConfig.
*/
explicit
PServer
Util
(
const
ParameterServerConfig
&
config
);
explicit
PServer
Controller
(
const
ParameterServerConfig
&
config
);
/**
* @brief Dtor.
*/
~
PServer
Util
();
~
PServer
Controller
();
/**
* @brief create PServerUtil from gflags, this is used for
* compatibility with the old usage of configuration by gflags.
*/
static
PServer
Util
*
createWith
Gflags
();
static
PServer
Controller
*
createBy
Gflags
();
/**
* @brief create PServerUtil with ParameterServerConfig, remove gflags
* from ParameterServer. Init all pservers thread according to the config.
*/
static
PServer
Util
*
create
(
const
ParameterServerConfig
&
config
);
static
PServer
Controller
*
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
*
initConfig
ByGflags
();
};
}
// namespace paddle
paddle/pserver/ParameterServer2Main.cpp
浏览文件 @
93e74f89
...
...
@@ -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
<
PServer
Util
>
pServerPtr
(
paddle
::
PServer
Util
::
createWith
Gflags
());
std
::
unique_ptr
<
PServer
Controller
>
pServerPtr
(
paddle
::
PServer
Controller
::
createBy
Gflags
());
pServerPtr
->
start
();
pServerPtr
->
join
();
...
...
paddle/trainer/TrainerMain.cpp
浏览文件 @
93e74f89
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include <fenv.h>
#include "paddle/pserver/PServer
Util
.h"
#include "paddle/pserver/PServer
Controller
.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
<
PServer
Util
>
pServerPtr
(
nullptr
);
std
::
unique_ptr
<
PServer
Controller
>
pServerPtr
(
nullptr
);
if
(
FLAGS_start_pserver
)
{
pServerPtr
.
reset
(
paddle
::
PServer
Util
::
createWith
Gflags
());
pServerPtr
.
reset
(
paddle
::
PServer
Controller
::
createBy
Gflags
());
pServerPtr
->
start
();
}
Trainer
trainer
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录