Open paugier opened 2 weeks ago
That comment has already been deleted by github admins for malware, in multiple different issues. Please don't respond further to it. :)
We can install the different implementations with conda.
conda create -n env-openmpi openmpi c-compiler
conda create -n env-impi impi-devel c-compiler
conda create -n env-mpich mpich c-compiler
On Unix, one has to find a command mpi${LANG}
(or mpi${INTEL_COMPILER_NAME}
for intel compilers) (given by the corresponding environment variables or found in the path).
Note that mpigcc
is specific to impi (to compile with gcc). I'm not sure it is really useful because it should be equivalent to mpicc
in this case.
Note that I_MPI_CC
should not be used by Meson to detect MPI (see https://github.com/mesonbuild/meson/issues/9637).
It seems that only openmpi supports pkg-config (and moreover, pkg-config can come from the system and give wrong result). I think pkg-config should be used only if the first strategy failed.
To find the compile and link options, one needs to run
# mpich and impi (and I guess mvapich)
mpicc -compile_info
mpicc -link_info
# openmpi
mpicc -showme:compile
mpicc -showme:link
Note that the -showme
options only gives the options whereas -compile_info
and -link_info
gives the full command.
Note that the -show
option (currently used for impi in Meson) seems to work for all implementations.
$ mpicc -show
gcc -I"/data/mambaforge/envs/env-impi/include" -L"/data/mambaforge/envs/env-impi/lib/release" -L"/data/mambaforge/envs/env-impi/lib" -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker "/data/mambaforge/envs/env-impi/lib/release" -Xlinker -rpath -Xlinker "/data/mambaforge/envs/env-impi/lib" -lmpifort -lmpi -lrt -lpthread -Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack -Xlinker --enable-new-dtags -ldl
$ mpicc -show
x86_64-conda-linux-gnu-cc -I/data/mambaforge/envs/env-fluidfft-openmpi/include -pthread -L/data/mambaforge/envs/env-fluidfft-openmpi/lib -Wl,--allow-shlib-undefined -Wl,-rpath -Wl,/data/mambaforge/envs/env-fluidfft-openmpi/lib -lmpi
$ mpicc -show
x86_64-conda-linux-gnu-cc -I/data/mambaforge/envs/env-fluidfft-mpich/include -I/data/mambaforge/envs/env-fluidfft-mpich/include -L/data/mambaforge/envs/env-fluidfft-mpich/lib -Wl,-rpath,/data/mambaforge/envs/env-fluidfft-mpich/lib -I/data/mambaforge/envs/env-fluidfft-mpich/include -L/data/mambaforge/envs/env-fluidfft-mpich/lib -lmpi
Getting the version is not so simple:
Only for OpenMPI
$ mpicc --showme:version
mpicc: Open MPI 5.0.5 (Language: C)
For other implementation:
mpicc -v
mpicc for MPICH version 4.2.2
[...]
$ mpicc -v
mpigcc for the Intel(R) MPI Library 2021.13 for Linux*
[...]
Describe the bug
Meson does not detect mpich on conda-forge (using GCC) (see an example of failing build here).
Conda-forge usually builds packages depending on MPI with different implementations. For example, in https://github.com/conda-forge/mpi4py-feedstock/blob/main/recipe/conda_build_config.yaml, there is
~At least for mpich,~ the build uses GCC for mpich, openmpi and impi (see for example https://github.com/conda-forge/mpi4py-feedstock/blob/main/.ci_support/linux_64_mpiimpipython3.10.____cpython.yaml).
This issue is very similar to https://github.com/mesonbuild/meson/issues/7045 except that it is about mpich.
More generally, (I think) mpich, openmpi and Intel MPI can be compiled both with GCC and icc and this is very common to have on clusters different modules for the different cases.
To Reproduce
One can for example try to build https://foss.heptapod.net/fluiddyn/fluidfft/-/tree/branch/default/plugins/fluidfft-fftwmpi (simple
meson.build
) in an environment created with:In this environment we have (as expected):
Building fluidfft-fftwmpi with
pip install -e . -v --no-build-isolation
gives:Note that using
does not fix the issue.
Expected behavior
Meson should be able to detect mpich from
mpicc
(and friends) which are in$PATH
.Explanation
The logic in https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/mpi.py is wrong as explained in
I particularly agree with https://github.com/mesonbuild/meson/pull/7373#issuecomment-1532046963
See also if one tries to improve MPI detection:
system parameters
Native build.
Debian 11 or 12 (but it does should be applicable on any Unix)
3.12 (but does not matter)
meson --version
1.5.99 and master
ninja --version
if it's a Ninja build1.12.1