Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9ebd5b09
提交
9ebd5b09
authored
5月 05, 2017
作者:
Alexander Matyasko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix gpu cholesky inplace optimization
上级
f0a8c9ba
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
7 行删除
+8
-7
magma_eigh.c
theano/gpuarray/magma_eigh.c
+1
-1
test_linalg.py
theano/gpuarray/tests/test_linalg.py
+7
-6
没有找到文件。
theano/gpuarray/magma_eigh.c
浏览文件 @
9ebd5b09
...
@@ -41,7 +41,7 @@ int APPLY_SPECIFIC(magma_eigh)(PyGpuArrayObject *A_,
...
@@ -41,7 +41,7 @@ int APPLY_SPECIFIC(magma_eigh)(PyGpuArrayObject *A_,
A
=
pygpu_copy
(
A_
,
GA_F_ORDER
);
A
=
pygpu_copy
(
A_
,
GA_F_ORDER
);
if
(
A
==
NULL
)
{
if
(
A
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
PyErr_SetString
(
PyExc_RuntimeError
,
"GpuMagma
QR
: failed to change to column-major order"
);
"GpuMagma
Eigh
: failed to change to column-major order"
);
return
-
1
;
return
-
1
;
}
}
...
...
theano/gpuarray/tests/test_linalg.py
浏览文件 @
9ebd5b09
...
@@ -312,15 +312,18 @@ class TestMagma(unittest.TestCase):
...
@@ -312,15 +312,18 @@ class TestMagma(unittest.TestCase):
mode
=
mode_with_gpu
.
excluding
(
'cusolver'
))
mode
=
mode_with_gpu
.
excluding
(
'cusolver'
))
return
f
(
A_val
)
return
f
(
A_val
)
def
check_cholesky
(
self
,
N
,
lower
=
True
,
rtol
=
None
,
atol
=
None
):
def
rand_symmetric
(
self
,
N
):
A
=
rand
(
N
,
N
)
.
astype
(
'float32'
)
A
=
rand
(
N
,
N
)
.
astype
(
'float32'
)
# ensure that eigenvalues are not too small which sometimes results in
# ensure that eigenvalues are not too small which sometimes results in
# magma failure due to gpu limited numerical precision
# magma
cholesky
failure due to gpu limited numerical precision
D
,
W
=
np
.
linalg
.
eigh
(
A
)
D
,
W
=
np
.
linalg
.
eigh
(
A
)
D
[
D
<
1
]
=
1
D
[
D
<
1
]
=
1
V_m
=
np
.
zeros_like
(
A
)
V_m
=
np
.
zeros_like
(
A
)
np
.
fill_diagonal
(
V_m
,
D
)
np
.
fill_diagonal
(
V_m
,
D
)
A
=
np
.
dot
(
np
.
dot
(
W
.
T
,
V_m
),
W
)
return
np
.
dot
(
np
.
dot
(
W
.
T
,
V_m
),
W
)
def
check_cholesky
(
self
,
N
,
lower
=
True
,
rtol
=
None
,
atol
=
None
):
A
=
self
.
rand_symmetric
(
N
)
L
=
self
.
run_gpu_cholesky
(
A
,
lower
=
lower
)
L
=
self
.
run_gpu_cholesky
(
A
,
lower
=
lower
)
if
not
lower
:
if
not
lower
:
L
=
L
.
T
L
=
L
.
T
...
@@ -337,9 +340,7 @@ class TestMagma(unittest.TestCase):
...
@@ -337,9 +340,7 @@ class TestMagma(unittest.TestCase):
for
node
in
fn
.
maker
.
fgraph
.
toposort
()])
for
node
in
fn
.
maker
.
fgraph
.
toposort
()])
def
test_gpu_cholesky_inplace
(
self
):
def
test_gpu_cholesky_inplace
(
self
):
N
=
1000
A
=
self
.
rand_symmetric
(
1000
)
A
=
rand
(
N
,
N
)
.
astype
(
'float32'
)
A
=
np
.
dot
(
A
.
T
,
A
)
A_gpu
=
gpuarray_shared_constructor
(
A
)
A_gpu
=
gpuarray_shared_constructor
(
A
)
A_copy
=
A_gpu
.
get_value
()
A_copy
=
A_gpu
.
get_value
()
fn
=
theano
.
function
([],
GpuMagmaCholesky
(
inplace
=
True
)(
A_gpu
),
fn
=
theano
.
function
([],
GpuMagmaCholesky
(
inplace
=
True
)(
A_gpu
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论