[SciPy-User] Parallel processing

Matthieu Brucher matthieu.brucher@gmail....
Fri Mar 4 09:34:18 CST 2011


Hi Nils,

As you are launching subprocesses, you can always do a crude:

import subprocess

processes = []

for i in range(nproc):
  processes.push_back(subprocess.Popen(...))

for process in processes:
  retcode = process.wait()
  ...

Matthieu

2011/3/4 Nils Wagner <nwagner@iam.uni-stuttgart.de>

> Hi all,
>
> my question is a bit off-topic. However, I hope that I
> will get an answer
>
> I would like to parallelize a number of calls to mycmd
>
> nproc denotes the number of processes .
>
> for i in range(nproc):
>
>     try:
>         retcode = call("mycmd" + " myarg", shell=True)
>         if retcode < 0:
>             print >>sys.stderr, "Child was terminated by
> signal", -retcode
>         else:
>             print >>sys.stderr, "Child returned", retcode
>     except OSError, e:
>         print >>sys.stderr, "Execution failed:", e
>
>
> How can I manage that with python ?
>
> Any pointer would be appreciated.
>
> Thanks in advance
>                                                   Nils
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110304/ee307d63/attachment.html 


More information about the SciPy-User mailing list