Most message passing libraries that I've worked with use command line
arguments (that get filtered out in MPI_Init) to pass in information to the
started jobs. You could have a check for 'strange' command line arguments.
On Monday 20 October 2008 23:40, Adams, Brian M wrote:
> 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 (briadam_at_[hidden])
> Optimization and Uncertainty Estimation
> Sandia National Laboratories, Albuquerque, NM
9 Albert Road,
Reading RG4 7AN.
Tel: +44 (0)118 9471030