##// END OF EJS Templates
update Parallel Magics notebook
MinRK -
Show More
@@ -36,7 +36,7 b''
36 36 {
37 37 "cell_type": "markdown",
38 38 "source": [
39 "Creating a Client registers the parallel magics `%px`, `%%px`, `%pxresult`, and `%autopx`. \n",
39 "Creating a Client registers the parallel magics `%px`, `%%px`, `%pxresult`, `pxconfig`, and `%autopx`. \n",
40 40 "These magics are initially associated with a DirectView always associated with all currently registered engines."
41 41 ]
42 42 },
@@ -115,13 +115,13 b''
115 115 "cell_type": "markdown",
116 116 "source": [
117 117 "But you will notice that this didn't output the result of the last command.\n",
118 "For this, we have `%result`, which displays the output of the latest request:"
118 "For this, we have `%pxresult`, which displays the output of the latest request:"
119 119 ]
120 120 },
121 121 {
122 122 "cell_type": "code",
123 123 "input": [
124 "%result"
124 "%pxresult"
125 125 ],
126 126 "language": "python",
127 127 "outputs": []
@@ -174,7 +174,7 b''
174 174 {
175 175 "cell_type": "code",
176 176 "input": [
177 "%result"
177 "%pxresult"
178 178 ],
179 179 "language": "python",
180 180 "outputs": []
@@ -212,14 +212,14 b''
212 212 "source": [
213 213 "When you specify 'order', then individual display outputs (e.g. plots) will be interleaved.\n",
214 214 "\n",
215 "`%result` takes the same output-ordering arguments as `%%px`, \n",
216 "so you can view the previous result in a variety of different ways with a few sequential calls to `%result`:"
215 "`%pxresult` takes the same output-ordering arguments as `%%px`, \n",
216 "so you can view the previous result in a variety of different ways with a few sequential calls to `%pxresult`:"
217 217 ]
218 218 },
219 219 {
220 220 "cell_type": "code",
221 221 "input": [
222 "%result --group-outputs=order"
222 "%pxresult --group-outputs=order"
223 223 ],
224 224 "language": "python",
225 225 "outputs": []
@@ -323,6 +323,56 b''
323 323 "outputs": []
324 324 },
325 325 {
326 "cell_type": "heading",
327 "level": 2,
328 "source": [
329 "Parallel Exceptions"
330 ]
331 },
332 {
333 "cell_type": "markdown",
334 "source": [
335 "When you raise exceptions with the parallel exception,\n",
336 "the CompositeError raised locally will display your remote traceback."
337 ]
338 },
339 {
340 "cell_type": "code",
341 "input": [
342 "%%px\n",
343 "from numpy.random import random\n",
344 "A = random((100,100,'invalid shape'))"
345 ],
346 "language": "python",
347 "outputs": []
348 },
349 {
350 "cell_type": "heading",
351 "level": 2,
352 "source": [
353 "Remote Cell Magics"
354 ]
355 },
356 {
357 "cell_type": "markdown",
358 "source": [
359 "Remember, Engines are IPython too, so the cell that is run remotely by %%px can in turn use a cell magic."
360 ]
361 },
362 {
363 "cell_type": "code",
364 "input": [
365 "%%px\n",
366 "%%timeit\n",
367 "from numpy.random import random\n",
368 "from numpy.linalg import norm\n",
369 "A = random((100,100))\n",
370 "norm(A, 2) "
371 ],
372 "language": "python",
373 "outputs": []
374 },
375 {
326 376 "cell_type": "code",
327 377 "input": [],
328 378 "language": "python",
General Comments 0
You need to be logged in to leave comments. Login now