How can my program determine if it was launched via mpirun

How does my MPI program detect if it was run as a standalone application or via mpirun?

+4
source share
2 answers

Given the response and comments of half-consciousness and Hristo Iliev, there is no general and figurative way to do this. As a workaround, you can check the environment variables set by mpirun. See for example:
http://www.open-mpi.org/faq/?category=running#mpi-environmental-variables

+2
source

There is no standard MPI way to tell the difference between an MPI application that runs directly, or as one rank with mpirun. See " Singleton MPI_Init " for more information on this MPI job.

The answer of checking the environment variable from Douglas is a reasonable hack ... but it does not carry over to any other MPI implementation.

+2
source

Source: https://habr.com/ru/post/1437259/


All Articles