Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
21ae3bd0
提交
21ae3bd0
authored
5月 13, 2016
作者:
slefrancois
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed using_gpu example to use x.transfer(None)
上级
3fb0c357
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
12 行删除
+13
-12
using_gpu.txt
doc/tutorial/using_gpu.txt
+10
-9
using_multi_gpu.txt
doc/tutorial/using_multi_gpu.txt
+3
-3
没有找到文件。
doc/tutorial/using_gpu.txt
浏览文件 @
21ae3bd0
...
@@ -15,8 +15,8 @@ about how to carry out those computations. One of the ways we take
...
@@ -15,8 +15,8 @@ about how to carry out those computations. One of the ways we take
advantage of this flexibility is in carrying out calculations on a
advantage of this flexibility is in carrying out calculations on a
graphics card.
graphics card.
There are two ways currently to use a gpu, on that should support any OpenCL
There are two ways currently to use a gpu, on
e
that should support any OpenCL
device as well as NVIDIA cards (:ref:`gpuarray`), and the old backend
which
device as well as NVIDIA cards (:ref:`gpuarray`), and the old backend
that
only supports NVIDIA cards (:ref:`cuda`).
only supports NVIDIA cards (:ref:`cuda`).
.. _gpuarray:
.. _gpuarray:
...
@@ -117,7 +117,7 @@ the GPU object directly. The following code is modified to do just that.
...
@@ -117,7 +117,7 @@ the GPU object directly. The following code is modified to do just that.
.. testcode::
.. testcode::
from theano import function, config, shared, tensor
, gpuarray
from theano import function, config, shared, tensor
import numpy
import numpy
import time
import time
...
@@ -126,7 +126,8 @@ the GPU object directly. The following code is modified to do just that.
...
@@ -126,7 +126,8 @@ the GPU object directly. The following code is modified to do just that.
rng = numpy.random.RandomState(22)
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], gpuarray.basic_ops.GpuFromHost(None)(tensor.exp(x)))
gx = x.transfer(None) # Transfer variable to GPU
f = function([], tensor.exp(gx))
print(f.maker.fgraph.toposort())
print(f.maker.fgraph.toposort())
t0 = time.time()
t0 = time.time()
for i in range(iters):
for i in range(iters):
...
@@ -141,11 +142,9 @@ the GPU object directly. The following code is modified to do just that.
...
@@ -141,11 +142,9 @@ the GPU object directly. The following code is modified to do just that.
else:
else:
print('Used the gpu')
print('Used the gpu')
Here the :func:`theano.gpuarray.basic_ops.GpuFromHost(None)` call
Here ``gx = x.transfer(None)`` means "copy variable x to the GPU", with
means "copy input to the GPU", with ``None`` the default GPU context when not
``None`` the default GPU context when not explicitly given. For information
explicitly given. However during the optimization phase,
on how to set GPU contexts, see :ref:`tut_using_multi_gpu`.
since the result will already be on the gpu, it will be removed. It is
used here to tell theano that we want the result on the GPU.
The output is
The output is
...
@@ -251,6 +250,8 @@ Tips for Improving Performance on GPU
...
@@ -251,6 +250,8 @@ Tips for Improving Performance on GPU
raising an error or `pdb` for putting a breakpoint in the computational
raising an error or `pdb` for putting a breakpoint in the computational
graph if there is a CPU Op.
graph if there is a CPU Op.
.. _gpu_async:
GPU Async Capabilities
GPU Async Capabilities
~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
...
...
doc/tutorial/using_multi_gpu.txt
浏览文件 @
21ae3bd0
...
@@ -81,7 +81,7 @@ single name and a single device.
...
@@ -81,7 +81,7 @@ single name and a single device.
It is often the case that multi-gpu operation requires or assumes
It is often the case that multi-gpu operation requires or assumes
that all the GPUs involved are equivalent. This is not the case
that all the GPUs involved are equivalent. This is not the case
for this implementation. Since the user has the task of
for this implementation. Since the user has the task of
distr
u
buting the jobs across the different device a model can be
distr
i
buting the jobs across the different device a model can be
built on the assumption that one of the GPU is slower or has
built on the assumption that one of the GPU is slower or has
smaller memory.
smaller memory.
...
@@ -140,5 +140,5 @@ is a example.
...
@@ -140,5 +140,5 @@ is a example.
cv = gv.transfer('cpu')
cv = gv.transfer('cpu')
Of course you can mix transfers and operations in any order you
Of course you can mix transfers and operations in any order you
choose.
However you should try to minimize transfer operations
choose. However you should try to minimize transfer operations
because they will introduce overhead
any
may reduce performance.
because they will introduce overhead
that
may reduce performance.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论