From 01d6aa5239a8f46862d0f35a9f3533afdb9151a2 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 14 Jul 2023 11:08:18 -0600 Subject: [PATCH] Merge release/1.4.1 into jcsda_emc_spack_stack (#296) * add noarch variant to scotch to disable SPACK_TARGET_ARGS * Update bufr package.py for v12.0.0 * remove debug line * Add eckit@1.23.1 * Add MPI (MPI_Fint/mpi_comm_f2c) patch to scotch/parmetis * add comment for parmetis mpi patch * Fix style errors in eckit and scotch * Trigger CI --------- Co-authored-by: Alex Richert Co-authored-by: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> --- .../repos/builtin/packages/eckit/package.py | 10 +- .../repos/builtin/packages/scotch/package.py | 16 ++- .../packages/scotch/parmetis-mpi.patch | 127 ++++++++++++++++++ 3 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 var/spack/repos/builtin/packages/scotch/parmetis-mpi.patch diff --git a/var/spack/repos/builtin/packages/eckit/package.py b/var/spack/repos/builtin/packages/eckit/package.py index 1d0b779e25211b..13737b77f5db40 100644 --- a/var/spack/repos/builtin/packages/eckit/package.py +++ b/var/spack/repos/builtin/packages/eckit/package.py @@ -18,6 +18,7 @@ class Eckit(CMakePackage): maintainers("skosukhin", "climbfuji") + version("1.23.1", sha256="cd3c4b7a3a2de0f4a59f00f7bab3178dd59c0e27900d48eaeb357975e8ce2f15") version("1.23.0", sha256="3cac55ddf7036ecd32cb0974a1ec3a2d347de574ab3a2c0bb6c6f8982e5a7a09") version("1.22.1", sha256="a3463d07e47e3bd3e5efa13fdc03d7d3a30ada919ccec3259c6c9c7da4cfdfd9") version("1.20.2", sha256="9c11ddaaf346e40d11312b81ca7f1b510017f26618f4c0f5c5c59c37623fbac8") @@ -25,9 +26,12 @@ class Eckit(CMakePackage): version("1.16.3", sha256="d2aae7d8030e2ce39e5d04e36dd6aa739f3c8dfffe32c61c2a3127c36b573485") version("1.16.0", sha256="9e09161ea6955df693d3c9ac70131985eaf7cf24a9fa4d6263661c6814ebbaf1") - variant("build_type", default="RelWithDebInfo", - description="CMake build type", - values=("Debug", "Release", "RelWithDebInfo")) + variant( + "build_type", + default="RelWithDebInfo", + description="CMake build type", + values=("Debug", "Release", "RelWithDebInfo"), + ) variant("shared", default=True, description="Build shared libraries") variant("tools", default=True, description="Build the command line tools") diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py index a83d0919f258ab..5bd1184415930c 100644 --- a/var/spack/repos/builtin/packages/scotch/package.py +++ b/var/spack/repos/builtin/packages/scotch/package.py @@ -38,7 +38,11 @@ class Scotch(CMakePackage, MakefilePackage): build_system(conditional("cmake", when="@7:"), "makefile", default="cmake") variant("threads", default=True, description="use POSIX Pthreads within Scotch and PT-Scotch") - variant("mpi_thread", default=True, description="use multi-threaded algorithms in conjunction with MPI") + variant( + "mpi_thread", + default=True, + description="use multi-threaded algorithms in conjunction with MPI", + ) variant("mpi", default=True, description="Compile parallel libraries") variant("compression", default=True, description="May use compressed files") variant("esmumps", default=False, description="Compile esmumps (needed by mumps)") @@ -47,6 +51,7 @@ class Scotch(CMakePackage, MakefilePackage): "metis", default=False, description="Expose vendored METIS/ParMETIS libraries and wrappers" ) variant("int64", default=False, description="Use int64_t for SCOTCH_Num typedef") + variant("noarch", default=False, description="Unset SPACK_TARGET_ARGS") variant( "link_error_lib", default=False, @@ -68,6 +73,9 @@ class Scotch(CMakePackage, MakefilePackage): patch("libscotchmetis-return-6.0.5a.patch", when="@6.0.5a") patch("libscotch-scotcherr-link-7.0.1.patch", when="@7.0.1 +link_error_lib") + # Avoid OpenMPI segfaults by using MPI_Comm_F2C for parmetis communicator + patch("parmetis-mpi.patch", when="@6.1.1:7.0.3 ^openmpi") + # Vendored dependency of METIS/ParMETIS conflicts with standard # installations conflicts("^metis", when="+metis") @@ -118,7 +126,7 @@ def cmake_args(self): self.define_from_variant("BUILD_SHARED_LIBS", "shared"), self.define_from_variant("BUILD_PTSCOTCH", "mpi"), self.define_from_variant("THREADS", "threads"), - self.define_from_variant("MPI_THREAD_MULTIPLE", "mpi_thread") + self.define_from_variant("MPI_THREAD_MULTIPLE", "mpi_thread"), ] # TODO should we enable/disable THREADS? @@ -128,6 +136,10 @@ def cmake_args(self): return args + @when("+noarch") + def setup_build_environment(self, env): + env.unset("SPACK_TARGET_ARGS") + class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder): build_directory = "src" diff --git a/var/spack/repos/builtin/packages/scotch/parmetis-mpi.patch b/var/spack/repos/builtin/packages/scotch/parmetis-mpi.patch new file mode 100644 index 00000000000000..23190ad584f640 --- /dev/null +++ b/var/spack/repos/builtin/packages/scotch/parmetis-mpi.patch @@ -0,0 +1,127 @@ +diff --git a/src/libscotchmetis/parmetis_dgraph_order_f.c b/src/libscotchmetis/parmetis_dgraph_order_f.c +index 44c2ede..549a834 100644 +--- a/src/libscotchmetis/parmetis_dgraph_order_f.c ++++ b/src/libscotchmetis/parmetis_dgraph_order_f.c +@@ -46,7 +46,7 @@ + /** # Version 6.0 : from : 13 sep 2012 **/ + /** to : 18 may 2019 **/ + /** # Version 7.0 : from : 21 jan 2023 **/ +-/** to : 21 jan 2023 **/ ++/** to : 30 jun 2023 **/ + /** **/ + /************************************************************/ + +@@ -76,11 +76,14 @@ const SCOTCH_Num * const numflag, \ + const SCOTCH_Num * const options, \ + SCOTCH_Num * const order, \ + SCOTCH_Num * const sizes, \ +-MPI_Comm * const commptr, \ ++const MPI_Fint * const commptr, \ + int * const revaptr), \ + (vtxdist, xadj, adjncy, numflag, options, order, sizes, commptr, revaptr)) + { +- *revaptr = SCOTCH_ParMETIS_V3_NodeND (vtxdist, xadj, adjncy, numflag, options, order, sizes, commptr); ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); ++ *revaptr = SCOTCH_ParMETIS_V3_NodeND (vtxdist, xadj, adjncy, numflag, options, order, sizes, &commdat); + } + + /*******************/ +@@ -101,10 +104,13 @@ const SCOTCH_Num * const numflag, \ + const SCOTCH_Num * const options, \ + SCOTCH_Num * const order, \ + SCOTCH_Num * const sizes, \ +-MPI_Comm * const commptr), \ ++const MPI_Fint * const commptr), \ + (vtxdist, xadj, adjncy, numflag, options, order, sizes, commptr)) + { +- METISNAMEU (ParMETIS_V3_NodeND) (vtxdist, xadj, adjncy, numflag, options, order, sizes, commptr); ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); ++ METISNAMEU (ParMETIS_V3_NodeND) (vtxdist, xadj, adjncy, numflag, options, order, sizes, &commdat); + } + + #endif /* SCOTCH_METIS_PREFIX */ +diff --git a/src/libscotchmetis/parmetis_dgraph_part_f.c b/src/libscotchmetis/parmetis_dgraph_part_f.c +index 2b76818..3bf66af 100644 +--- a/src/libscotchmetis/parmetis_dgraph_part_f.c ++++ b/src/libscotchmetis/parmetis_dgraph_part_f.c +@@ -44,7 +44,7 @@ + /** # Version 6.0 : from : 13 sep 2012 **/ + /** to : 18 may 2019 **/ + /** # Version 7.0 : from : 21 jan 2023 **/ +-/** to : 21 jan 2023 **/ ++/** to : 30 jun 2023 **/ + /** **/ + /************************************************************/ + +@@ -81,12 +81,15 @@ const float * const ubvec, \ + const SCOTCH_Num * const options, \ + SCOTCH_Num * const edgecut, \ + SCOTCH_Num * const part, \ +-MPI_Comm * const commptr, \ ++const MPI_Fint * const commptr, \ + int * const revaptr), \ + (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr, revaptr)) + { ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); + *revaptr = SCOTCH_ParMETIS_V3_PartKway (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, +- ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr); ++ ncon, nparts, tpwgts, ubvec, options, edgecut, part, &commdat); + } + + /* +@@ -111,12 +114,15 @@ const float * const ubvec, \ + const SCOTCH_Num * const options, \ + SCOTCH_Num * const edgecut, \ + SCOTCH_Num * const part, \ +-MPI_Comm * const commptr, \ ++const MPI_Fint * const commptr, \ + int * const revaptr), \ + (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr, revaptr)) + { ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); + *revaptr = SCOTCH_ParMETIS_V3_PartGeomKway (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, +- ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr); ++ ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, &commdat); + } + + /*******************/ +@@ -144,10 +150,13 @@ const float * const ubvec, \ + const SCOTCH_Num * const options, \ + SCOTCH_Num * const edgecut, \ + SCOTCH_Num * const part, \ +-MPI_Comm * const commptr), \ ++const MPI_Fint * const commptr), \ + (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr)) + { +- METISNAMEU (ParMETIS_V3_PartKway) (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr); ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); ++ METISNAMEU (ParMETIS_V3_PartKway) (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ncon, nparts, tpwgts, ubvec, options, edgecut, part, &commdat); + } + + /* +@@ -172,10 +181,13 @@ const float * const ubvec, + const SCOTCH_Num * const options, \ + SCOTCH_Num * const edgecut, \ + SCOTCH_Num * const part, \ +-MPI_Comm * const commptr), \ ++const MPI_Fint * const commptr), \ + (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr)) + { +- METISNAMEU (ParMETIS_V3_PartGeomKway) (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, commptr); ++ MPI_Comm commdat; ++ ++ commdat = MPI_Comm_f2c (*commptr); ++ METISNAMEU (ParMETIS_V3_PartGeomKway) (vtxdist, xadj, adjncy, vwgt, adjwgt, wgtflag, numflag, ndims, xyz, ncon, nparts, tpwgts, ubvec, options, edgecut, part, &commdat); + } + + #endif /* SCOTCH_METIS_PREFIX */