Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
93e74f89
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
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
...
@@ -25,14 +25,14 @@ set(PSERVER_SOURCES
ParameterClient2.cpp
ParameterClient2.cpp
ParameterServer2.cpp
ParameterServer2.cpp
SparseParameterDistribution.cpp
SparseParameterDistribution.cpp
PServer
Util
.cpp
)
PServer
Controller
.cpp
)
set
(
PSERVER_HEADERS
set
(
PSERVER_HEADERS
BaseClient.h
BaseClient.h
ParameterClient2.h
ParameterClient2.h
ParameterServer2.h
ParameterServer2.h
SparseParameterDistribution.h
SparseParameterDistribution.h
PServer
Util
.h
)
PServer
Controller
.h
)
add_library
(
paddle_pserver STATIC
add_library
(
paddle_pserver STATIC
${
PSERVER_SOURCES
}
)
${
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.
...
@@ -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
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "PServer
Util
.h"
#include "PServer
Controller
.h"
namespace
paddle
{
namespace
paddle
{
PServer
Util
::
PServerUtil
(
const
ParameterServerConfig
&
config
)
{
PServer
Controller
::
PServerController
(
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 +58,9 @@ PServerUtil::PServerUtil(const ParameterServerConfig& config) {
...
@@ -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
();
ParameterServerConfig
*
config
=
new
ParameterServerConfig
();
config
->
set_nics
(
FLAGS_nics
);
config
->
set_nics
(
FLAGS_nics
);
config
->
set_port
(
FLAGS_port
);
config
->
set_port
(
FLAGS_port
);
...
@@ -69,16 +69,17 @@ ParameterServerConfig* PServerUtil::initConfig() {
...
@@ -69,16 +69,17 @@ ParameterServerConfig* PServerUtil::initConfig() {
return
config
;
return
config
;
}
}
PServer
Util
*
PServerUtil
::
createWith
Gflags
()
{
PServer
Controller
*
PServerController
::
createBy
Gflags
()
{
auto
&
pServerConfig
=
*
paddle
::
PServer
Util
::
initConfig
();
auto
&
pServerConfig
=
*
paddle
::
PServer
Controller
::
initConfigByGflags
();
return
create
(
pServerConfig
);
return
create
(
pServerConfig
);
}
}
PServerUtil
*
PServerUtil
::
create
(
const
ParameterServerConfig
&
config
)
{
PServerController
*
PServerController
::
create
(
return
new
PServerUtil
(
config
);
const
ParameterServerConfig
&
config
)
{
return
new
PServerController
(
config
);
}
}
void
PServer
Util
::
start
()
{
void
PServer
Controller
::
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_
)
{
...
@@ -88,7 +89,7 @@ void PServerUtil::start() {
...
@@ -88,7 +89,7 @@ void PServerUtil::start() {
}
}
}
}
void
PServer
Util
::
join
()
{
void
PServer
Controller
::
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_
)
{
...
...
paddle/pserver/PServer
Util
.h
→
paddle/pserver/PServer
Controller
.h
浏览文件 @
93e74f89
...
@@ -21,31 +21,31 @@ limitations under the License. */
...
@@ -21,31 +21,31 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
class
PServer
Util
{
class
PServer
Controller
{
public:
public:
DISABLE_COPY
(
PServer
Util
);
DISABLE_COPY
(
PServer
Controller
);
/**
/**
* @brief Ctor, Create a PServerUtil from ParameterServerConfig.
* @brief Ctor, Create a PServerUtil from ParameterServerConfig.
*/
*/
explicit
PServer
Util
(
const
ParameterServerConfig
&
config
);
explicit
PServer
Controller
(
const
ParameterServerConfig
&
config
);
/**
/**
* @brief Dtor.
* @brief Dtor.
*/
*/
~
PServer
Util
();
~
PServer
Controller
();
/**
/**
* @brief create PServerUtil from gflags, this is used for
* @brief create PServerUtil 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
PServer
Util
*
createWith
Gflags
();
static
PServer
Controller
*
createBy
Gflags
();
/**
/**
* @brief create PServerUtil with ParameterServerConfig, remove gflags
* @brief create PServerUtil with ParameterServerConfig, remove gflags
* from ParameterServer. Init all pservers thread according to the config.
* 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.
* @brief start all pserver thread in this PServerUtil.
...
@@ -64,7 +64,7 @@ private:
...
@@ -64,7 +64,7 @@ private:
* @brief create ParameterServerConfig from gflags, this is used for
* @brief create ParameterServerConfig 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
ParameterServerConfig
*
initConfig
();
static
ParameterServerConfig
*
initConfig
ByGflags
();
};
};
}
// namespace paddle
}
// namespace paddle
paddle/pserver/ParameterServer2Main.cpp
浏览文件 @
93e74f89
...
@@ -13,16 +13,15 @@ See the License for the specific language governing permissions and
...
@@ -13,16 +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 "PServerUtil.h"
#include "PServerController.h"
#include "paddle/trainer/ParamUtil.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
<
PServer
Util
>
pServerPtr
(
std
::
unique_ptr
<
PServer
Controller
>
pServerPtr
(
paddle
::
PServer
Util
::
createWith
Gflags
());
paddle
::
PServer
Controller
::
createBy
Gflags
());
pServerPtr
->
start
();
pServerPtr
->
start
();
pServerPtr
->
join
();
pServerPtr
->
join
();
...
...
paddle/trainer/TrainerMain.cpp
浏览文件 @
93e74f89
...
@@ -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/PServer
Util
.h"
#include "paddle/pserver/PServer
Controller
.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
<
PServer
Util
>
pServerPtr
(
nullptr
);
std
::
unique_ptr
<
PServer
Controller
>
pServerPtr
(
nullptr
);
if
(
FLAGS_start_pserver
)
{
if
(
FLAGS_start_pserver
)
{
pServerPtr
.
reset
(
paddle
::
PServer
Util
::
createWith
Gflags
());
pServerPtr
.
reset
(
paddle
::
PServer
Controller
::
createBy
Gflags
());
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录