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.

Mattijs

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:
>
> 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

-- 

Mattijs Janssens

OpenCFD Ltd.
9 Albert Road,
Caversham,
Reading RG4 7AN.
Tel: +44 (0)118 9471030
Email: m.janss...@opencfd.co.uk
URL: http://www.OpenCFD.co.uk

Reply via email to