On 9 October 2015 at 12:05, simona bellavista <afy...@gmail.com> wrote: > > > 2015-10-09 9:40 GMT+02:00 Lisandro Dalcin <dalc...@gmail.com>: >> >> On 8 October 2015 at 14:54, simona bellavista <afy...@gmail.com> wrote: >> > >> >> >> >> >> I cannot figure out how spawn would work with a string-command. I tried >> >> MPI.COMM_SELF.Spawn(cmd, args=None,maxproc=4) and it just hangs >> > >> >> MPI.COMM_SELF.Spawn("/bin/echo", args=["Hello", >> "World!"],maxprocs=1).Disconnect() >> >> Could you try the line above and confirm whether it hangs? > > > I have tried the line above and it hangs >
OK, as "echo" is not an MPI application, then it seems OpenMPI does not support spawning. >> >> > >> > I couldn't figure out how to run Spawn with a string-like command, in >> > fact >> > the command that I want to run varies for each processor. >> >> Use maxprocs=1 and make different spawn calls. >> >> However, I have to insist. If you are using mpi4py as a tool to spawn >> a bunch of different processes that work in isolation and then collect >> result at the end, then mpi4py is likely not the right tool for the >> task, at least if you do not have previous experience with MPI >> programming. >> > Well, I don't have a big experience in MPI programming, but I do use and > modify existing MPI codes, and I thought MPI would be easiest choice. Have you seen these existing MPI codes calling back to the shell to execute commands? > Clustershells looks a bit an overshoot for the goal I would like to achieve. > What shall I use instead? Shall I try multiprocessing module? > As long as running on a single compute node is many cores is enough for your application, there is no reason to use MPI. Python's multiprocessing of perhaps the Python 3 "concurrent.futures" package (there is a backport for Python 2 on PyPI) would be trivial to get working. -- Lisandro Dalcin ============ Research Scientist Computer, Electrical and Mathematical Sciences & Engineering (CEMSE) Numerical Porous Media Center (NumPor) King Abdullah University of Science and Technology (KAUST) http://numpor.kaust.edu.sa/ 4700 King Abdullah University of Science and Technology al-Khawarizmi Bldg (Bldg 1), Office # 4332 Thuwal 23955-6900, Kingdom of Saudi Arabia http://www.kaust.edu.sa Office Phone: +966 12 808-0459