Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d5181aee
提交
d5181aee
authored
5月 06, 2014
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the last remaining problems with the existing clients and make the kernel…
Fix the last remaining problems with the existing clients and make the kernel code for MRG more OpenCL-friendly.
上级
ec5283b2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
7 行删除
+11
-7
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+1
-0
rng_mrg.py
theano/sandbox/rng_mrg.py
+10
-7
没有找到文件。
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
d5181aee
...
@@ -12,6 +12,7 @@ from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler
...
@@ -12,6 +12,7 @@ from theano.sandbox.cuda.nvcc_compiler import NVCC_compiler
try
:
try
:
import
pygpu
import
pygpu
from
pygpu
import
gpuarray
from
pygpu.tools
import
ScalarArg
,
ArrayArg
from
pygpu.tools
import
ScalarArg
,
ArrayArg
from
pygpu.elemwise
import
ElemwiseKernel
from
pygpu.elemwise
import
ElemwiseKernel
from
pygpu.reduction
import
ReductionKernel
from
pygpu.reduction
import
ReductionKernel
...
...
theano/sandbox/rng_mrg.py
浏览文件 @
d5181aee
...
@@ -772,9 +772,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -772,9 +772,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
return
op
(
rstate
,
cast
(
v_size
,
'int32'
))
return
op
(
rstate
,
cast
(
v_size
,
'int32'
))
def
c_headers
(
self
):
def
c_headers
(
self
):
return
super
(
GPUA_mrg_uniform
,
self
)
+
[
'numpy_compat.h'
]
return
super
(
GPUA_mrg_uniform
,
self
)
.
c_headers
()
+
[
'numpy_compat.h'
]
def
gpu_kernels
(
self
,
node
):
def
gpu_kernels
(
self
,
node
,
name
):
if
self
.
output_type
.
dtype
==
'float32'
:
if
self
.
output_type
.
dtype
==
'float32'
:
otype
=
'float'
otype
=
'float'
NORM
=
'4.6566126e-10f'
# numpy.float32(1.0/(2**31+65))
NORM
=
'4.6566126e-10f'
# numpy.float32(1.0/(2**31+65))
...
@@ -785,8 +785,8 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -785,8 +785,8 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
NORM
=
'4.656612873077392578125e-10'
NORM
=
'4.656612873077392578125e-10'
code
=
"""
code
=
"""
KERNEL void mrg_uniform(
KERNEL void mrg_uniform(
%(otype)
s *sample_data,
GLOBAL_MEM
%(otype)
s *sample_data,
ga_int *state_data,
GLOBAL_MEM
ga_int *state_data,
const ga_uint Nsamples,
const ga_uint Nsamples,
const ga_uint Nstreams_used)
const ga_uint Nstreams_used)
{
{
...
@@ -809,7 +809,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -809,7 +809,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
const ga_int MASK2 = 65535; //2^16 - 1
const ga_int MASK2 = 65535; //2^16 - 1
const ga_int MULT2 = 21069;
const ga_int MULT2 = 21069;
const
unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x
;
const
ga_uint idx = GID_0 * LDIM_0 + LID_0
;
ga_int y1, y2, x11, x12, x13, x21, x22, x23;
ga_int y1, y2, x11, x12, x13, x21, x22, x23;
if (idx < Nstreams_used)
if (idx < Nstreams_used)
...
@@ -821,7 +821,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -821,7 +821,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
x22 = state_data[idx*6+4];
x22 = state_data[idx*6+4];
x23 = state_data[idx*6+5];
x23 = state_data[idx*6+5];
for (int i = idx; i < Nsamples; i += Nstreams_used)
for (
ga_u
int i = idx; i < Nsamples; i += Nstreams_used)
{
{
y1 = ((x12 & MASK12) << i22) + (x12 >> i9) + ((x13 & MASK13) << i7) + (x13 >> i24);
y1 = ((x12 & MASK12) << i22) + (x12 >> i9) + ((x13 & MASK13) << i7) + (x13 >> i24);
y1 -= (y1 < 0 || y1 >= M1) ? M1 : 0;
y1 -= (y1 < 0 || y1 >= M1) ? M1 : 0;
...
@@ -864,6 +864,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -864,6 +864,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
"""
%
locals
()
"""
%
locals
()
# we shouldn't get to this line if it's about to fail
from
pygpu
import
gpuarray
return
[
Kernel
(
code
=
code
,
name
=
"mrg_uniform"
,
return
[
Kernel
(
code
=
code
,
name
=
"mrg_uniform"
,
params
=
[
gpuarray
.
GpuArray
,
gpuarray
.
GpuArray
,
params
=
[
gpuarray
.
GpuArray
,
gpuarray
.
GpuArray
,
'uint32'
,
'uint32'
],
'uint32'
,
'uint32'
],
...
@@ -877,7 +880,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -877,7 +880,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
ndim
=
self
.
output_type
.
ndim
ndim
=
self
.
output_type
.
ndim
o_type_num
=
numpy
.
asarray
(
0
,
dtype
=
self
.
output_type
.
dtype
)
.
dtype
.
num
o_type_num
=
numpy
.
asarray
(
0
,
dtype
=
self
.
output_type
.
dtype
)
.
dtype
.
num
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
kname
=
self
.
gpu_kernels
()[
0
]
.
objvar
kname
=
self
.
gpu_kernels
(
node
,
nodename
)[
0
]
.
objvar
if
self
.
output_type
.
dtype
==
'float32'
:
if
self
.
output_type
.
dtype
==
'float32'
:
otype
=
'float'
otype
=
'float'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论