Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
cbe64cc1
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
cbe64cc1
编写于
9月 14, 2022
作者:
J
JingZhuangzhuang
提交者:
GitHub
9月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support inference compilation in training package (#46008)
* merge python lib * Update third_party.cmake * Update CMakeLists.txt
上级
9718791c
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
6 addition
and
46 deletion
+6
-46
CMakeLists.txt
CMakeLists.txt
+1
-1
cmake/third_party.cmake
cmake/third_party.cmake
+1
-1
paddle/fluid/framework/new_executor/new_executor_defs.cc
paddle/fluid/framework/new_executor/new_executor_defs.cc
+0
-9
paddle/fluid/framework/new_executor/new_executor_defs.h
paddle/fluid/framework/new_executor/new_executor_defs.h
+0
-9
paddle/fluid/framework/scope.cc
paddle/fluid/framework/scope.cc
+0
-11
paddle/fluid/framework/scope.h
paddle/fluid/framework/scope.h
+0
-3
paddle/fluid/platform/flags.cc
paddle/fluid/platform/flags.cc
+0
-8
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+1
-1
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+1
-1
python/paddle/fluid/tests/unittests/CMakeLists.txt
python/paddle/fluid/tests/unittests/CMakeLists.txt
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/CMakeLists.txt
...le/fluid/tests/unittests/dygraph_to_static/CMakeLists.txt
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
cbe64cc1
...
...
@@ -249,7 +249,7 @@ option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
option
(
WITH_DISTRIBUTE
"Compile with distributed support"
OFF
)
option
(
WITH_BRPC_RDMA
"Use brpc rdma as the rpc protocal"
OFF
)
option
(
ON_INFER
"Turn on inference optimization and inference-lib generation"
O
FF
)
O
N
)
################################ Internal Configurations #######################################
option
(
WITH_NV_JETSON
"Compile PaddlePaddle with NV JETSON"
OFF
)
option
(
WITH_PROFILER
"Compile PaddlePaddle with GPU profiler and gperftools"
...
...
cmake/third_party.cmake
浏览文件 @
cbe64cc1
...
...
@@ -236,7 +236,7 @@ endif()
if
(
WIN32
OR APPLE
OR NOT WITH_GPU
OR
ON_INFER
)
OR
(
ON_INFER AND NOT WITH_PYTHON
)
)
set
(
WITH_DGC OFF
)
endif
()
...
...
paddle/fluid/framework/new_executor/new_executor_defs.cc
浏览文件 @
cbe64cc1
...
...
@@ -21,17 +21,8 @@
#include "paddle/phi/core/utils/rw_lock.h"
// When in inference scenario, the scopes will not be written by two threads in
// a mean time, but a scope may be read by multiple threads concurrently, and
// the mutex will cause serious performance issue.
// So the mutex is disabled when `ON_INFER`.
#ifdef PADDLE_ON_INFERENCE
#define SCOPE_VARS_READER_LOCK
#define SCOPE_VARS_WRITER_LOCK
#else
#define SCOPE_VARS_READER_LOCK AutoRDLock auto_lock(&vars_lock_);
#define SCOPE_VARS_WRITER_LOCK AutoWRLock auto_lock(&vars_lock_);
#endif
namespace
paddle
{
namespace
framework
{
...
...
paddle/fluid/framework/new_executor/new_executor_defs.h
浏览文件 @
cbe64cc1
...
...
@@ -24,17 +24,8 @@
#include "paddle/fluid/platform/event.h"
#include "paddle/phi/core/utils/rw_lock.h"
// When in inference scenario, the scopes will not be written by two threads in
// a mean time, but a scope may be read by multiple threads concurrently, and
// the mutex will cause serious performance issue.
// So the mutex is disabled when `ON_INFER`.
#ifdef PADDLE_ON_INFERENCE
#define SCOPE_VARS_READER_LOCK
#define SCOPE_VARS_WRITER_LOCK
#else
#define SCOPE_VARS_READER_LOCK AutoRDLock auto_lock(&vars_lock_);
#define SCOPE_VARS_WRITER_LOCK AutoWRLock auto_lock(&vars_lock_);
#endif
namespace
paddle
{
namespace
framework
{
...
...
paddle/fluid/framework/scope.cc
浏览文件 @
cbe64cc1
...
...
@@ -25,21 +25,10 @@ PADDLE_DEFINE_EXPORTED_bool(
"Delete local scope eagerly. It will reduce GPU memory usage but "
"slow down the destruction of variables.(around 1% performance harm)"
);
// When in inference scenario, the scopes will not be written by two threads in
// a mean time, but a scope may be read by multiple threads concurrently, and
// the mutex will cause serious performance issue.
// So the mutex is disabled when `ON_INFER`.
#ifdef PADDLE_ON_INFERENCE
#define SCOPE_KIDS_READER_LOCK
#define SCOPE_KIDS_WRITER_LOCK
#define SCOPE_VARS_READER_LOCK
#define SCOPE_VARS_WRITER_LOCK
#else
#define SCOPE_KIDS_READER_LOCK phi::AutoRDLock auto_lock(&kids_lock_);
#define SCOPE_KIDS_WRITER_LOCK phi::AutoWRLock auto_lock(&kids_lock_);
#define SCOPE_VARS_READER_LOCK phi::AutoRDLock auto_lock(&vars_lock_);
#define SCOPE_VARS_WRITER_LOCK phi::AutoWRLock auto_lock(&vars_lock_);
#endif
namespace
paddle
{
namespace
framework
{
...
...
paddle/fluid/framework/scope.h
浏览文件 @
cbe64cc1
...
...
@@ -179,12 +179,9 @@ class Scope : public ScopeBase {
DISABLE_COPY_AND_ASSIGN
(
Scope
);
#ifndef PADDLE_ON_INFERENCE
private:
mutable
phi
::
RWLock
kids_lock_
;
mutable
phi
::
RWLock
vars_lock_
;
#endif
};
// Generate some debug string about the inherience structure of scope, quite
...
...
paddle/fluid/platform/flags.cc
浏览文件 @
cbe64cc1
...
...
@@ -388,11 +388,7 @@ PADDLE_DEFINE_EXPORTED_int32(
* enable garbage collection strategy when training large networks.
*/
// Disable gc by default when inference library is built
#ifdef PADDLE_ON_INFERENCE
static
const
double
kDefaultEagerDeleteTensorGB
=
-
1
;
#else
static
const
double
kDefaultEagerDeleteTensorGB
=
0
;
#endif
PADDLE_DEFINE_EXPORTED_double
(
eager_delete_tensor_gb
,
...
...
@@ -663,11 +659,7 @@ PADDLE_DEFINE_EXPORTED_bool(use_mkldnn, false, "Use MKLDNN to run");
* If FLAGS_call_stack_level == 2, the python stack, c++ stack, and error
* message summary will be shown.
*/
#ifdef PADDLE_ON_INFERENCE
static
const
int32_t
kDefaultCallStackLevel
=
2
;
#else
static
const
int32_t
kDefaultCallStackLevel
=
1
;
#endif
PADDLE_DEFINE_EXPORTED_int32
(
call_stack_level
,
...
...
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
cbe64cc1
...
...
@@ -140,7 +140,7 @@ if(WITH_CUSTOM_DEVICE)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
custom_device_common_op_registry
)
endif
()
if
(
NOT ON_INFER
)
if
(
WITH_PYTHON
)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
processgroup eager_reducer
)
if
(
WITH_NCCL OR WITH_RCCL
)
set
(
PYBIND_DEPS
${
PYBIND_DEPS
}
processgroup_nccl
)
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
cbe64cc1
...
...
@@ -2547,7 +2547,7 @@ All parameter, weight, gradient are variables in Paddle.
BindCompatible
(
&
m
);
BindDataset
(
&
m
);
BindGenerator
(
&
m
);
#ifndef PADDLE_
ON_INFERENCE
#ifndef PADDLE_
NO_PYTHON
BindDistributed
(
&
m
);
#endif
#ifdef PADDLE_WITH_ASCEND
...
...
python/paddle/fluid/tests/unittests/CMakeLists.txt
浏览文件 @
cbe64cc1
...
...
@@ -799,7 +799,7 @@ py_test_modules(
# it is found that windows CI will run all the training unittests with the ON_INFER option turned on,
# which will not appear in other CIs. The calculation behavior of some ops in inference mode is
# inconsistent with that in non-inference mode.
if
(
NOT ON_INFER
)
if
(
WITH_PYTHON
)
py_test_modules
(
test_parallel_executor_seresnext_base_cpu MODULES
test_parallel_executor_seresnext_base_cpu
)
py_test_modules
(
test_parallel_executor_seresnext_with_reduce_cpu MODULES
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/CMakeLists.txt
浏览文件 @
cbe64cc1
...
...
@@ -34,7 +34,7 @@ set(TEST_EAGER_OPS
list
(
REMOVE_ITEM TEST_OPS test_lac
)
# NOTE(Aurelius84): In case of Windows CI, if open ON_INFER, RWLOCK of Scope
# will be removed and will cause some random failed in multi-thread.
if
(
NOT ON_INFER
)
if
(
WITH_PYTHON
)
py_test_modules
(
test_lac MODULES test_lac ENVS FLAGS_enable_eager_mode=1
)
set_tests_properties
(
test_lac PROPERTIES TIMEOUT 120
)
endif
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录