Brian,

In your code branch for the parallel run you could set an environment or internal variable when you call mpi_init. Can you parse the command line (arg 0) and figure out if you are running parallel or serial.

Doug Reeder
On Oct 20, 2008, at 3:40 PM, 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:

OMPI_MCA_gpr_replica_uri
OMPI_MCA_mpi_paffinity_processor
OMPI_MCA_mpi_yield_when_idle
OMPI_MCA_ns_nds
OMPI_MCA_ns_nds_cellid
OMPI_MCA_ns_nds_jobid
OMPI_MCA_ns_nds_num_procs
OMPI_MCA_ns_nds_vpid
OMPI_MCA_ns_nds_vpid_start
OMPI_MCA_ns_replica_uri
OMPI_MCA_orte_app_num
OMPI_MCA_orte_base_nodename
OMPI_MCA_orte_precondition_transports
OMPI_MCA_pls
OMPI_MCA_ras
OMPI_MCA_rds
OMPI_MCA_rmaps
OMPI_MCA_rmgr
OMPI_MCA_universe

I'd also welcome suggestions for other in-source tests that might reliably detect run via orterun. Thanks!

Brian
----------
Brian M. Adams, PhD (bria...@sandia.gov)
Optimization and Uncertainty Estimation
Sandia National Laboratories, Albuquerque, NM
http://www.sandia.gov/~briadam


_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users

Reply via email to