Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c032ac66
提交
c032ac66
authored
9月 18, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Attempt at fixing convolution. It does not crash but gives wrong results.
上级
4f1c2697
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
11 行增加
和
10 行删除
+11
-10
conv.cu
theano/sandbox/gpuarray/conv.cu
+0
-0
conv.py
theano/sandbox/gpuarray/conv.py
+8
-6
conv_kernel.cu
theano/sandbox/gpuarray/conv_kernel.cu
+2
-2
opt.py
theano/sandbox/gpuarray/opt.py
+1
-2
没有找到文件。
theano/sandbox/gpuarray/conv.cu
浏览文件 @
c032ac66
差异被折叠。
点击展开。
theano/sandbox/gpuarray/conv.py
浏览文件 @
c032ac66
...
@@ -164,7 +164,7 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -164,7 +164,7 @@ class GpuConv(GpuKernelBase, gof.Op):
node_
=
copy
.
copy
(
node
)
node_
=
copy
.
copy
(
node
)
assert
node
.
op
is
node_
.
op
assert
node
.
op
is
node_
.
op
if
node_
.
op
.
max_threads_dim0
is
None
:
if
node_
.
op
.
max_threads_dim0
is
None
:
node_
.
op
.
max_threads_dim0
=
node
.
_
inputs
[
0
]
.
type
.
context
.
maxlsize
node_
.
op
.
max_threads_dim0
=
node
_
.
inputs
[
0
]
.
type
.
context
.
maxlsize
return
super
(
GpuConv
,
node_
.
op
)
.
make_thunk
(
node_
,
storage_map
,
return
super
(
GpuConv
,
node_
.
op
)
.
make_thunk
(
node_
,
storage_map
,
compute_map
,
no_recycling
)
compute_map
,
no_recycling
)
...
@@ -179,7 +179,7 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -179,7 +179,7 @@ class GpuConv(GpuKernelBase, gof.Op):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
# raise this whenever modifying any of the support_code_files
# raise this whenever modifying any of the support_code_files
return
(
0
,
2
2
)
return
(
0
,
2
3
)
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
"cuda"
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
"cuda"
:
...
@@ -251,7 +251,6 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -251,7 +251,6 @@ class GpuConv(GpuKernelBase, gof.Op):
"""
%
locals
()
"""
%
locals
()
code
+=
"
\n
"
.
join
([
open
(
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
f
))
.
read
()
code
+=
"
\n
"
.
join
([
open
(
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
f
))
.
read
()
for
f
in
[
"conv_kernel.cu"
,
"conv_full_kernel.cu"
]])
for
f
in
[
"conv_kernel.cu"
,
"conv_full_kernel.cu"
]])
kname
=
"conv_full_load_everything"
gk
=
gpuarray
.
GpuKernel
(
code
,
k
.
name
,
k
.
params
,
**
k
.
flags
)
gk
=
gpuarray
.
GpuKernel
(
code
,
k
.
name
,
k
.
params
,
**
k
.
flags
)
bin
=
gk
.
_binary
bin
=
gk
.
_binary
bcode
=
','
.
join
(
hex
(
ord
(
c
))
for
c
in
bin
)
bcode
=
','
.
join
(
hex
(
ord
(
c
))
for
c
in
bin
)
...
@@ -262,9 +261,12 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -262,9 +261,12 @@ class GpuConv(GpuKernelBase, gof.Op):
static const char conv_bcode[] = {
%(bcode)
s};
static const char conv_bcode[] = {
%(bcode)
s};
static const char *conv_code = "
%(code)
s";
static const char *conv_code = "
%(code)
s";
"""
%
locals
()
"""
%
locals
()
for
k
in
kernels
:
return
mod
mod
+=
"static GpuKernel "
+
k
.
name
+
'_'
+
name
+
";
\n
"
mod
+=
open
(
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
"conv.cu"
))
.
read
()
def
c_support_code_struct
(
self
,
node
,
name
):
mod
=
GpuKernelBase
.
c_support_code_struct
(
self
,
node
,
name
)
with
open
(
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
"conv.cu"
))
as
f
:
mod
+=
f
.
read
()
return
mod
return
mod
@utils.memoize
@utils.memoize
...
...
theano/sandbox/gpuarray/conv_kernel.cu
浏览文件 @
c032ac66
...
@@ -46,7 +46,7 @@ for (int iter_m=0; iter_m < Os[0]; iter_m++) {
...
@@ -46,7 +46,7 @@ for (int iter_m=0; iter_m < Os[0]; iter_m++) {
//Must be the same size as a ptr. We can't use unsigned long as on Windows 64
//Must be the same size as a ptr. We can't use unsigned long as on Windows 64
//bit, it is 32 bit.
//bit, it is 32 bit.
const
uintptr
_t
COALESCED_ALIGN
=
0xFFFFFFFFFFFFFF00
;
// zero-out the trailing bits of pointers
const
size
_t
COALESCED_ALIGN
=
0xFFFFFFFFFFFFFF00
;
// zero-out the trailing bits of pointers
__device__
void
load_to_shared
(
float
*
dst
,
const
float
*
src
,
const
int
thread_id
,
int
nb_thread
,
const
int
N
,
const
bool
flipped
=
false
){
__device__
void
load_to_shared
(
float
*
dst
,
const
float
*
src
,
const
int
thread_id
,
int
nb_thread
,
const
int
N
,
const
bool
flipped
=
false
){
if
(
nb_thread
<
64
)
if
(
nb_thread
<
64
)
...
@@ -75,7 +75,7 @@ __device__ void load_to_shared(float * dst, const float * src, const int thread_
...
@@ -75,7 +75,7 @@ __device__ void load_to_shared(float * dst, const float * src, const int thread_
if
(
thread_id
<
nb_thread
)
if
(
thread_id
<
nb_thread
)
{
{
const
float
*
my_src_ptr
=
(
const
float
*
)(
const
float
*
my_src_ptr
=
(
const
float
*
)(
((
uintptr
_t
)
src
)
&
COALESCED_ALIGN
);
((
size
_t
)
src
)
&
COALESCED_ALIGN
);
my_src_ptr
+=
thread_id
;
my_src_ptr
+=
thread_id
;
while
(
my_src_ptr
<
src
+
N
)
while
(
my_src_ptr
<
src
+
N
)
{
{
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
c032ac66
...
@@ -837,8 +837,7 @@ def local_gpu_conv(node, context_name):
...
@@ -837,8 +837,7 @@ def local_gpu_conv(node, context_name):
return
return
out
=
gpu_conv
(
GpuFromHost
(
context_name
)(
img
),
out
=
gpu_conv
(
GpuFromHost
(
context_name
)(
img
),
GpuFromHost
(
context_name
)(
kern
))
GpuFromHost
(
context_name
)(
kern
))
# op_lifter want the output on the GPU.
assert
isinstance
(
out
.
type
,
GpuArrayType
)
out
=
GpuFromHost
(
context_name
)(
out
)
out
.
values_eq_approx
=
values_eq_approx
out
.
values_eq_approx
=
values_eq_approx
return
[
out
]
return
[
out
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论