Did I compile with OpenMPI or MPICH?

落花浮王杯 提交于 2020-01-01 19:09:32

问题


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?


回答1:


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"



回答2:


Open MPI applications react to MCA parameters, that can be passed in environment variables. Just run the executable in singleton mode (i.e. without mpirun/mpiexec) with something like sysinfo_base_verbose set to 30:

$ OMPI_MCA_sysinfo_base_verbose=30 ./program

If you get an output like:

[hostname:pid] mca: base: components_open: Looking for sysinfo components

then this is more than robust indication that the executable uses Open MPI.



来源:https://stackoverflow.com/questions/15619218/did-i-compile-with-openmpi-or-mpich

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!