tech-pkg archive

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

[new patch] Re: Allow 'native' option to mk/mpi.buildlink3.mk to use the system's MPI implementation



Hi,

here is an updated version of the patch after some comments by wiz.

It now detects settings that are inconsistent and would break things
later.

Any further comments? Fine to commit?


Alrighty then,

Thomas

-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg
Index: mk/mpi.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/mpi.buildlink3.mk,v
retrieving revision 1.5
diff -u -r1.5 mpi.buildlink3.mk
--- mk/mpi.buildlink3.mk	2 Sep 2019 02:23:02 -0000	1.5
+++ mk/mpi.buildlink3.mk	11 May 2021 14:55:27 -0000
@@ -2,14 +2,23 @@
 #
 # 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
-.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
 
 .endif	# MPI_BUILDLINK3_MK


Home | Main Index | Thread Index | Old Index