[Mpi-forum] Compile-time check for MPI_Init or MPI_Init thread

Marc-Andre Hermanns m.a.hermanns at fz-juelich.de
Wed Jan 20 03:15:14 CST 2010

Hi all,

we are currently puzzled about how to check whether to call MPI_Init or
MPI_Init_thread in one of our programs.

Our performance analyzer scout can be built in different versions: MPI,
OpenMP, and hybrid MPI/OpenMP. As the code-base is shared, we have
#define statements to separate individual portions of the code. To
decide whether to call MPI_Init or MPI_Init_thread at compile time we
check the #define set by MPI. However, POE on our Power6 Cluster
correctly reports MPI 1, as it does not support spawning and is
therefore not MPI 2 compliant, yet MPI_Init_thread would be available,
and must be used for the hybrid version.

My initial idea is to take 'nm' at configure-time of our tool. Check
whether MPI_Init_thread is in the library, and set my own #define.

Is there a more elegant solution? How are users supposed to portably
detect it?

Is it something we can/should fix?

Best regards,
Marc-Andre Hermanns
Juelich Supercomputing Centre
Institute for Advanced Simulation
Forschungszentrum Juelich GmbH
D-52425 Juelich

Phone : +49-2461-61-2054
Fax   : +49-2461-61-6656
eMail : m.a.hermanns at fz-juelich.de
WWW   : http://www.fz-juelich.de/jsc/

JSC is the coordinator of the
John von Neumann Institute for Computing
and member of the
Gauss Centre for Supercomputing

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
                    Dr. Ulrich Krafft (stellv. Vorsitzender),
                    Prof. Dr. Harald Bolt,
                    Prof. Dr. Sebastian M. Schmidt

More information about the mpi-forum mailing list