Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get the mpiexec command line arguments from within the executed program?

Tags:

mpi

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?

like image 546
Stefano Borini Avatar asked Jan 21 '26 02:01

Stefano Borini


1 Answers

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.

like image 140
Jonathan Dursi Avatar answered Jan 26 '26 03:01

Jonathan Dursi