Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
01063218
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看板
未验证
提交
01063218
编写于
9月 18, 2021
作者:
A
Aurelius84
提交者:
GitHub
9月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split cuda_profiler into .h and .cc (#35821)
* split cuda_profiler into .h and .cc * fix cmake * remove inline
上级
ba71421c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
16 deletion
+55
-16
paddle/fluid/platform/CMakeLists.txt
paddle/fluid/platform/CMakeLists.txt
+1
-0
paddle/fluid/platform/cuda_profiler.cc
paddle/fluid/platform/cuda_profiler.cc
+45
-0
paddle/fluid/platform/cuda_profiler.h
paddle/fluid/platform/cuda_profiler.h
+5
-16
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+4
-0
未找到文件。
paddle/fluid/platform/CMakeLists.txt
浏览文件 @
01063218
...
...
@@ -60,6 +60,7 @@ cc_test(cpu_info_test SRCS cpu_info_test.cc DEPS cpu_info)
IF
(
WITH_GPU
)
nv_library
(
gpu_info SRCS gpu_info.cc DEPS gflags glog enforce monitor dynload_cuda
)
nv_library
(
cuda_profiler SRCS cuda_profiler.cc DEPS enforce
)
ENDIF
()
IF
(
WITH_ROCM
)
hip_library
(
gpu_info SRCS gpu_info.cc DEPS gflags glog enforce monitor dynload_cuda
)
...
...
paddle/fluid/platform/cuda_profiler.cc
0 → 100644
浏览文件 @
01063218
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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 "paddle/fluid/platform/cuda_profiler.h"
namespace
paddle
{
namespace
platform
{
void
CudaProfilerInit
(
std
::
string
output_file
,
std
::
string
output_mode
,
std
::
string
config_file
)
{
PADDLE_ENFORCE
(
output_mode
==
"kvp"
||
output_mode
==
"csv"
,
platform
::
errors
::
InvalidArgument
(
"Unsupported cuda profiler output mode, expect `kvp` or "
"`csv`, but received `%s`."
,
output_mode
));
cudaOutputMode_t
mode
=
output_mode
==
"csv"
?
cudaCSV
:
cudaKeyValuePair
;
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerInitialize
(
config_file
.
c_str
(),
output_file
.
c_str
(),
mode
));
}
void
CudaProfilerStart
()
{
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerStart
());
}
void
CudaProfilerStop
()
{
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerStop
());
}
#ifndef _WIN32
void
CudaNvtxRangePush
(
std
::
string
name
)
{
dynload
::
nvtxRangePushA
(
name
.
c_str
());
}
void
CudaNvtxRangePop
()
{
dynload
::
nvtxRangePop
();
}
#endif
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/cuda_profiler.h
浏览文件 @
01063218
...
...
@@ -24,27 +24,16 @@ namespace paddle {
namespace
platform
{
void
CudaProfilerInit
(
std
::
string
output_file
,
std
::
string
output_mode
,
std
::
string
config_file
)
{
PADDLE_ENFORCE
(
output_mode
==
"kvp"
||
output_mode
==
"csv"
,
platform
::
errors
::
InvalidArgument
(
"Unsupported cuda profiler output mode, expect `kvp` or "
"`csv`, but received `%s`."
,
output_mode
));
cudaOutputMode_t
mode
=
output_mode
==
"csv"
?
cudaCSV
:
cudaKeyValuePair
;
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerInitialize
(
config_file
.
c_str
(),
output_file
.
c_str
(),
mode
));
}
std
::
string
config_file
);
void
CudaProfilerStart
()
{
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerStart
());
}
void
CudaProfilerStart
()
;
void
CudaProfilerStop
()
{
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaProfilerStop
());
}
void
CudaProfilerStop
()
;
#ifndef _WIN32
void
CudaNvtxRangePush
(
std
::
string
name
)
{
dynload
::
nvtxRangePushA
(
name
.
c_str
());
}
void
CudaNvtxRangePush
(
std
::
string
name
);
void
CudaNvtxRangePop
()
{
dynload
::
nvtxRangePop
();
}
void
CudaNvtxRangePop
()
;
#endif
}
// namespace platform
...
...
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
01063218
...
...
@@ -17,6 +17,10 @@ if (WITH_GPU OR WITH_ROCM)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
cuda_device_guard
)
endif
()
if
(
WITH_GPU
)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
cuda_profiler
)
endif
()
if
(
WITH_NCCL OR WITH_RCCL
)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
nccl_wrapper
)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
reducer
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录