glotzerlab / hoomd-blue

Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
http://glotzerlab.engin.umich.edu/hoomd-blue
BSD 3-Clause "New" or "Revised" License
335 stars 130 forks source link

When both mpich and openmpi are present and MPI_HOME points to openmpi binaries are linked with both mpich and openmpi #1397

Closed yurivict closed 1 year ago

yurivict commented 2 years ago

Description

In order to link with openmpi these arguments are added to cmake:

-DMPIEXEC_EXECUTABLE:FILEPATH="/usr/local/mpi/openmpi/bin/mpiexec"   -DMPI_HOME:PATH="/usr/local/mpi/openmpi"

Yet when mpich is also installed (in /usr/local) binaries are linked to both:

$ ldd -a work/stage/usr/local/lib/python3.9/site-packages/hoomd/_hoomd.cpython-39.so | more
work/stage/usr/local/lib/python3.9/site-packages/hoomd/_hoomd.cpython-39.so:
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x33f3ffc3d000)
        libquickhull.so => /disk-samsung/freebsd-ports/science/py-hoomd-blue/work/stage/usr/local/lib/python3.9/site-packages/hoomd/libquickhull.so (0x33f3ffc3d000)
        libtbb.so.12 => /usr/local/lib/libtbb.so.12 (0x33f3ffc3d000)
        libmpi_cxx.so.40 => /usr/local/mpi/openmpi/lib/libmpi_cxx.so.40 (0x33f3ffc3d000)
        libmpi.so.12 => /usr/local/lib/libmpi.so.12 (0x33f3ffc3d000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x33f3ffc3d000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x33f3ffc3d000)
        libm.so.5 => /lib/libm.so.5 (0x33f3ffc3d000)
        libgcc_s.so.1 => /usr/local/lib/gcc11/libgcc_s.so.1 (0x33f3ffc3d000)
        libthr.so.3 => /lib/libthr.so.3 (0x33f3ffc3d000)
        libc.so.7 => /lib/libc.so.7 (0x33f3ffc3d000)

Please note these two lines above:

        libmpi_cxx.so.40 => /usr/local/mpi/openmpi/lib/libmpi_cxx.so.40 (0x33f3ffc3d000) - link to OpenMPI
        libmpi.so.12 => /usr/local/lib/libmpi.so.12 (0x33f3ffc3d000) - link to MPICH

This doesn't happen with other projects, for example with axom under the same conditions.

Versions:

Developer

joaander commented 2 years ago

HOOMD finds and links MPI using CMake: https://github.com/glotzerlab/hoomd-blue/blob/e17d2d391d8734fd5e8538de9ee45179a175db37/CMake/hoomd/HOOMDMPISetup.cmake#L7 https://github.com/glotzerlab/hoomd-blue/blob/e17d2d391d8734fd5e8538de9ee45179a175db37/hoomd/CMakeLists.txt#L320 HOOMD is not responsible if CMake chooses the incorrect libraries to link.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

yurivict commented 1 year ago

not stale

joaander commented 1 year ago

Not a bug in HOOMD, please report the problem upstream to CMake.