Question

In IPython for parallel execution we have multiple engines. The jobs are dispatched to them using: %%px cell magics to set up the environment in the clients and then using DirectView map_sync to run the various experiments.

The experiments return a named-tuple of results. Thus this named-tuple need to be declared in both the client and in each engine.

Currently each time I run it, I run it twice, one with %%px and once without.

is there a flag of %%px that will make it run both locally and in each engine?

Was it helpful?

Solution

As of IPython 1.0, you can instruct %%px to also execute the cell locally. This is done using the "--local" flag.

%%px --local

http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Parallel%20Computing/Parallel%20Magics.ipynb

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top