pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk mk/mpi.buildlink3.mk: Add MPI_TYPE=native and diagn...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8abb68ccba4e
branches:  trunk
changeset: 452485:8abb68ccba4e
user:      thor <thor%pkgsrc.org@localhost>
date:      Tue May 11 21:30:57 2021 +0000

description:
mk/mpi.buildlink3.mk: Add MPI_TYPE=native and diagnostics

This enables use of MPI compiler wrappers present in the host
system via MPI_TYPE=native. Also, it checks for conflicts with
a preintalled different MPI choice from pkgsrc and.

diffstat:

 mk/mpi.buildlink3.mk |  38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r ef5f2ff1f30d -r 8abb68ccba4e mk/mpi.buildlink3.mk
--- a/mk/mpi.buildlink3.mk      Tue May 11 21:06:15 2021 +0000
+++ b/mk/mpi.buildlink3.mk      Tue May 11 21:30:57 2021 +0000
@@ -1,15 +1,24 @@
-# $NetBSD: mpi.buildlink3.mk,v 1.5 2019/09/02 02:23:02 rillig Exp $
+# $NetBSD: mpi.buildlink3.mk,v 1.6 2021/05/11 21:30:57 thor Exp $
 #
 # This Makefile fragment is meant to be included by packages
 # that use any MPI implementation instead of one particular one.
-# The available MPI implementations are "mpich" and "openmpi".
+# The available MPI implementations are "mpich" and "openmpi",
+# or just whatever you have installed in the system (mpi wrapper
+# compiler names are standardized).
+#
+# You have to decide on one implementation and stick to it. Especially
+# with the native option, installing an MPI implementation from pkgsrc
+# will break things for programs that you built before.
 #
 # User-settable variables:
 #
 # MPI_TYPE
 #      This value represents the type of MPI we wish to use on the system.
+#       Changing this value is only safe when you ensure that all MPI-using
+#       packages are re-built, and if switching to native, the MPI package
+#       from pkgsrc needs to be deinstalled first.
 #
-#      Possible: mpich, openmpi
+#      Possible: mpich, openmpi, native
 #      Default: mpich
 
 .if !defined(MPI_BUILDLINK3_MK)
@@ -19,12 +28,17 @@
 
 # Try to find if we have anything installed already
 .if exists(${LOCALBASE}/bin/mpicc)
-_MPI_PACKAGE!= ${PKG_INFO} -Q PKGPATH -F ${LOCALBASE}/bin/mpicc
-MPI_TYPE?=     ${_MPI_PACKAGE:T}
-.else
+_INST_MPI_PACKAGE!=    ${PKG_INFO} -Q PKGPATH -F ${LOCALBASE}/bin/mpicc
+MPI_TYPE?=     ${_INST_MPI_PACKAGE:T:S/-//}
+.endif
 
 MPI_TYPE?=     mpich   # default to MPICH due to backward compatibility
-.if ${MPI_TYPE} == "mpich"
+.if ${MPI_TYPE} == "native"
+.  if exists(${LOCALBASE}/bin/mpicc)
+PKG_FAIL_REASON+=      \
+       "MPI installed from pkgsrc conflicts with native. Deinstall ${_INST_MPI_PACKAGE}."
+.  endif
+.elif ${MPI_TYPE} == "mpich"
 _MPI_PACKAGE=  parallel/mpi-ch
 .elif ${MPI_TYPE} == "openmpi"
 _MPI_PACKAGE=  parallel/openmpi
@@ -32,8 +46,14 @@
 PKG_FAIL_REASON+=      \
        "${MPI_TYPE} is not an acceptable MPI type for ${PKGNAME}."
 .endif
+
+.if defined(_MPI_PACKAGE)
+.  if !defined(_INST_MPI_PACKAGE) || ${_INST_MPI_PACKAGE} == ${_MPI_PACKAGE}
+.include "../../${_MPI_PACKAGE}/buildlink3.mk"
+.  else
+PKG_FAIL_REASON+=      \
+       "Attempt to switch MPI type to ${MPI_TYPE} conflicting with installed ${_INST_MPI_PACKAGE}."
+.  endif
 .endif
 
-.include "../../${_MPI_PACKAGE}/buildlink3.mk"
-
 .endif # MPI_BUILDLINK3_MK



Home | Main Index | Thread Index | Old Index