Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
5a0a4617
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5a0a4617
编写于
1月 05, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make time calc funcs return ms instead of us
上级
d7e56847
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
13 deletion
+12
-13
paddle/platform/profiler.cc
paddle/platform/profiler.cc
+6
-7
paddle/platform/profiler.h
paddle/platform/profiler.h
+2
-2
paddle/platform/profiler_test.cc
paddle/platform/profiler_test.cc
+4
-4
未找到文件。
paddle/platform/profiler.cc
浏览文件 @
5a0a4617
...
...
@@ -74,11 +74,11 @@ std::string Event::kind() const {
PADDLE_THROW
(
"Unknown EventKind."
);
}
double
Event
::
CpuElapsed
U
s
(
const
Event
&
e
)
const
{
return
(
e
.
cpu_ns_
-
cpu_ns_
)
/
(
1000.0
);
double
Event
::
CpuElapsed
M
s
(
const
Event
&
e
)
const
{
return
(
e
.
cpu_ns_
-
cpu_ns_
)
/
(
1000
000
.0
);
}
double
Event
::
CudaElapsed
U
s
(
const
Event
&
e
)
const
{
double
Event
::
CudaElapsed
M
s
(
const
Event
&
e
)
const
{
#ifdef PADDLE_WITH_CUDA
PADDLE_ENFORCE
(
e
.
has_cuda
()
&&
has_cuda
());
PADDLE_ENFORCE
(
e
.
device
()
==
device
());
...
...
@@ -86,7 +86,7 @@ double Event::CudaElapsedUs(const Event& e) const {
PADDLE_ENFORCE
(
cudaEventSynchronize
(
e
.
event
()));
float
ms
;
PADDLE_ENFORCE
(
cudaEventElapsedTime
(
&
ms
,
event_
,
e
.
event
()));
return
ms
*
1000.0
;
return
ms
;
#else
PADDLE_THROW
(
"CUDA is not enabled"
);
#endif
...
...
@@ -239,11 +239,10 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
++
rit
;
}
if
(
rit
!=
pushed_events
.
rend
())
{
// get event time in ms
#ifdef PADDLE_WITH_CUDA
double
event_time
=
rit
->
CudaElapsed
Us
(
events
[
i
][
j
])
/
1000.0
;
double
event_time
=
rit
->
CudaElapsed
Ms
(
events
[
i
][
j
])
;
#else
double
event_time
=
rit
->
CpuElapsed
Us
(
events
[
i
][
j
])
/
1000.0
;
double
event_time
=
rit
->
CpuElapsed
Ms
(
events
[
i
][
j
])
;
#endif
std
::
string
event_name
=
"thread"
+
std
::
to_string
(
rit
->
thread_id
())
+
"::"
+
rit
->
name
();
...
...
paddle/platform/profiler.h
浏览文件 @
5a0a4617
...
...
@@ -41,8 +41,8 @@ class Event {
int
device
()
const
{
return
device_
;
}
#endif
double
CpuElapsed
U
s
(
const
Event
&
e
)
const
;
double
CudaElapsed
U
s
(
const
Event
&
e
)
const
;
double
CpuElapsed
M
s
(
const
Event
&
e
)
const
;
double
CudaElapsed
M
s
(
const
Event
&
e
)
const
;
private:
EventKind
kind_
;
...
...
paddle/platform/profiler_test.cc
浏览文件 @
5a0a4617
...
...
@@ -26,7 +26,7 @@ TEST(Event, CpuElapsedTime) {
counter
++
;
}
Event
stop_event
(
EventKind
::
kPopRange
,
"test"
,
0
,
nullptr
);
EXPECT_GT
(
start_event
.
CpuElapsed
U
s
(
stop_event
),
0
);
EXPECT_GT
(
start_event
.
CpuElapsed
M
s
(
stop_event
),
0
);
}
#ifdef PADDLE_WITH_CUDA
...
...
@@ -45,7 +45,7 @@ TEST(Event, CudaElapsedTime) {
counter
++
;
}
Event
stop_event
(
EventKind
::
kPopRange
,
"test"
,
0
,
dev_ctx
);
EXPECT_GT
(
start_event
.
CudaElapsed
U
s
(
stop_event
),
0
);
EXPECT_GT
(
start_event
.
CudaElapsed
M
s
(
stop_event
),
0
);
}
#endif
...
...
@@ -114,9 +114,9 @@ TEST(RecordEvent, RecordEvent) {
if
(
events
[
i
][
j
].
name
()
==
"push"
)
{
EXPECT_EQ
(
events
[
i
][
j
+
1
].
name
(),
"pop"
);
#ifdef PADDLE_WITH_CUDA
EXPECT_GT
(
events
[
i
][
j
].
CudaElapsed
U
s
(
events
[
i
][
j
+
1
]),
0
);
EXPECT_GT
(
events
[
i
][
j
].
CudaElapsed
M
s
(
events
[
i
][
j
+
1
]),
0
);
#else
EXPECT_GT
(
events
[
i
][
j
].
CpuElapsed
U
s
(
events
[
i
][
j
+
1
]),
0
);
EXPECT_GT
(
events
[
i
][
j
].
CpuElapsed
M
s
(
events
[
i
][
j
+
1
]),
0
);
#endif
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录