提交 0f4f011b authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fixes from review.

上级 99e23d19
.. _using_multi_gpu: .. _tut_using_multi_gpu:
=================== ===================
Using multiple GPUs Using multiple GPUs
...@@ -38,10 +38,20 @@ number of such mappings, but in the example above we have two of them: ...@@ -38,10 +38,20 @@ number of such mappings, but in the example above we have two of them:
The mappings themselves are composed of a context name followed by the The mappings themselves are composed of a context name followed by the
two characters '->' and the device name. The context name is a simple two characters '->' and the device name. The context name is a simple
string which oes not have any special meaning for Theano. For parsing string which does not have any special meaning for Theano. For
reasons, the context name cannot contain the sequence '->'. The parsing reasons, the context name cannot contain the sequence '->' or
device name is a device in the form that gpuarray expects like 'cuda0' ';'. To avoid confusion context names that begin with 'cuda' or
or 'opencl0:0'. 'opencl' as disallowed. The device name is a device in the form that
gpuarray expects like 'cuda0' or 'opencl0:0'.
.. note::
Since there are a bunch of shell special characters in the syntax,
defining this on the command-line will require proper quoting, like this:
.. code-block:: shell
$ THEANO_FLAGS="contexts=dev0->cuda0"
If you don't have enough GPUs for a certain model, you can assign the If you don't have enough GPUs for a certain model, you can assign the
same device to more than one name. You can also assign extra names same device to more than one name. You can also assign extra names
...@@ -72,13 +82,13 @@ which perform two dot products on two different GPUs. ...@@ -72,13 +82,13 @@ which perform two dot products on two different GPUs.
import numpy import numpy
import theano import theano
v01 = theano.shared(numpy.random.random(1024, 1024).astype('float32'), v01 = theano.shared(numpy.random.random((1024, 1024)).astype('float32'),
target='dev0') target='dev0')
v02 = theano.shared(numpy.random.random(1024, 1024).astype('float32'), v02 = theano.shared(numpy.random.random((1024, 1024)).astype('float32'),
target='dev0') target='dev0')
v11 = theano.shared(numpy.random.random(1024, 1024).astype('float32'), v11 = theano.shared(numpy.random.random((1024, 1024)).astype('float32'),
target='dev1') target='dev1')
v12 = theano.shared(numpy.random.random(1024, 1024).astype('float32'), v12 = theano.shared(numpy.random.random((1024, 1024)).astype('float32'),
target='dev1') target='dev1')
f = theano.function([], [theano.tensor.dot(v01, v02), f = theano.function([], [theano.tensor.dot(v01, v02),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论