Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
e8f5757d
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看板
未验证
提交
e8f5757d
编写于
6月 19, 2018
作者:
T
tensor-tang
提交者:
GitHub
6月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11525 from tensor-tang/refine/mem
refine the initial cpu memory flag for mkldnn
上级
69827f30
9a25f289
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
12 deletion
+19
-12
paddle/fluid/platform/cpu_info.cc
paddle/fluid/platform/cpu_info.cc
+15
-9
paddle/testing/paddle_gtest_main.cc
paddle/testing/paddle_gtest_main.cc
+3
-2
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+1
-1
未找到文件。
paddle/fluid/platform/cpu_info.cc
浏览文件 @
e8f5757d
...
@@ -28,9 +28,15 @@ DEFINE_double(fraction_of_cpu_memory_to_use, 1,
...
@@ -28,9 +28,15 @@ DEFINE_double(fraction_of_cpu_memory_to_use, 1,
"Default use 100% of CPU memory for PaddlePaddle,"
"Default use 100% of CPU memory for PaddlePaddle,"
"reserve the rest for page tables, etc"
);
"reserve the rest for page tables, etc"
);
DEFINE_uint64
(
DEFINE_uint64
(
initial_cpu_memory_in_mb
,
initial_cpu_memory_in_mb
,
500
,
#ifdef PADDLE_WITH_MKLDNN
"Default initial 500MB of CPU memory for PaddlePaddle, in MD unit."
);
/* Aligned with mozga-intel, MKLDNN need at least 5000 MB
* to obtain the best performance*/
5000
,
#else
500
,
#endif
"Initial CPU memory for PaddlePaddle, in MD unit."
);
DEFINE_double
(
DEFINE_double
(
fraction_of_cuda_pinned_memory_to_use
,
0.5
,
fraction_of_cuda_pinned_memory_to_use
,
0.5
,
...
@@ -59,10 +65,7 @@ inline size_t CpuTotalPhysicalMemory() {
...
@@ -59,10 +65,7 @@ inline size_t CpuTotalPhysicalMemory() {
size_t
CpuMaxAllocSize
()
{
size_t
CpuMaxAllocSize
()
{
// For distributed systems, it requires configuring and limiting
// For distributed systems, it requires configuring and limiting
// the fraction of memory to use.
// the fraction of memory to use.
return
std
::
min
(
return
FLAGS_fraction_of_cpu_memory_to_use
*
CpuTotalPhysicalMemory
();
static_cast
<
size_t
>
(
FLAGS_fraction_of_cpu_memory_to_use
*
CpuTotalPhysicalMemory
()),
static_cast
<
size_t
>
(
FLAGS_initial_cpu_memory_in_mb
*
1
<<
20
));
}
}
size_t
CpuMinChunkSize
()
{
size_t
CpuMinChunkSize
()
{
...
@@ -71,8 +74,11 @@ size_t CpuMinChunkSize() {
...
@@ -71,8 +74,11 @@ size_t CpuMinChunkSize() {
}
}
size_t
CpuMaxChunkSize
()
{
size_t
CpuMaxChunkSize
()
{
// Allow to allocate the maximum chunk size is roughly 3% of CPU memory.
// Allow to allocate the maximum chunk size is roughly 3% of CPU memory,
return
CpuMaxAllocSize
()
/
32
;
// or the initial_cpu_memory_in_mb.
return
std
::
min
(
static_cast
<
size_t
>
(
CpuMaxAllocSize
()
/
32
),
static_cast
<
size_t
>
(
FLAGS_initial_cpu_memory_in_mb
*
1
<<
20
));
}
}
size_t
CUDAPinnedMaxAllocSize
()
{
size_t
CUDAPinnedMaxAllocSize
()
{
...
...
paddle/testing/paddle_gtest_main.cc
浏览文件 @
e8f5757d
...
@@ -30,8 +30,9 @@ int main(int argc, char** argv) {
...
@@ -30,8 +30,9 @@ int main(int argc, char** argv) {
new_argv
.
push_back
(
new_argv
.
push_back
(
strdup
(
"--tryfromenv=fraction_of_gpu_memory_to_use,use_pinned_memory"
));
strdup
(
"--tryfromenv=fraction_of_gpu_memory_to_use,use_pinned_memory"
));
#else
#else
new_argv
.
push_back
(
strdup
(
"--tryfromenv=use_pinned_memory,use_mkldnn"
));
new_argv
.
push_back
(
strdup
(
new_argv
.
push_back
(
strdup
(
"--undefok=use_mkldnn"
));
"--tryfromenv=use_pinned_memory,use_mkldnn,initial_cpu_memory_in_mb"
));
new_argv
.
push_back
(
strdup
(
"--undefok=use_mkldnn,initial_cpu_memory_in_mb"
));
#endif
#endif
int
new_argc
=
static_cast
<
int
>
(
new_argv
.
size
());
int
new_argc
=
static_cast
<
int
>
(
new_argv
.
size
());
char
**
new_argv_address
=
new_argv
.
data
();
char
**
new_argv_address
=
new_argv
.
data
();
...
...
python/paddle/fluid/__init__.py
浏览文件 @
e8f5757d
...
@@ -117,7 +117,7 @@ def __bootstrap__():
...
@@ -117,7 +117,7 @@ def __bootstrap__():
read_env_flags
=
[
read_env_flags
=
[
'use_pinned_memory'
,
'check_nan_inf'
,
'benchmark'
,
'warpctc_dir'
,
'use_pinned_memory'
,
'check_nan_inf'
,
'benchmark'
,
'warpctc_dir'
,
'eager_delete_scope'
,
'use_mkldnn'
'eager_delete_scope'
,
'use_mkldnn'
,
'initial_cpu_memory_in_mb'
]
]
if
core
.
is_compiled_with_cuda
():
if
core
.
is_compiled_with_cuda
():
read_env_flags
+=
[
read_env_flags
+=
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录