Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d9ed1e2c
提交
d9ed1e2c
authored
7月 19, 2024
作者:
Virgile Andreani
提交者:
Virgile Andreani
7月 23, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix typo amblibm -> amdlibm
上级
7a0175af
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
config.rst
doc/library/config.rst
+1
-1
profiling.py
pytensor/compile/profiling.py
+4
-4
configdefaults.py
pytensor/configdefaults.py
+1
-1
configparser.py
pytensor/configparser.py
+1
-1
basic.py
pytensor/scalar/basic.py
+6
-6
没有找到文件。
doc/library/config.rst
浏览文件 @
d9ed1e2c
...
...
@@ -355,7 +355,7 @@ import ``pytensor`` and print the config variable, as in:
When ``True``, ignore the first call to an PyTensor function while profiling.
.. attribute:: config.lib__am
b
libm
.. attribute:: config.lib__am
d
libm
Bool value: either ``True`` or ``False``
...
...
pytensor/compile/profiling.py
浏览文件 @
d9ed1e2c
...
...
@@ -1566,26 +1566,26 @@ class ProfileStats:
printed_tip
=
True
# tip 2
if
not
config
.
lib__am
b
libm
and
any
(
if
not
config
.
lib__am
d
libm
and
any
(
amdlibm_speed_up
(
a
.
op
)
for
(
fgraph
,
a
)
in
self
.
apply_time
):
print
(
" - Try installing amdlibm and set the PyTensor flag "
"lib__am
b
libm=True. This speeds up only some Elemwise "
"lib__am
d
libm=True. This speeds up only some Elemwise "
"operation."
,
file
=
file
,
)
printed_tip
=
True
# tip 3
if
not
config
.
lib__am
b
libm
and
any
(
if
not
config
.
lib__am
d
libm
and
any
(
exp_float32_op
(
a
.
op
)
and
a
.
inputs
[
0
]
.
dtype
==
"float32"
for
(
fgraph
,
a
)
in
self
.
apply_time
):
print
(
" - With the default gcc libm, exp in float32 is slower "
"than in float64! Try PyTensor flag floatX=float64, or "
"install amdlibm and set the pytensor flags lib__am
b
libm=True"
,
"install amdlibm and set the pytensor flags lib__am
d
libm=True"
,
file
=
file
,
)
printed_tip
=
True
...
...
pytensor/configdefaults.py
浏览文件 @
d9ed1e2c
...
...
@@ -547,7 +547,7 @@ def add_tensor_configvars():
# http://developer.amd.com/CPU/LIBRARIES/LIBM/Pages/default.aspx
config
.
add
(
"lib__am
b
libm"
,
"lib__am
d
libm"
,
"Use amd's amdlibm numerical library"
,
BoolParam
(
False
),
# Added elsewhere in the c key only when needed.
...
...
pytensor/configparser.py
浏览文件 @
d9ed1e2c
...
...
@@ -95,7 +95,7 @@ class PyTensorConfigParser:
compile__timeout
:
int
# add_tensor_configvars
tensor__cmp_sloppy
:
int
lib__am
b
libm
:
bool
lib__am
d
libm
:
bool
tensor__insert_inplace_optimizer_validate_nb
:
int
# add_traceback_configvars
traceback__limit
:
int
...
...
pytensor/scalar/basic.py
浏览文件 @
d9ed1e2c
...
...
@@ -356,18 +356,18 @@ class ScalarType(CType, HasDataType, HasShape):
# we declare them here and they will be re-used by TensorType
l
.
append
(
"<numpy/arrayobject.h>"
)
l
.
append
(
"<numpy/arrayscalars.h>"
)
if
config
.
lib__am
b
libm
and
c_compiler
.
supports_amdlibm
:
if
config
.
lib__am
d
libm
and
c_compiler
.
supports_amdlibm
:
l
+=
[
"<amdlibm.h>"
]
return
l
def
c_libraries
(
self
,
c_compiler
=
None
,
**
kwargs
):
l
=
[]
if
config
.
lib__am
b
libm
and
c_compiler
and
c_compiler
.
supports_amdlibm
:
if
config
.
lib__am
d
libm
and
c_compiler
and
c_compiler
.
supports_amdlibm
:
l
+=
[
"amdlibm"
]
return
l
def
c_compile_args
(
self
,
c_compiler
=
None
,
**
kwargs
):
if
config
.
lib__am
b
libm
and
c_compiler
and
c_compiler
.
supports_amdlibm
:
if
config
.
lib__am
d
libm
and
c_compiler
and
c_compiler
.
supports_amdlibm
:
return
[
"-DREPLACE_WITH_AMDLIBM"
]
else
:
return
[]
...
...
@@ -1245,7 +1245,7 @@ class UnaryScalarOp(ScalarOp):
def
c_code_contiguous
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
(
x
,)
=
inputs
(
z
,)
=
outputs
if
not
config
.
lib__am
b
libm
or
node
.
inputs
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
:
if
not
config
.
lib__am
d
libm
or
node
.
inputs
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
:
raise
MethodNotDefined
()
dtype
=
node
.
inputs
[
0
]
.
type
.
dtype_specs
()[
1
]
...
...
@@ -1260,7 +1260,7 @@ class UnaryScalarOp(ScalarOp):
"""
def
c_code_contiguous_raw
(
self
,
dtype
,
n
,
i
,
o
):
if
not
config
.
lib__am
b
libm
:
if
not
config
.
lib__am
d
libm
:
raise
MethodNotDefined
()
if
dtype
.
startswith
(
"npy_"
):
dtype
=
dtype
[
4
:]
...
...
@@ -2296,7 +2296,7 @@ class Pow(BinaryScalarOp):
def
c_code_contiguous
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
(
x
,
y
)
=
inputs
(
z
,)
=
outputs
if
not
config
.
lib__am
b
libm
:
if
not
config
.
lib__am
d
libm
:
raise
MethodNotDefined
()
# We compare the dtype AND the broadcast flag
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论