Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Executing of external programs
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2010-02-08 15:00:10

On Feb 8, 2010, at 2:34 PM, Lubomir Klimes wrote:

> I am new in the world of MPI and I would like to ask you for the help. In my diploma thesis I need to write a program in C++ using MPI that will execute another external program - an optimization software GAMS. My question is wheter is sufficient to use simply the command system(); for executing GAMS. In other words, will the external program "work" in parallel?

It depends on what you mean, and what your system setup is.

Calling system() may (will) cause problems if you're using a Myrinet or OpenFabrics-based network in MPI (for deep, dark, voodoo reasons -- we can explain if you care). If you're using TCP, you should likely be fine -- but be aware that your resulting program may not be portable.

Calling system() in your MPI application will effectively fork/exec the specified command. Hence, if you "mpirun -np 8 a.out", and a.out calls system("foo"), you'll get 8 copies of foo running independently of each other. If your project is supposed to parallelize foo, then it depends on the input / computation / output of foo as to whether this is a good approach.

That being said, if you're just using MPI effectively as a launcher to launch N copies of foo, note that you can use Open MPI's "mpirun" to launch non-MPI applications (e.g., "mpirun -np 4 hostname").

> If the question is 'Yes', does someone know whether it will work also with LAM/MPI instead of OpenMPI?

As a former developer of LAM/MPI, I can pretty confidently say that, just like Mac replied to your initial question on the LAM/MPI list: LAM/MPI is pretty much dead. If you're just starting with MPI, you're much better to start with Open MPI than LAM/MPI. :-)

Jeff Squyres
For corporate legal information go to: