I work on an application (DAKOTA) that has opted for single binaries with source code to detect serial vs. MPI execution at run-time. While I realize there are many other ways to handle this (wrapper scripts, command-line switches, different binaries
for serial vs. MPI, etc.), I'm looking for a reliable way to detect (in source) whether a binary has been launched in serial or with orterun.
We typically do this via detecting environment variables, so the easiest path for me would be to know an environment variable present when an application is invoked with orterun that is not typically present outside that MPI runtime environment. Some
candidates that came up in my particular environment include the following, but I don't know if any is a safe bet:
I'd also welcome suggestions for other in-source tests that might reliably detect run via orterun. Thanks!
Brian M. Adams, PhD (firstname.lastname@example.org)
Optimization and Uncertainty Estimation
Sandia National Laboratories, Albuquerque, NM