I have an MPI program (Fortran, MPICH) which I need to shell out from to a script which, in turn, starts its own MPI program (using mpirun
). Thus far, I've wrapped the shell out (system
) command in an if(system_num .eq. root_system_num)
thing so only one MPI process runs the script. However, this causes a series of HYDU_create_process
errors.
I considered using MPI_Comm_spawn
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 MPI_INIT
", so this seems less than ideal, as well.
Some points:
- 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.
- There is not an easy way to turn the shell script into a separate executable (lots of environment variable setting, and so on).
- Ideally, this should work for both MPICH and Open MPI.
Is there a way to do this?