Show More
@@ -36,7 +36,7 b'' | |||||
36 | { |
|
36 | { | |
37 | "cell_type": "markdown", |
|
37 | "cell_type": "markdown", | |
38 | "source": [ |
|
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 | "These magics are initially associated with a DirectView always associated with all currently registered engines." |
|
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 | "cell_type": "markdown", |
|
115 | "cell_type": "markdown", | |
116 | "source": [ |
|
116 | "source": [ | |
117 | "But you will notice that this didn't output the result of the last command.\n", |
|
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 | "cell_type": "code", |
|
122 | "cell_type": "code", | |
123 | "input": [ |
|
123 | "input": [ | |
124 | "%result" |
|
124 | "%pxresult" | |
125 | ], |
|
125 | ], | |
126 | "language": "python", |
|
126 | "language": "python", | |
127 | "outputs": [] |
|
127 | "outputs": [] | |
@@ -174,7 +174,7 b'' | |||||
174 | { |
|
174 | { | |
175 | "cell_type": "code", |
|
175 | "cell_type": "code", | |
176 | "input": [ |
|
176 | "input": [ | |
177 | "%result" |
|
177 | "%pxresult" | |
178 | ], |
|
178 | ], | |
179 | "language": "python", |
|
179 | "language": "python", | |
180 | "outputs": [] |
|
180 | "outputs": [] | |
@@ -212,14 +212,14 b'' | |||||
212 | "source": [ |
|
212 | "source": [ | |
213 | "When you specify 'order', then individual display outputs (e.g. plots) will be interleaved.\n", |
|
213 | "When you specify 'order', then individual display outputs (e.g. plots) will be interleaved.\n", | |
214 | "\n", |
|
214 | "\n", | |
215 | "`%result` takes the same output-ordering arguments as `%%px`, \n", |
|
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 `%result`:" |
|
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 | "cell_type": "code", |
|
220 | "cell_type": "code", | |
221 | "input": [ |
|
221 | "input": [ | |
222 | "%result --group-outputs=order" |
|
222 | "%pxresult --group-outputs=order" | |
223 | ], |
|
223 | ], | |
224 | "language": "python", |
|
224 | "language": "python", | |
225 | "outputs": [] |
|
225 | "outputs": [] | |
@@ -323,6 +323,56 b'' | |||||
323 | "outputs": [] |
|
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 | "cell_type": "code", |
|
376 | "cell_type": "code", | |
327 | "input": [], |
|
377 | "input": [], | |
328 | "language": "python", |
|
378 | "language": "python", |
General Comments 0
You need to be logged in to leave comments.
Login now