Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1901d980
提交
1901d980
authored
10月 23, 2017
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure MKL uses GNU OpenMP.
上级
b6e37683
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
41 行增加
和
1 行删除
+41
-1
configdefaults.py
theano/configdefaults.py
+41
-1
没有找到文件。
theano/configdefaults.py
浏览文件 @
1901d980
...
...
@@ -1238,6 +1238,29 @@ AddConfigVar('cmodule.debug',
in_c_key
=
True
)
def
check_mkl_openmp
():
if
not
theano
.
config
.
blas
.
check_openmp
:
return
import
os
if
(
'MKL_THREADING_LAYER'
in
os
.
environ
and
os
.
environ
[
'MKL_THREADING_LAYER'
]
==
'GNU'
):
return
try
:
import
mkl
if
'2018'
in
mkl
.
get_version_string
():
raise
RuntimeError
(
'To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.'
)
except
ImportError
:
raise
RuntimeError
(
"""
Could not import 'mkl'. Either install mkl-service with conda or set
MKL_THREADING_LAYER=GNU in your environment for MKL 2018.
If you have MKL 2017 install and are not in a conda environment you
can set the Theano flag blas.check_openmp to False. Be warned that if
you set this flag and don't set the appropriate environment or make
sure you have the right version you *will* get wrong results.
"""
)
def
default_blas_ldflags
():
global
numpy
warn_record
=
[]
...
...
@@ -1366,16 +1389,22 @@ def default_blas_ldflags():
flags
=
[]
if
lib_path
:
flags
=
[
'-L
%
s'
%
lib_path
[
0
]]
if
'2018'
in
mkl
.
get_version_string
():
thr
=
'mkl_gnu_thread'
else
:
thr
=
'mkl_intel_thread'
flags
+=
[
'-l
%
s'
%
l
for
l
in
[
"mkl_core"
,
"mkl_intel_thread"
,
thr
,
"mkl_rt"
]]
res
=
try_blas_flag
(
flags
)
if
res
:
check_mkl_openmp
()
return
res
flags
.
extend
([
'-Wl,-rpath,'
+
l
for
l
in
blas_info
.
get
(
'library_dirs'
,
[])])
res
=
try_blas_flag
(
flags
)
if
res
:
check_mkl_openmp
()
maybe_add_to_os_environ_pathlist
(
'PATH'
,
lib_path
[
0
])
return
res
...
...
@@ -1396,6 +1425,8 @@ def default_blas_ldflags():
ret
.
extend
([
'-lm'
,
'-lm'
])
res
=
try_blas_flag
(
ret
)
if
res
:
if
'mkl'
in
res
:
check_mkl_openmp
()
return
res
# If we are using conda and can't reuse numpy blas, then doing
...
...
@@ -1411,6 +1442,8 @@ def default_blas_ldflags():
blas_info
.
get
(
'library_dirs'
,
[])])
res
=
try_blas_flag
(
ret
)
if
res
:
if
'mkl'
in
res
:
check_mkl_openmp
()
return
res
# Add sys.prefix/lib to the runtime search path. On
...
...
@@ -1421,6 +1454,8 @@ def default_blas_ldflags():
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
res
=
try_blas_flag
(
ret
)
if
res
:
if
'mkl'
in
res
:
check_mkl_openmp
()
return
res
except
KeyError
:
...
...
@@ -1473,6 +1508,11 @@ AddConfigVar('blas.ldflags',
# Added elsewhere in the c key only when needed.
in_c_key
=
False
)
AddConfigVar
(
'blas.check_openmp'
,
"Check for openmp library conflict.
\n
WARNING: Setting this to False leaves you open to wrong results in blas-related operations."
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'metaopt.verbose'
,
"0 for silent, 1 for only warnings, 2 for full output with"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论