Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
409552f5
提交
409552f5
authored
4月 25, 2014
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Follow the rename of libgpuarray.
上级
a1796d2d
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
36 行增加
和
35 行删除
+36
-35
introduction.txt
doc/introduction.txt
+1
-1
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+9
-9
conv.py
theano/sandbox/gpuarray/conv.py
+2
-2
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+7
-7
neighbours.py
theano/sandbox/gpuarray/neighbours.py
+2
-2
nnet.py
theano/sandbox/gpuarray/nnet.py
+8
-8
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+2
-2
test_basic_ops.py
theano/sandbox/gpuarray/tests/test_basic_ops.py
+2
-1
type.py
theano/sandbox/gpuarray/type.py
+3
-3
没有找到文件。
doc/introduction.txt
浏览文件 @
409552f5
...
...
@@ -184,7 +184,7 @@ Here is the state of that vision as of December 3th, 2013 (after Theano release
* We have a CUDA backend for tensors of type `float32` only.
* Efforts have begun towards a generic GPU ndarray (GPU tensor) (started in the
`
compyte <https://github.com/inducer/compyte/wiki
>`_ project)
`
libgpuarray <https://github.com/abergeron/libgpuarray
>`_ project)
* Move GPU backend outside of Theano (on top of PyCUDA/PyOpenCL)
* Will provide better support for GPU on Windows and use an OpenCL backend on CPU.
...
...
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
409552f5
...
...
@@ -112,7 +112,7 @@ class GpuKernelBase(object):
return
'|'
.
join
(
flags
)
def
c_headers
(
self
):
return
[
'
compyte
/types.h'
]
return
[
'
gpuarray
/types.h'
]
def
c_support_code_apply
(
self
,
node
,
name
):
kcode
=
self
.
c_kernel_code
(
node
)
...
...
@@ -326,8 +326,8 @@ class GpuFromCuda(Op):
return
xshp
def
c_headers
(
self
):
return
[
'<cuda_ndarray.cuh>'
,
'<
compyte
/extension.h>'
,
'<
compyte
/types.h>'
,
'<cuda.h>'
]
return
[
'<cuda_ndarray.cuh>'
,
'<
gpuarray
/extension.h>'
,
'<
gpuarray
/types.h>'
,
'<cuda.h>'
]
def
c_header_dirs
(
self
):
import
cuda_ndarray
...
...
@@ -355,8 +355,8 @@ class GpuFromCuda(Op):
"""
def
c_init_code
(
self
):
return
[
'cuda_get_ctx = (CUcontext (*)(void *))
compyte
_get_extension("cuda_get_ctx");'
,
'cuda_make_buf = (gpudata *(*)(void *, CUdeviceptr, size_t))
compyte
_get_extension("cuda_make_buf");'
]
return
[
'cuda_get_ctx = (CUcontext (*)(void *))
gpuarray
_get_extension("cuda_get_ctx");'
,
'cuda_make_buf = (gpudata *(*)(void *, CUdeviceptr, size_t))
gpuarray
_get_extension("cuda_make_buf");'
]
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
return
"""
...
...
@@ -462,7 +462,7 @@ class CudaFromGpu(Op):
return
shp
def
c_headers
(
self
):
return
[
'<cuda_ndarray.cuh>'
,
'<
compyte
/extension.h>'
,
'<cuda.h>'
]
return
[
'<cuda_ndarray.cuh>'
,
'<
gpuarray
/extension.h>'
,
'<cuda.h>'
]
def
c_header_dirs
(
self
):
import
cuda_ndarray
...
...
@@ -490,8 +490,8 @@ class CudaFromGpu(Op):
"""
def
c_init_code
(
self
):
return
[
'cuda_get_ctx = (CUcontext (*)(void *ctx))
compyte
_get_extension("cuda_get_ctx");'
,
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
compyte
_get_extension("cuda_get_ptr");'
]
return
[
'cuda_get_ctx = (CUcontext (*)(void *ctx))
gpuarray
_get_extension("cuda_get_ctx");'
,
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
gpuarray
_get_extension("cuda_get_ptr");'
]
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
return
"""
...
...
@@ -806,7 +806,7 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
err = GpuKernel_call(&
%(kname)
s, 0, 1, 256, args);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
"
compyte
error: kEye:
%%
s. n
%%
lu, m=
%%
lu.",
"
gpuarray
error: kEye:
%%
s. n
%%
lu, m=
%%
lu.",
GpuKernel_error(&
%(kname)
s, err),
(unsigned long)dims[0], (unsigned long)dims[1]);
%(fail)
s;
...
...
theano/sandbox/gpuarray/conv.py
浏览文件 @
409552f5
...
...
@@ -183,14 +183,14 @@ class GpuConv(gof.Op):
def
c_headers
(
self
):
return
[
'<stdio.h>'
,
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
]
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
]
def
c_code_cache_version
(
self
):
# raise this whenever modifying any of the support_code_files
return
(
0
,
20
)
def
c_init_code
(
self
):
return
[
'cuda_get_ptr_raw = (CUdeviceptr (*)(gpudata *g))
compyte
_get_extension("cuda_get_ptr");'
]
return
[
'cuda_get_ptr_raw = (CUdeviceptr (*)(gpudata *g))
gpuarray
_get_extension("cuda_get_ptr");'
]
def
c_support_code_apply
(
self
,
node
,
nodename
):
# REMEMBER TO RAISE c_code_cache_version when changing any of
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
409552f5
...
...
@@ -177,8 +177,8 @@ class GpuElemwise(HideC, Elemwise):
def
c_headers
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
...
...
@@ -678,8 +678,8 @@ class GpuCAReduceCuda(HideC, CAReduce):
return
True
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
@@ -2317,7 +2317,7 @@ class GpuCAReduceCuda(HideC, CAReduce):
class
GpuCAReduceCPY
(
GpuKernelBase
,
HideC
,
CAReduceDtype
):
"""CAReduce that reuse the python code from
compyte
.
"""CAReduce that reuse the python code from
gpuarray
.
Too slow for now as it only have a python interface.
...
...
@@ -2535,7 +2535,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
err = GpuKernel_call(&
%(k_var)
s, 0,
%(ls)
s, gs, args);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
"
compyte
error: GpuCAReduceCPY:
%%
s.",
"
gpuarray
error: GpuCAReduceCPY:
%%
s.",
GpuKernel_error(&
%(k_var)
s, err));
%(fail)
s
}
...
...
@@ -2544,7 +2544,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
err = GpuArray_move(&
%(output)
s->ga, &tmp->ga);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
"
compyte
error: GpuCAReduceCPY [cast]:
%%
s.",
"
gpuarray
error: GpuCAReduceCPY [cast]:
%%
s.",
GpuArray_error(&tmp->ga, err));
%(fail)
s
}
...
...
theano/sandbox/gpuarray/neighbours.py
浏览文件 @
409552f5
...
...
@@ -48,8 +48,8 @@ class GpuImages2Neibs(Images2Neibs, Op):
return
(
9
,
1
)
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
theano/sandbox/gpuarray/nnet.py
浏览文件 @
409552f5
...
...
@@ -47,7 +47,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(Op):
return
Apply
(
self
,
[
x
,
b
,
y_idx
],
[
nll
,
sm
,
am
])
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
]
def
c_support_code_apply
(
self
,
node
,
nodename
):
dtype_x
=
node
.
inputs
[
0
]
.
dtype
...
...
@@ -111,7 +111,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(Op):
"""
%
locals
()
def
c_init_code
(
self
):
return
[
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
compyte
_get_extension("cuda_get_ptr");'
]
return
[
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
gpuarray
_get_extension("cuda_get_ptr");'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
typecode_x
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
inputs
[
0
]
.
dtype
)
...
...
@@ -300,7 +300,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(Op):
return
(
6
,)
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
@@ -440,7 +440,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(Op):
"""
%
locals
()
def
c_init_code
(
self
):
return
[
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
compyte
_get_extension("cuda_get_ptr");'
]
return
[
'cuda_get_ptr = (CUdeviceptr (*)(gpudata *g))
gpuarray
_get_extension("cuda_get_ptr");'
]
gpu_crossentropy_softmax_1hot_with_bias_dx
=
GpuCrossentropySoftmax1HotWithBiasDx
()
...
...
@@ -469,8 +469,8 @@ class GpuSoftmax (Op):
return
(
12
,)
+
inline_softmax
.
code_version
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
@@ -663,8 +663,8 @@ class GpuSoftmaxWithBias (Op):
return
(
11
,)
+
inline_softmax
.
code_version
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
409552f5
...
...
@@ -477,8 +477,8 @@ class GpuAdvancedIncSubtensor1_dev20(GpuAdvancedIncSubtensor1):
return
(
2
,)
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<
compyte
/extension.h>'
,
'<numpy_compat.h>'
,
'<
compyte
/ext_cuda.h>'
]
return
[
'cuda.h'
,
'<
gpuarray
/extension.h>'
,
'<numpy_compat.h>'
,
'<
gpuarray
/ext_cuda.h>'
]
def
c_compiler
(
self
):
return
NVCC_compiler
...
...
theano/sandbox/gpuarray/tests/test_basic_ops.py
浏览文件 @
409552f5
...
...
@@ -219,7 +219,8 @@ def test_transfer_cpu_gpu():
def
test_transfer_strided
():
# This is just to ensure that it works in theano
# compyte has a much more comprehensive suit of tests to ensure correctness
# libgpuarray has a much more comprehensive suit of tests to
# ensure correctness
a
=
T
.
fmatrix
(
'a'
)
g
=
GpuArrayType
(
dtype
=
'float32'
,
broadcastable
=
(
False
,
False
))(
'g'
)
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
409552f5
...
...
@@ -207,15 +207,15 @@ class GpuArrayType(Type):
def
c_headers
(
self
):
# We need arrayobject for the PyArrayDescr struct def
# (even if we just use a pointer to it in a function def)
return
[
'<
compyte/array.h>'
,
'<compyte/kernel.h>'
,
'<compyte
/error.h>'
,
'<
compyte
/buffer_blas.h>'
,
'<numpy/arrayobject.h>'
,
return
[
'<
gpuarray/array.h>'
,
'<gpuarray/kernel.h>'
,
'<gpuarray
/error.h>'
,
'<
gpuarray
/buffer_blas.h>'
,
'<numpy/arrayobject.h>'
,
'<gpuarray_api.h>'
]
def
c_header_dirs
(
self
):
return
[
pygpu
.
get_include
(),
numpy
.
get_include
()]
def
c_libraries
(
self
):
return
[
'
compyte
'
]
return
[
'
gpuarray
'
]
def
c_code_cache_version
(
self
):
ver
=
pygpu
.
gpuarray
.
api_version
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论