##// END OF EJS Templates
clarify @parallel vs map in docs
MinRK -
Show More
@@ -145,10 +145,38 b' operations and distribute them, reconstructing the result.'
145 In [17]: (C_local == C_remote).all()
145 In [17]: (C_local == C_remote).all()
146 Out[17]: True
146 Out[17]: True
147
147
148 Calling a ``@parallel`` function *does not* correspond to map. It is used for splitting
149 element-wise operations that operate on a sequence or array. For ``map`` behavior,
150 parallel functions do have a map method.
151
152 ==================== ============================ =============================
153 call pfunc(seq) pfunc.map(seq)
154 ==================== ============================ =============================
155 # of tasks # of engines (1 per engine) # of engines (1 per engine)
156 # of remote calls # of engines (1 per engine) ``len(seq)``
157 argument to remote ``seq[i:j]`` (sub-sequence) ``seq[i]`` (single element)
158 ==================== ============================ =============================
159
160 A quick example to illustrate the difference in arguments for the two modes:
161
162 .. sourcecode:: ipython
163
164 In [16]: @dview.parallel(block=True)
165 ....: def echo(x):
166 ....: return str(x)
167 ....:
168
169 In [17]: echo(range(5))
170 Out[17]: ['[0, 1]', '[2]', '[3]', '[4]']
171
172 In [18]: echo.map(range(5))
173 Out[18]: ['0', '1', '2', '3', '4']
174
175
148 .. seealso::
176 .. seealso::
149
177
150 See the docstrings for the :func:`parallel` and :func:`remote` decorators for
178 See the :func:`~.remotefunction.parallel` and :func:`~.remotefunction.remote`
151 options.
179 decorators for options.
152
180
153 Calling Python functions
181 Calling Python functions
154 ========================
182 ========================
General Comments 0
You need to be logged in to leave comments. Login now