With mpi4py you can have multiple python processes running in parallel.
See this script for a very basic use example:

import sys
from mpi4py import MPI

comm= MPI.COMM_WORLD
rank = comm.Get_rank()

print "%d" % (rank)

which you can launch by mpirun -np N script.py.

It is, however, a bad idea to have more parallel threads than available 
processors, as the overhead on the OS scheduler increases.
If you have a machine with N cores, your best bet is to run with N processes 
at a time.
You can use mpi4py over several machines though.

Massimiliano

In data venerdì 26 febbraio 2016 14:54:33, Tim De Coster ha scritto:

Hi all,

I am stuck with a problem regarding ParaView (version 4.0.1 64-bit), running 
on Ubuntu 14.04. I have written a python driver script that calls for a script 
that is executed with pvpython. I need to do this about 100.000 times. I have 
thus written a loop around the call to pvpython to execute things. It seems 
however that I execute one process at a time, after which paraview closes 
(which I want) and then the next process is called. The processes I am running 
are however not super intensive, so it should be possible to run 10 to 100 of 
them at the same time in parallel. I don't seem to find how I can do this. Is 
there anybody who can provide me with an idea how to do this?


With kind regards,

Tim



Example script of what I have at the moment:

import subprocess
import numpy as np
import shutil

def main():

    for-loop generating filenames
           print 'We are at', filename3
           subprocess.call(['/usr/bin/pvpython', 'MakeMovie.py', '-f', 
filename3])
           shutil.rmtree('./{0}'.format(filename3))

if __name__ == '__main__':
    main()


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to