Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
929d22c6
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看板
提交
929d22c6
编写于
1月 10, 2018
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto set openblas env
上级
cedd9805
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
31 addition
and
14 deletion
+31
-14
paddle/scripts/submit_local.sh.in
paddle/scripts/submit_local.sh.in
+3
-0
python/paddle/v2/__init__.py
python/paddle/v2/__init__.py
+22
-13
python/setup.py.in
python/setup.py.in
+6
-1
未找到文件。
paddle/scripts/submit_local.sh.in
浏览文件 @
929d22c6
...
@@ -92,6 +92,9 @@ function threads_config() {
...
@@ -92,6 +92,9 @@ function threads_config() {
if
[
-z
"
$OPENBLAS_NUM_THREADS
"
]
;
then
if
[
-z
"
$OPENBLAS_NUM_THREADS
"
]
;
then
export
OPENBLAS_NUM_THREADS
=
$threads
export
OPENBLAS_NUM_THREADS
=
$threads
fi
fi
if
[
$threads
-gt
1
]
&&
[
-z
"
$OPENBLAS_MAIN_FREE
"
]
;
then
export
OPENBLAS_MAIN_FREE
=
1
fi
fi
fi
}
}
...
...
python/paddle/v2/__init__.py
浏览文件 @
929d22c6
...
@@ -62,12 +62,15 @@ __all__ = [
...
@@ -62,12 +62,15 @@ __all__ = [
cp
.
begin_parse
()
cp
.
begin_parse
()
def
set_
omp_mkl_
env_vars
(
trainer_count
):
def
set_env_vars
(
trainer_count
):
'''Auto set CPU environment if have not set before.
'''Auto set CPU environment if have not set before.
For MKL:
export KMP_AFFINITY, OMP_DYNAMIC according to the Hyper Threading status.
export KMP_AFFINITY, OMP_DYNAMIC according to the Hyper Threading status.
export OMP_NUM_THREADS, MKL_NUM_THREADS according to trainer_count.
export OMP_NUM_THREADS, MKL_NUM_THREADS according to trainer_count.
For OpenBLAS:
export OPENBLAS_NUM_THREADS, OPENBLAS_MAIN_FREE according to trainer_count.
'''
'''
import
platform
import
platform
,
paddle
if
not
platform
.
system
()
in
[
'Linux'
,
'Darwin'
]:
if
not
platform
.
system
()
in
[
'Linux'
,
'Darwin'
]:
return
return
...
@@ -103,6 +106,7 @@ def set_omp_mkl_env_vars(trainer_count):
...
@@ -103,6 +106,7 @@ def set_omp_mkl_env_vars(trainer_count):
num_cores
=
num_physical_cores
()
num_cores
=
num_physical_cores
()
num_processors
=
num_logical_processors
()
num_processors
=
num_logical_processors
()
if
paddle
.
version
.
mkl
()
==
'ON'
:
if
num_processors
>
num_cores
:
# Hyper Threading is enabled
if
num_processors
>
num_cores
:
# Hyper Threading is enabled
set_env
(
"OMP_DYNAMIC"
,
"true"
)
set_env
(
"OMP_DYNAMIC"
,
"true"
)
set_env
(
"KMP_AFFINITY"
,
"granularity=fine,compact,1,0"
)
set_env
(
"KMP_AFFINITY"
,
"granularity=fine,compact,1,0"
)
...
@@ -111,8 +115,13 @@ def set_omp_mkl_env_vars(trainer_count):
...
@@ -111,8 +115,13 @@ def set_omp_mkl_env_vars(trainer_count):
set_env
(
"KMP_AFFINITY"
,
"granularity=fine,compact,0,0"
)
set_env
(
"KMP_AFFINITY"
,
"granularity=fine,compact,0,0"
)
threads
=
num_processors
/
trainer_count
threads
=
num_processors
/
trainer_count
threads
=
'1'
if
threads
<
1
else
str
(
threads
)
threads
=
'1'
if
threads
<
1
else
str
(
threads
)
if
paddle
.
version
.
mkl
()
==
'ON'
:
set_env
(
"OMP_NUM_THREADS"
,
threads
)
set_env
(
"OMP_NUM_THREADS"
,
threads
)
set_env
(
"MKL_NUM_THREADS"
,
threads
)
set_env
(
"MKL_NUM_THREADS"
,
threads
)
else
:
set_env
(
"OPENBLAS_NUM_THREADS"
,
threads
)
if
threads
>
1
:
set_env
(
"OPENBLAS_MAIN_FREE"
,
'1'
)
def
init
(
**
kwargs
):
def
init
(
**
kwargs
):
...
@@ -129,7 +138,7 @@ def init(**kwargs):
...
@@ -129,7 +138,7 @@ def init(**kwargs):
for
key
in
args_dict
.
keys
():
for
key
in
args_dict
.
keys
():
args
.
append
(
'--%s=%s'
%
(
key
,
str
(
args_dict
[
key
])))
args
.
append
(
'--%s=%s'
%
(
key
,
str
(
args_dict
[
key
])))
set_
omp_mkl_
env_vars
(
kwargs
.
get
(
'trainer_count'
,
1
))
set_env_vars
(
kwargs
.
get
(
'trainer_count'
,
1
))
if
'use_gpu'
in
kwargs
:
if
'use_gpu'
in
kwargs
:
cp
.
g_command_config_args
[
'use_gpu'
]
=
kwargs
[
'use_gpu'
]
cp
.
g_command_config_args
[
'use_gpu'
]
=
kwargs
[
'use_gpu'
]
...
...
python/setup.py.in
浏览文件 @
929d22c6
...
@@ -31,6 +31,7 @@ patch = '%(patch)d'
...
@@ -31,6 +31,7 @@ patch = '%(patch)d'
rc = '%(rc)d'
rc = '%(rc)d'
istaged = %(istaged)s
istaged = %(istaged)s
commit = '%(commit)s'
commit = '%(commit)s'
with_mkl = '%(with_mkl)s'
def show():
def show():
if istaged:
if istaged:
...
@@ -41,6 +42,9 @@ def show():
...
@@ -41,6 +42,9 @@ def show():
print 'rc:', rc
print 'rc:', rc
else:
else:
print 'commit:', commit
print 'commit:', commit
def mkl():
return with_mkl
'''
'''
commit = git_commit()
commit = git_commit()
with open(filename, 'w') as f:
with open(filename, 'w') as f:
...
@@ -51,7 +55,8 @@ def show():
...
@@ -51,7 +55,8 @@ def show():
'rc': RC,
'rc': RC,
'version': '${PADDLE_VERSION}',
'version': '${PADDLE_VERSION}',
'commit': commit,
'commit': commit,
'istaged': ISTAGED})
'istaged': ISTAGED,
'with_mkl': '@WITH_MKL@'})
write_version_py(filename='@PADDLE_SOURCE_DIR@/python/paddle/version.py')
write_version_py(filename='@PADDLE_SOURCE_DIR@/python/paddle/version.py')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录