Calling a script which calls an MPI process from an MPI process <p>I have an MPI program (Fortran, <a href="http://www.mpich.org/" rel="nofollow">MPICH</a>) which I need to shell out from to a script which, in turn, starts its own MPI program (using <code>mpirun</code>). Thus far, I've wrapped the shell out (<code>system</code>) command in an <code>if(system_num .eq. root_system_num)</code> thing so only one MPI process runs the script. However, this causes a series of <code>HYDU_create_process</code> errors.</p> <p>I considered using <code>MPI_Comm_spawn</code> but there are warnings like "MPI does not say what happens if the program you start is a shell script and that shell script starts a program that calls <code>MPI_INIT</code>", so this seems less than ideal, as well.</p> <p>Some points:</p> <ul> <li>The program called in shell script does not need to interact with the calling program at all. The calling program just needs to wait until that process is done.</li> <li>There is not an easy way to turn the shell script into a separate executable (lots of environment variable setting, and so on).</li> <li>Ideally, this should work for both MPICH and <a href="http://www.open-mpi.org/" rel="nofollow">Open MPI</a>.</li> </ul> <p>Is there a way to do this?</p>