[IPython-User] HOWTO invoke a script in parallel
Mon Dec 27 11:46:46 CST 2010
On Tue, Dec 21, 2010 at 10:25 AM, Stefan Seefeld
> On 12/21/2010 12:09 PM, Brian Granger wrote:
>> On Tue, Dec 21, 2010 at 7:37 AM, Stefan Seefeld
>> <email@example.com> wrote:
>>> I'm still trying to figure out how to run a script interactively in parallel
>>> (akin to `mpirun -np N<binary>` on the command line). Is this supported at
>>> all ? Is there some documentation explaining the semantics of such an
>>> operation ?
>> Yes, I think what you want is MultiEngineClient.run:
> That works fine, thanks.
> I still wonder, though: What does `px run script.py` mean ? Is it
> well-defined at all ? If not, couldn't it become a convenient alias for
> `mec.run('script.py')` ?
No that is not defined at the current. Think of px this way.
Whatever follows the px is simply sent to the engines for execution.
It must be valid Python code. It is just a short hand for
px a = 10
is the same as:
mec.execute('a = 10')
Thus, when you do px run myscript.py you get:
Because run is not a valid Python command, it should give a
SyntaxError. You could possibly use execfile:
px execfile('myscript.py', globals(), locals())
But using mec.run is probably best.
> ...ich hab' noch einen Koffer in Berlin...
> IPython-User mailing list
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
More information about the IPython-User