Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
df9a0348
提交
df9a0348
authored
6月 22, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more linking.
上级
9dde5536
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
8 行删除
+15
-8
extending_theano_gpu.txt
doc/extending/extending_theano_gpu.txt
+15
-8
没有找到文件。
doc/extending/extending_theano_gpu.txt
浏览文件 @
df9a0348
...
@@ -76,16 +76,17 @@ theano operations and variables.
...
@@ -76,16 +76,17 @@ theano operations and variables.
The last place where you might need the context is in the C
The last place where you might need the context is in the C
initialization code. For that you will have to use the :ref:`params
initialization code. For that you will have to use the :ref:`params
<extending_op_params>`. The params type should be
<extending_op_params>`. The params type should be
:
class
:`theano.gpuarray.type.gpu_context_type` and the params object
:
data
:`theano.gpuarray.type.gpu_context_type` and the params object
should be a context object from one of your input variables::
should be a context object from one of your input variables::
def get_params(self, node):
def get_params(self, node):
return node.inputs[0].type.context
return node.inputs[0].type.context
If you don't have any input variables on the GPU you can follow the
If you don't have any input variables on the GPU you can follow the
the example of :class:`theano.gpuarray.basic_ops.GpuFromHost` or
the example of :class:`GpuFromHost
:class:`theano.gpuarray.basic_ops.GpuEye`. This is not a case that
<theano.gpuarray.basic_ops.GpuFromHost>` or :class:`GpuEye
you should encounter often, so it will not be covered further.
<theano.gpuarray.basic_ops.GpuEye>`. This is not a case that you
should encounter often, so it will not be covered further.
Defining New Kernels
Defining New Kernels
====================
====================
...
@@ -117,7 +118,7 @@ this::
...
@@ -117,7 +118,7 @@ this::
params=[gpuarray.GpuArray, gpuarray.SIZE, gpuarray.SIZE],
params=[gpuarray.GpuArray, gpuarray.SIZE, gpuarray.SIZE],
flags=Kernel.get_flags('float64'))]
flags=Kernel.get_flags('float64'))]
If you want to use
COp
, then you should use ``CGpuKernelBase``
If you want to use
``COp``
, then you should use ``CGpuKernelBase``
instead. It adds a new section to the parsed files whose tag is
instead. It adds a new section to the parsed files whose tag is
``kernels``. Inside that section you can define some kernels with
``kernels``. Inside that section you can define some kernels with
``#kernel name:params:flags``.
``#kernel name:params:flags``.
...
@@ -150,10 +151,12 @@ right, which GpuKernelBase handles for you. But if you really want to
...
@@ -150,10 +151,12 @@ right, which GpuKernelBase handles for you. But if you really want to
go this way, then you can look up the C API for kernels in
go this way, then you can look up the C API for kernels in
libgpuarray.
libgpuarray.
In any case you will need to call your compiled kernel with some data,
In any case you will need to call your compiled kernel with some data,
in most cases in your :meth:`c_code` method. This is done using the
in most cases in your :meth:`c_code` method. This is done using the
``GpuKernel_call()`` function in your C code. An example calling the
`GpuKernel_call()
above kernel would be::
<http://deeplearning.net/software/libgpuarray/c_api.html#GpuKernel_call>`_
function in your C code. An example calling the above kernel would
be::
size_t ls, gs;
size_t ls, gs;
size_t dims[2];
size_t dims[2];
...
@@ -171,6 +174,10 @@ above kernel would be::
...
@@ -171,6 +174,10 @@ above kernel would be::
// ...
// ...
For other operations in the C code you should refer to the
`libgpuarray documentation
<http://deeplearning.net/software/libgpuarray/>`_.
A Complete Example
A Complete Example
==================
==================
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论