Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4f2bb0a9
提交
4f2bb0a9
authored
1月 19, 2013
作者:
abalkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue #1164: Fixed failing test_pycuda_example.
Removed unnecessary #includes from generated cuda code.
上级
eab4cada
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
8 行删除
+7
-8
pycuda_example.py
theano/misc/pycuda_example.py
+7
-8
没有找到文件。
theano/misc/pycuda_example.py
浏览文件 @
4f2bb0a9
...
...
@@ -40,8 +40,7 @@ from pycuda.compiler import SourceModule
from
pycuda.tools
import
VectorArg
import
pycuda.gpuarray
def
theano_parse_c_arg
(
c_arg
):
def
_replace_npy_types
(
c_arg
):
c_arg
=
c_arg
.
replace
(
'npy_float32'
,
'float'
)
c_arg
=
c_arg
.
replace
(
'npy_float64'
,
'double'
)
c_arg
=
c_arg
.
replace
(
'npy_int32'
,
'int'
)
...
...
@@ -50,6 +49,10 @@ def theano_parse_c_arg(c_arg):
c_arg
=
c_arg
.
replace
(
'npy_uint32'
,
'unsigned int'
)
c_arg
=
c_arg
.
replace
(
'npy_uint16'
,
'unsigned short'
)
c_arg
=
c_arg
.
replace
(
'npy_uint8'
,
'unsigned char'
)
return
c_arg
def
theano_parse_c_arg
(
c_arg
):
c_arg
=
_replace_npy_types
(
c_arg
)
return
pycuda
.
tools
.
parse_c_arg
(
c_arg
)
"""
...
...
@@ -227,14 +230,12 @@ class PycudaElemwiseSourceModuleOp(GpuOp):
c_code
=
self
.
scalar_op
.
c_code
(
out_node
,
"some_name"
,
tuple
([
n
+
"[i]"
for
n
in
in_name
]),
tuple
(
n
+
"[i]"
for
n
in
out_name
),
{})
c_code_param
=
", "
.
join
([
var
.
type
.
dtype_specs
()[
1
]
+
" *"
+
name
c_code_param
=
", "
.
join
([
_replace_npy_types
(
var
.
type
.
dtype_specs
()[
1
])
+
" *"
+
name
for
var
,
name
in
(
zip
(
inputs
,
in_name
)
+
zip
(
out_node
.
outputs
,
out_name
))]
+
[
"int size"
])
mod
=
SourceModule
(
"""
#include<Python.h>
#include <numpy/arrayobject.h>
__global__ void
%
s(
%
s)
{
int i = (blockIdx.x+blockIdx.y*gridDim.x)*(blockDim.x*blockDim.y);
...
...
@@ -319,13 +320,11 @@ class PycudaElemwiseSourceModuleMakeThunkOp(Op):
c_code
=
self
.
scalar_op
.
c_code
(
node
,
"some_name"
,
tuple
([
n
+
"[i]"
for
n
in
in_name
]),
tuple
(
n
+
"[i]"
for
n
in
out_name
),
{})
c_code_param
=
", "
.
join
([
var
.
type
.
dtype_specs
()[
1
]
+
" *"
+
name
c_code_param
=
", "
.
join
([
_replace_npy_types
(
var
.
type
.
dtype_specs
()[
1
])
+
" *"
+
name
for
var
,
name
in
zip
(
node
.
inputs
,
in_name
)
+
zip
(
node
.
outputs
,
out_name
)]
+
[
"int size"
])
mod
=
SourceModule
(
"""
#include<Python.h>
#include <numpy/arrayobject.h>
__global__ void
%
s(
%
s)
{
int i = (blockIdx.x+blockIdx.y*gridDim.x)*(blockDim.x*blockDim.y);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论