Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
08e4970e
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
1 年多 前同步成功
通知
696
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看板
提交
08e4970e
编写于
5月 23, 2018
作者:
X
Xin Pan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments
上级
a848303e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
22 deletion
+24
-22
paddle/fluid/operators/detail/grpc_server.cc
paddle/fluid/operators/detail/grpc_server.cc
+13
-11
paddle/fluid/operators/detail/grpc_server.h
paddle/fluid/operators/detail/grpc_server.h
+3
-3
paddle/fluid/operators/detail/sendrecvop_utils.cc
paddle/fluid/operators/detail/sendrecvop_utils.cc
+2
-6
paddle/fluid/operators/detail/variable_response.cc
paddle/fluid/operators/detail/variable_response.cc
+4
-2
paddle/fluid/platform/profiler.h
paddle/fluid/platform/profiler.h
+2
-0
未找到文件。
paddle/fluid/operators/detail/grpc_server.cc
浏览文件 @
08e4970e
...
@@ -19,14 +19,16 @@ limitations under the License. */
...
@@ -19,14 +19,16 @@ limitations under the License. */
using
::
grpc
::
ServerAsyncResponseWriter
;
using
::
grpc
::
ServerAsyncResponseWriter
;
DEFINE_int32
(
rpc_server_handle_send_threads
,
20
,
"Number of threads used to handle send at rpc server."
);
DEFINE_int32
(
rpc_server_handle_get_threads
,
20
,
"Number of threads used to handle get at rpc server."
);
DEFINE_int32
(
rpc_server_handle_prefetch_threads
,
1
,
"Number of threads used to handle prefetch at rpc server."
);
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
namespace
detail
{
namespace
detail
{
namespace
{
const
int
kNumHandleSendThreads
=
20
;
const
int
kNumHandleGetThreads
=
20
;
const
int
kNumHandlePrefetchThreads
=
1
;
}
// namespace
enum
CallStatus
{
PROCESS
=
0
,
FINISH
};
enum
CallStatus
{
PROCESS
=
0
,
FINISH
};
// reference:
// reference:
...
@@ -268,17 +270,17 @@ void AsyncGRPCServer::RunSyncUpdate() {
...
@@ -268,17 +270,17 @@ void AsyncGRPCServer::RunSyncUpdate() {
TryToRegisterNewPrefetchOne
(
i
);
TryToRegisterNewPrefetchOne
(
i
);
}
}
for
(
int
i
=
0
;
i
<
kNumHandleSendT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_send_t
hreads
;
++
i
)
{
t_sends_
.
emplace_back
(
t_sends_
.
emplace_back
(
new
std
::
thread
(
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
new
std
::
thread
(
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
cq_send_
.
get
(),
"cq_send"
,
send_register
)));
cq_send_
.
get
(),
"cq_send"
,
send_register
)));
}
}
for
(
int
i
=
0
;
i
<
kNumHandleGetT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_get_t
hreads
;
++
i
)
{
t_gets_
.
emplace_back
(
t_gets_
.
emplace_back
(
new
std
::
thread
(
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
new
std
::
thread
(
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
cq_get_
.
get
(),
"cq_get"
,
get_register
)));
cq_get_
.
get
(),
"cq_get"
,
get_register
)));
}
}
for
(
int
i
=
0
;
i
<
kNumHandlePrefetchT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_prefetch_t
hreads
;
++
i
)
{
t_prefetchs_
.
emplace_back
(
new
std
::
thread
(
t_prefetchs_
.
emplace_back
(
new
std
::
thread
(
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
cq_prefetch_
.
get
(),
std
::
bind
(
&
AsyncGRPCServer
::
HandleRequest
,
this
,
cq_prefetch_
.
get
(),
"cq_prefetch"
,
prefetch_register
)));
"cq_prefetch"
,
prefetch_register
)));
...
@@ -290,13 +292,13 @@ void AsyncGRPCServer::RunSyncUpdate() {
...
@@ -290,13 +292,13 @@ void AsyncGRPCServer::RunSyncUpdate() {
condition_ready_
.
notify_all
();
condition_ready_
.
notify_all
();
// wait server
// wait server
server_
->
Wait
();
server_
->
Wait
();
for
(
int
i
=
0
;
i
<
kNumHandleSendT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_send_t
hreads
;
++
i
)
{
t_sends_
[
i
]
->
join
();
t_sends_
[
i
]
->
join
();
}
}
for
(
int
i
=
0
;
i
<
kNumHandleGetT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_get_t
hreads
;
++
i
)
{
t_gets_
[
i
]
->
join
();
t_gets_
[
i
]
->
join
();
}
}
for
(
int
i
=
0
;
i
<
kNumHandlePrefetchT
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
FLAGS_rpc_server_handle_prefetch_t
hreads
;
++
i
)
{
t_prefetchs_
[
i
]
->
join
();
t_prefetchs_
[
i
]
->
join
();
}
}
}
}
...
...
paddle/fluid/operators/detail/grpc_server.h
浏览文件 @
08e4970e
...
@@ -85,9 +85,9 @@ class AsyncGRPCServer final {
...
@@ -85,9 +85,9 @@ class AsyncGRPCServer final {
void
HandleRequest
(
::
grpc
::
ServerCompletionQueue
*
cq
,
void
HandleRequest
(
::
grpc
::
ServerCompletionQueue
*
cq
,
const
std
::
string
&
cq_name
,
const
std
::
string
&
cq_name
,
std
::
function
<
void
(
int
)
>
TryToRegisterNewOne
);
std
::
function
<
void
(
int
)
>
TryToRegisterNewOne
);
void
TryToRegisterNewSendOne
(
int
i
);
void
TryToRegisterNewSendOne
(
int
req_id
);
void
TryToRegisterNewGetOne
(
int
i
);
void
TryToRegisterNewGetOne
(
int
req_id
);
void
TryToRegisterNewPrefetchOne
(
int
i
);
void
TryToRegisterNewPrefetchOne
(
int
req_id
);
void
ShutdownQueue
();
void
ShutdownQueue
();
private:
private:
...
...
paddle/fluid/operators/detail/sendrecvop_utils.cc
浏览文件 @
08e4970e
...
@@ -31,10 +31,6 @@ limitations under the License. */
...
@@ -31,10 +31,6 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
namespace
detail
{
namespace
detail
{
namespace
{
const
int
kStartProfile
=
1
;
const
int
kStopProfile
=
2
;
}
// namespace
using
VarMsg
=
sendrecv
::
VariableMessage
;
using
VarMsg
=
sendrecv
::
VariableMessage
;
...
@@ -128,9 +124,9 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var,
...
@@ -128,9 +124,9 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var,
// trainer.
// trainer.
if
(
platform
::
ShouldSendProfileState
())
{
if
(
platform
::
ShouldSendProfileState
())
{
if
(
platform
::
IsProfileEnabled
())
{
if
(
platform
::
IsProfileEnabled
())
{
request
.
set_profile
(
kStartProfile
);
request
.
set_profile
(
platform
::
kEnableProfiler
);
}
else
{
}
else
{
request
.
set_profile
(
kStopProfile
);
request
.
set_profile
(
platform
::
kDisableProfiler
);
}
}
}
}
if
(
!
out_name
.
empty
())
{
if
(
!
out_name
.
empty
())
{
...
...
paddle/fluid/operators/detail/variable_response.cc
浏览文件 @
08e4970e
...
@@ -458,9 +458,11 @@ int VariableResponse::Parse(Source* source) {
...
@@ -458,9 +458,11 @@ int VariableResponse::Parse(Source* source) {
if
(
listener_id
<=
0
)
{
if
(
listener_id
<=
0
)
{
break
;
break
;
}
}
if
(
profiling
==
1
&&
!
platform
::
IsProfileEnabled
())
{
if
(
profiling
==
platform
::
kEnableProfiler
&&
!
platform
::
IsProfileEnabled
())
{
platform
::
EnableProfiler
(
platform
::
ProfilerState
::
kCPU
);
platform
::
EnableProfiler
(
platform
::
ProfilerState
::
kCPU
);
}
else
if
(
profiling
==
2
&&
platform
::
IsProfileEnabled
())
{
}
else
if
(
profiling
==
platform
::
kDisableProfiler
&&
platform
::
IsProfileEnabled
())
{
// TODO(panyx0718): Should we allow to customize file dir.
// TODO(panyx0718): Should we allow to customize file dir.
platform
::
DisableProfiler
(
platform
::
DisableProfiler
(
platform
::
EventSortingKey
::
kDefault
,
platform
::
EventSortingKey
::
kDefault
,
...
...
paddle/fluid/platform/profiler.h
浏览文件 @
08e4970e
...
@@ -116,6 +116,8 @@ void ResetProfiler();
...
@@ -116,6 +116,8 @@ void ResetProfiler();
void
DisableProfiler
(
EventSortingKey
sorted_key
,
void
DisableProfiler
(
EventSortingKey
sorted_key
,
const
std
::
string
&
profile_path
);
const
std
::
string
&
profile_path
);
const
int
kEnableProfiler
=
1
;
const
int
kDisableProfiler
=
2
;
// Test if the profiler is currently enabled.
// Test if the profiler is currently enabled.
bool
IsProfileEnabled
();
bool
IsProfileEnabled
();
// Whether the trainer should send profiling state to PS.
// Whether the trainer should send profiling state to PS.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录