mpich/0004-Make-mpich.module-useful.patch
Cristian Le a9297c32c6 Added CMAKE_PREFIX_PATH to the module file
... to unsure that CMake projects find the available MPI enabled
packages, libraries, executables, etc.

The motivation is that CMake projects will search first in the
CMAKE_PREFIX_PATH, both for cmake specific files like <Package>Config.cmake as
well as libraries and header files in general. Adding this variable is crucial
to making sure that the MPI versions take precedence over the serial versions.
2024-02-12 14:47:17 +01:00

46 lines
1.8 KiB
Diff

From 27c409c30875ea3ddb8e4bfc6add07c5a3c7780a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 10 Apr 2022 09:36:17 +0200
Subject: [PATCH 4/4] Make mpich.module useful
---
src/packaging/envmods/mpich.module.in | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/packaging/envmods/mpich.module.in b/src/packaging/envmods/mpich.module.in
index 3d6b4fa623..b8283274ee 100644
--- a/src/packaging/envmods/mpich.module.in
+++ b/src/packaging/envmods/mpich.module.in
@@ -3,12 +3,23 @@
# MPICH module for use with 'environment-modules' package:
#
+# Only allow one mpi module to be loaded at a time
+conflict mpi
+
# Define prefix so PATH and MANPATH can be updated.
-setenv prefix @prefix@
-setenv exec_prefix @exec_prefix@
+setenv MPI_BIN @LIBDIR@/bin
+setenv MPI_SYSCONFIG @sysconfdir@/@MPINAME@-@ARCH@
+setenv MPI_FORTRAN_MOD_DIR @fortranmoddir@/@MPINAME@
+setenv MPI_INCLUDE @includedir@
+setenv MPI_LIB @libdir@
+setenv MPI_MAN @mandir@
+setenv MPI_PYTHON_SITEARCH @py2sitearch@/@MPINAME@
+setenv MPI_PYTHON2_SITEARCH @py2sitearch@/@MPINAME@
+setenv MPI_PYTHON3_SITEARCH @py3sitearch@/@MPINAME@
+setenv MPI_COMPILER @MPINAME@-@ARCH@
+setenv MPI_SUFFIX _@MPINAME@
+setenv MPI_HOME @LIBDIR@
prepend-path PATH @bindir@
-prepend-path MANPATH @mandir@
-
-# Undefine prefix and exec_prefix which are too generic environment variables.
-unsetenv prefix
-unsetenv exec_prefix
+prepend-path LD_LIBRARY_PATH @libdir@
+prepend-path MANPATH :@mandir@
+prepend-path PKG_CONFIG_PATH @LIBDIR@/lib/pkgconfig
+prepend-path CMAKE_PREFIX_PATH @LIBDIR@