summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/mpi.py
diff options
context:
space:
mode:
authorpaugier <pierre.augier@univ-grenoble-alpes.fr>2024-09-04 23:15:56 +0200
committerEli Schwartz <eschwartz93@gmail.com>2024-09-24 11:30:21 -0400
commite2ab61627a2989b9c7e4c8062d681a8084bf5280 (patch)
tree267d11a293f42e10b40b34afd9c724c5d72777d9 /mesonbuild/dependencies/mpi.py
parentb7bf61e33e76705e6dd9a0e59e48ac9f3b97e765 (diff)
downloadmeson-e2ab61627a2989b9c7e4c8062d681a8084bf5280.tar.gz
MPI detection: mpicc/mpiicc before pkg-config
The standard way to compile MPI applications (recommanded by all MPI implementations) is to use the commands mpicc/mpiicc (and friends). Therefore, it is standard to just set PATH such that mpicc points towards a wrapper of the MPI implementation that one wants to use. In contrast, pkg-config is supported only by OpenMPI. Therefore, Meson has first to take into account the mpicc command to get chance to use mpicc of MPICH or IntelMPI in the case OpenMPI is installed (so that pkg-config would find it).
Diffstat (limited to 'mesonbuild/dependencies/mpi.py')
-rw-r--r--mesonbuild/dependencies/mpi.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/mesonbuild/dependencies/mpi.py b/mesonbuild/dependencies/mpi.py
index f9c911c29..f97bb3311 100644
--- a/mesonbuild/dependencies/mpi.py
+++ b/mesonbuild/dependencies/mpi.py
@@ -37,18 +37,6 @@ def mpi_factory(env: 'Environment',
return []
compiler_is_intel = compiler.get_id() in {'intel', 'intel-cl'}
- # Only OpenMPI has pkg-config, and it doesn't work with the intel compilers
- if DependencyMethods.PKGCONFIG in methods and not compiler_is_intel:
- pkg_name = None
- if language == 'c':
- pkg_name = 'ompi-c'
- elif language == 'cpp':
- pkg_name = 'ompi-cxx'
- elif language == 'fortran':
- pkg_name = 'ompi-fort'
- candidates.append(functools.partial(
- PkgConfigDependency, pkg_name, env, kwargs, language=language))
-
if DependencyMethods.CONFIG_TOOL in methods:
nwargs = kwargs.copy()
@@ -90,6 +78,19 @@ def mpi_factory(env: 'Environment',
candidates.append(functools.partial(
MSMPIDependency, 'msmpi', env, kwargs, language=language))
+ # Only OpenMPI has pkg-config, and it doesn't work with the intel compilers
+ # for MPI, environment variables and commands like mpicc should have priority
+ if DependencyMethods.PKGCONFIG in methods and not compiler_is_intel:
+ pkg_name = None
+ if language == 'c':
+ pkg_name = 'ompi-c'
+ elif language == 'cpp':
+ pkg_name = 'ompi-cxx'
+ elif language == 'fortran':
+ pkg_name = 'ompi-fort'
+ candidates.append(functools.partial(
+ PkgConfigDependency, pkg_name, env, kwargs, language=language))
+
return candidates
packages['mpi'] = mpi_factory