Search code examples
openmpimpich

Did I compile with OpenMPI or MPICH?


I have an executable on my Linux box which I know has been compiled either with OpenMPI or MPICH libraries.

Question: how to determine which one?


Solution

  • The following diagnostic procedure assumes that MPICH/MPICH2 and Open MPI are the only possible MPI implementations that you may have linked with. Other (especially commercial) MPI implementations do exist and may have different library names and/or library symbols.

    First determine if you linked dynamically:

    % ldd my_executable
            linux-vdso.so.1 =>  (0x00007ffff972c000)
            libm.so.6 => /lib/libm.so.6 (0x00007f1f3c6cd000)
            librt.so.1 => /lib/librt.so.1 (0x00007f1f3c4c5000)
            libpthread.so.0 => /lib/libpthread.so.0 (0x00007f1f3c2a7000)
            libc.so.6 => /lib/libc.so.6 (0x00007f1f3bf21000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f1f3c969000)
    

    If you see libmpich.so in that list, then you have dynamically linked to MPICH (or MPICH2). If you see libmpi.so then you have linked with Open MPI.

    If neither is present, then you probably just linked statically. In that case we need to examine the binary to look for distinguishing symbols:

    % ( nm my_executable | grep MPIR_Free_contextid >/dev/null ) && echo "MPICH"
    % ( nm my_executable | grep ompi_comm_set_name >/dev/null ) && echo "Open MPI"