Reputation: 143795
When I run mpiexec to run a parallel program, the user may pass a number of options to mpiexec. Is there a MPI call to access this command line arguments from within the executed program?
Upvotes: 3
Views: 690
Reputation: 50927
This is all explicitly outside of the standard, so YMMV, but generally no - the executed program never sees the mpiexec arguments. mpiexec is a process launcher and the arguments are to the process launcher, which then launches the processes just with the command line arguments to the executable.
If you need those arguments, you could write a wrapper script which outputs the command line to a file before executing it, and have the processes read them in; but if someone runs with mpiexec directly this will fail.
Something that should often work for a given environment but is still completely non-standard and wouldn't work very well cross-environment (eg, linux vs windows) would be to have MPI task 0 examine it's shell command history and try to pull out the arguments from that.
Upvotes: 2