Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
7a43e517
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7a43e517
编写于
12月 12, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gperf tools
上级
57033869
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
2 deletion
+54
-2
CMakeLists.txt
CMakeLists.txt
+6
-0
cmake/generic.cmake
cmake/generic.cmake
+16
-0
paddle/fluid/framework/parallel_executor.cc
paddle/fluid/framework/parallel_executor.cc
+30
-1
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+2
-1
未找到文件。
CMakeLists.txt
浏览文件 @
7a43e517
...
@@ -81,6 +81,12 @@ option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
...
@@ -81,6 +81,12 @@ option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
option
(
PY_VERSION
"Compile PaddlePaddle with python3 support"
${
PY_VERSION
}
)
option
(
PY_VERSION
"Compile PaddlePaddle with python3 support"
${
PY_VERSION
}
)
option
(
WITH_FAST_MATH
"Make use of fast math library, might affect the precision to some extent"
ON
)
option
(
WITH_FAST_MATH
"Make use of fast math library, might affect the precision to some extent"
ON
)
if
(
WITH_PROFILER
)
find_package
(
Gperftools REQUIRED
)
include_directories
(
${
GPERFTOOLS_INCLUDE_DIR
}
)
add_definitions
(
-DWITH_GPERFTOOLS
)
endif
()
# PY_VERSION
# PY_VERSION
if
(
NOT PY_VERSION
)
if
(
NOT PY_VERSION
)
set
(
PY_VERSION 2.7
)
set
(
PY_VERSION 2.7
)
...
...
cmake/generic.cmake
浏览文件 @
7a43e517
...
@@ -110,6 +110,14 @@ function(find_fluid_modules TARGET_NAME)
...
@@ -110,6 +110,14 @@ function(find_fluid_modules TARGET_NAME)
endif
()
endif
()
endfunction
(
find_fluid_modules
)
endfunction
(
find_fluid_modules
)
function
(
common_link TARGET_NAME
)
if
(
WITH_PROFILER
)
target_link_libraries
(
${
TARGET_NAME
}
gperftools::profiler
)
endif
()
endfunction
()
# find all third_party modules is used for paddle static library
# find all third_party modules is used for paddle static library
# for reduce the dependency when building the inference libs.
# for reduce the dependency when building the inference libs.
set_property
(
GLOBAL PROPERTY FLUID_THIRD_PARTY
)
set_property
(
GLOBAL PROPERTY FLUID_THIRD_PARTY
)
...
@@ -274,6 +282,7 @@ function(cc_library TARGET_NAME)
...
@@ -274,6 +282,7 @@ function(cc_library TARGET_NAME)
endif
()
endif
()
target_link_libraries
(
${
TARGET_NAME
}
${
cc_library_DEPS
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_library_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_library_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_library_DEPS
}
)
common_link
(
${
TARGET_NAME
}
)
endif
()
endif
()
# cpplint code style
# cpplint code style
...
@@ -340,6 +349,7 @@ function(cc_binary TARGET_NAME)
...
@@ -340,6 +349,7 @@ function(cc_binary TARGET_NAME)
if
(
cc_binary_DEPS
)
if
(
cc_binary_DEPS
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
common_link
(
${
TARGET_NAME
}
)
endif
()
endif
()
endfunction
(
cc_binary
)
endfunction
(
cc_binary
)
...
@@ -362,6 +372,7 @@ function(cc_test TARGET_NAME)
...
@@ -362,6 +372,7 @@ function(cc_test TARGET_NAME)
target_link_libraries
(
${
TARGET_NAME
}
${
win32_deps
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
win32_deps
}
)
endif
(
WIN32
)
endif
(
WIN32
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
common_link
(
${
TARGET_NAME
}
)
add_test
(
NAME
${
TARGET_NAME
}
add_test
(
NAME
${
TARGET_NAME
}
COMMAND
${
TARGET_NAME
}
${
cc_test_ARGS
}
COMMAND
${
TARGET_NAME
}
${
cc_test_ARGS
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
...
@@ -420,6 +431,7 @@ function(nv_binary TARGET_NAME)
...
@@ -420,6 +431,7 @@ function(nv_binary TARGET_NAME)
if
(
nv_binary_DEPS
)
if
(
nv_binary_DEPS
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
common_link
(
${
TARGET_NAME
}
)
endif
()
endif
()
endif
()
endif
()
endfunction
(
nv_binary
)
endfunction
(
nv_binary
)
...
@@ -433,6 +445,7 @@ function(nv_test TARGET_NAME)
...
@@ -433,6 +445,7 @@ function(nv_test TARGET_NAME)
cuda_add_executable
(
${
TARGET_NAME
}
${
nv_test_SRCS
}
)
cuda_add_executable
(
${
TARGET_NAME
}
${
nv_test_SRCS
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
paddle_gtest_main lod_tensor memory gtest gflags glog
)
common_link
(
${
TARGET_NAME
}
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
if
(
nv_test_SERIAL
)
if
(
nv_test_SERIAL
)
set_property
(
TEST
${
TARGET_NAME
}
PROPERTY RUN_SERIAL 1
)
set_property
(
TEST
${
TARGET_NAME
}
PROPERTY RUN_SERIAL 1
)
...
@@ -499,6 +512,7 @@ function(hip_binary TARGET_NAME)
...
@@ -499,6 +512,7 @@ function(hip_binary TARGET_NAME)
if
(
hip_binary_DEPS
)
if
(
hip_binary_DEPS
)
target_link_libraries
(
${
TARGET_NAME
}
${
hip_binary_DEPS
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
hip_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
hip_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
hip_binary_DEPS
}
)
common_link
(
${
TARGET_NAME
}
)
endif
()
endif
()
endif
()
endif
()
endfunction
(
hip_binary
)
endfunction
(
hip_binary
)
...
@@ -518,6 +532,7 @@ function(hip_test TARGET_NAME)
...
@@ -518,6 +532,7 @@ function(hip_test TARGET_NAME)
set_target_properties
(
${
TARGET_NAME
}
PROPERTIES LINKER_LANGUAGE HIP
)
set_target_properties
(
${
TARGET_NAME
}
PROPERTIES LINKER_LANGUAGE HIP
)
target_link_libraries
(
${
TARGET_NAME
}
${
hip_test_DEPS
}
paddle_gtest_main memory gtest gflags
)
target_link_libraries
(
${
TARGET_NAME
}
${
hip_test_DEPS
}
paddle_gtest_main memory gtest gflags
)
add_dependencies
(
${
TARGET_NAME
}
${
hip_test_DEPS
}
paddle_gtest_main memory gtest gflags
)
add_dependencies
(
${
TARGET_NAME
}
${
hip_test_DEPS
}
paddle_gtest_main memory gtest gflags
)
common_link
(
${
TARGET_NAME
}
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
endif
()
endif
()
endfunction
(
hip_test
)
endfunction
(
hip_test
)
...
@@ -560,6 +575,7 @@ function(go_library TARGET_NAME)
...
@@ -560,6 +575,7 @@ function(go_library TARGET_NAME)
endif
()
endif
()
if
(
go_library_DEPS
)
if
(
go_library_DEPS
)
add_dependencies
(
${
TARGET_NAME
}
${
go_library_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
go_library_DEPS
}
)
common_link
(
${
TARGET_NAME
}
)
endif
(
go_library_DEPS
)
endif
(
go_library_DEPS
)
# The "source file" of the library is `${dummyfile}` which never
# The "source file" of the library is `${dummyfile}` which never
...
...
paddle/fluid/framework/parallel_executor.cc
浏览文件 @
7a43e517
...
@@ -30,13 +30,36 @@ limitations under the License. */
...
@@ -30,13 +30,36 @@ limitations under the License. */
#include "paddle/fluid/framework/details/threaded_ssa_graph_executor.h"
#include "paddle/fluid/framework/details/threaded_ssa_graph_executor.h"
#include "paddle/fluid/platform/profiler.h"
#include "paddle/fluid/platform/profiler.h"
#ifdef WITH_GPERFTOOLS
#include "gperftools/profiler.h"
#endif
DEFINE_string
(
pe_profile_fname
,
""
,
"Profiler filename for PE, which generated by gperftools."
"Only valid when compiled `WITH_PRIFILER=ON`. Empty if disable."
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
static
std
::
once_flag
gProfileOnce
;
#ifdef WITH_GPERFTOOLS
static
bool
gProfileStarted
=
false
;
#endif
class
ParallelExecutorPrivate
{
class
ParallelExecutorPrivate
{
public:
public:
explicit
ParallelExecutorPrivate
(
const
std
::
vector
<
platform
::
Place
>
&
places
)
explicit
ParallelExecutorPrivate
(
const
std
::
vector
<
platform
::
Place
>
&
places
)
:
places_
(
places
)
{}
:
places_
(
places
)
{
if
(
!
FLAGS_pe_profile_fname
.
empty
())
{
std
::
call_once
(
gProfileOnce
,
[]
{
#ifdef WITH_GPERFTOOLS
ProfilerStart
(
FLAGS_pe_profile_fname
.
c_str
());
gProfileStarted
=
true
;
#else
LOG
(
WARNING
)
<<
"Paddle is not compiled with gperftools. "
"FLAGS_pe_profile_fname will be ignored"
;
#endif
});
}
}
~
ParallelExecutorPrivate
()
{
~
ParallelExecutorPrivate
()
{
if
(
own_local_scope_
)
{
if
(
own_local_scope_
)
{
...
@@ -270,6 +293,12 @@ void ParallelExecutor::BCastParamsToDevices(
...
@@ -270,6 +293,12 @@ void ParallelExecutor::BCastParamsToDevices(
void
ParallelExecutor
::
Run
(
const
std
::
vector
<
std
::
string
>
&
fetch_tensors
,
void
ParallelExecutor
::
Run
(
const
std
::
vector
<
std
::
string
>
&
fetch_tensors
,
const
std
::
string
&
fetched_var_name
)
{
const
std
::
string
&
fetched_var_name
)
{
#ifdef WITH_GPERFTOOLS
if
(
gProfileStarted
)
{
ProfilerFlush
();
}
#endif
platform
::
RecordBlock
b
(
0
);
platform
::
RecordBlock
b
(
0
);
#ifdef PADDLE_WITH_CUDA
#ifdef PADDLE_WITH_CUDA
if
(
!
gcs_
.
empty
())
{
if
(
!
gcs_
.
empty
())
{
...
...
python/paddle/fluid/__init__.py
浏览文件 @
7a43e517
...
@@ -125,7 +125,8 @@ def __bootstrap__():
...
@@ -125,7 +125,8 @@ def __bootstrap__():
'use_ngraph'
,
'initial_cpu_memory_in_mb'
,
'init_allocated_mem'
,
'use_ngraph'
,
'initial_cpu_memory_in_mb'
,
'init_allocated_mem'
,
'free_idle_memory'
,
'paddle_num_threads'
,
"dist_threadpool_size"
,
'free_idle_memory'
,
'paddle_num_threads'
,
"dist_threadpool_size"
,
'eager_delete_tensor_gb'
,
'allocator_strategy'
,
'eager_delete_tensor_gb'
,
'allocator_strategy'
,
'reader_queue_speed_test_mode'
,
'print_sub_graph_dir'
'reader_queue_speed_test_mode'
,
'print_sub_graph_dir'
,
'pe_profile_fname'
]
]
if
'Darwin'
not
in
sysstr
:
if
'Darwin'
not
in
sysstr
:
read_env_flags
.
append
(
'use_pinned_memory'
)
read_env_flags
.
append
(
'use_pinned_memory'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录