diff options
author | Alex Richert <alexander.richert@noaa.gov> | 2024-04-04 10:48:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 12:48:39 -0500 |
commit | 3fed320013583a7301ca68ee8cb68d7e3d4ba12a (patch) | |
tree | 76d2bcadf58bbc9d89dd7efc046b5d2b4191b705 | |
parent | 1aa77e695d653fec30a6b6b50c09fffd481b59b2 (diff) | |
download | spack-3fed320013583a7301ca68ee8cb68d7e3d4ba12a.tar.gz spack-3fed320013583a7301ca68ee8cb68d7e3d4ba12a.tar.bz2 spack-3fed320013583a7301ca68ee8cb68d7e3d4ba12a.tar.xz spack-3fed320013583a7301ca68ee8cb68d7e3d4ba12a.zip |
Add MPI and arch bugfixes to SCOTCH (#39264)
* Add MPI and arch bugfixes to SCOTCH
* Update scotch/package.py
-rw-r--r-- | var/spack/repos/builtin/packages/scotch/package.py | 14 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/scotch/parmetis-mpi.patch | 127 |
2 files changed, 140 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py index 124426d1a0..fbc5ddbeb6 100644 --- a/var/spack/repos/builtin/packages/scotch/package.py +++ b/var/spack/repos/builtin/packages/scotch/package.py @@ -39,7 +39,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=False, description="use multi-threaded algorithms") + variant( + "mpi_thread", + default=False, + 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)") @@ -48,6 +52,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, @@ -69,6 +74,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 +metis ^openmpi") + # Vendored dependency of METIS/ParMETIS conflicts with standard # installations conflicts("metis", when="+metis") @@ -127,6 +135,10 @@ class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): 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 0000000000..23190ad584 --- /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 */ |