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

Jeff Squyres jsquyres at cisco.com
Wed Jan 20 06:07:33 CST 2010

Just to make sure I understand -- you're saying that you have an MPI implementation where MPI_VERSION is being reported as 1, but it also has MPI_INIT_THREAD available.  Is that right?

If so, then having an nm check or using something like Autoconf's AC_CHECK_FUNCTION is probably your best bet.

Alternatively, you could try to dlopen (or whatever the equivalent is on that platform) the current process and dlsym looking for MPI_Init and MPI_Init_thread and invoke whichever one you find/prefer indirectly through a function pointer.

On Jan 20, 2010, at 4:15 AM, Marc-Andre Hermanns wrote:

> 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
> --
> Marc-Andre Hermanns
> Juelich Supercomputing Centre
> Institute for Advanced Simulation
> Forschungszentrum Juelich GmbH
> D-52425 Juelich
> Germany
> 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
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum

Jeff Squyres
jsquyres at cisco.com

More information about the mpi-forum mailing list