From 53d2ffaf83556b2a89e48b9d8769f1226964c1d2 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Wed, 23 Aug 2023 19:48:44 -0400 Subject: Add amg2023 package; remove amg package (#39105) Add amg2023 package Consolidate existing amg and amg2013 packages (they reference the same code) under the amg2013 name to minimize confusion between amg2023 and amg2013. Co-authored-by: Riyaz Haque --- var/spack/repos/builtin/packages/amg/package.py | 58 --------------- .../repos/builtin/packages/amg2013/package.py | 40 +++++------ .../repos/builtin/packages/amg2023/package.py | 83 ++++++++++++++++++++++ .../builtin/packages/ecp-proxy-apps/package.py | 6 +- 4 files changed, 102 insertions(+), 85 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/amg/package.py create mode 100644 var/spack/repos/builtin/packages/amg2023/package.py diff --git a/var/spack/repos/builtin/packages/amg/package.py b/var/spack/repos/builtin/packages/amg/package.py deleted file mode 100644 index a0293523a9..0000000000 --- a/var/spack/repos/builtin/packages/amg/package.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack.package import * - - -class Amg(MakefilePackage): - """AMG is a parallel algebraic multigrid solver for linear systems arising - from problems on unstructured grids. The driver provided with AMG - builds linear systems for various 3-dimensional problems. - """ - - tags = ["proxy-app", "ecp-proxy-app"] - - homepage = "https://computing.llnl.gov/projects/co-design/amg2013" - git = "https://github.com/LLNL/AMG.git" - - version("develop", branch="master") - version("1.2", tag="1.2") - version("1.1", tag="1.1") - version("1.0", tag="1.0") - - variant("openmp", default=True, description="Build with OpenMP support") - variant("optflags", default=False, description="Additional optimizations") - variant("int64", default=False, description="Use 64-bit integers for global variables") - - depends_on("mpi") - - @property - def build_targets(self): - targets = [] - - include_cflags = ["-DTIMER_USE_MPI"] - include_lflags = ["-lm"] - - if "+openmp" in self.spec: - include_cflags.append("-DHYPRE_USING_OPENMP") - include_cflags.append(self.compiler.openmp_flag) - include_lflags.append(self.compiler.openmp_flag) - if "+optflags" in self.spec: - include_cflags.append("-DHYPRE_USING_PERSISTENT_COMM") - include_cflags.append("-DHYPRE_HOPSCOTCH") - - if "+int64" in self.spec: - include_cflags.append("-DHYPRE_BIGINT") - - targets.append("INCLUDE_CFLAGS={0}".format(" ".join(include_cflags))) - targets.append("INCLUDE_LFLAGS={0}".format(" ".join(include_lflags))) - targets.append("CC={0}".format(self.spec["mpi"].mpicc)) - - return targets - - def install(self, spec, prefix): - mkdirp(prefix.bin) - install("test/amg", prefix.bin) - install_tree("docs", prefix.docs) diff --git a/var/spack/repos/builtin/packages/amg2013/package.py b/var/spack/repos/builtin/packages/amg2013/package.py index c1bb45976e..9fd597ca56 100644 --- a/var/spack/repos/builtin/packages/amg2013/package.py +++ b/var/spack/repos/builtin/packages/amg2013/package.py @@ -7,29 +7,23 @@ from spack.package import * class Amg2013(MakefilePackage): - """AMG2013 is a parallel algebraic multigrid solver for linear - systems arising from problems on unstructured grids. - It has been derived directly from the BoomerAMG solver in the - hypre library, a large linear solver library that is being developed - in the Center for Applied Scientific Computing (CASC) at LLNL. + """AMG is a parallel algebraic multigrid solver for linear systems arising + from problems on unstructured grids. The driver provided with AMG + builds linear systems for various 3-dimensional problems. """ - tags = ["proxy-app"] + tags = ["proxy-app", "ecp-proxy-app"] + homepage = "https://computing.llnl.gov/projects/co-design/amg2013" - url = "https://computing.llnl.gov/projects/co-design/download/amg2013.tgz" + git = "https://github.com/LLNL/AMG.git" - version( - "master", - sha256="b03771d84a04e3dbbbe32ba5648cd7b789e5853b938dd501e17d23d43f13c50f", - url="https://computing.llnl.gov/projects/co-design/download/amg2013.tgz", - ) + version("develop", branch="master") + version("1.2", tag="1.2") + version("1.1", tag="1.1") + version("1.0", tag="1.0") variant("openmp", default=True, description="Build with OpenMP support") - variant( - "assumedpartition", - default=False, - description="Use assumed partition (for thousands of processors)", - ) + variant("optflags", default=False, description="Additional optimizations") variant("int64", default=False, description="Use 64-bit integers for global variables") depends_on("mpi") @@ -45,12 +39,12 @@ class Amg2013(MakefilePackage): include_cflags.append("-DHYPRE_USING_OPENMP") include_cflags.append(self.compiler.openmp_flag) include_lflags.append(self.compiler.openmp_flag) - - if "+assumedpartition" in self.spec: - include_cflags.append("-DHYPRE_NO_GLOBAL_PARTITION") + if "+optflags" in self.spec: + include_cflags.append("-DHYPRE_USING_PERSISTENT_COMM") + include_cflags.append("-DHYPRE_HOPSCOTCH") if "+int64" in self.spec: - include_cflags.append("-DHYPRE_LONG_LONG") + include_cflags.append("-DHYPRE_BIGINT") targets.append("INCLUDE_CFLAGS={0}".format(" ".join(include_cflags))) targets.append("INCLUDE_LFLAGS={0}".format(" ".join(include_lflags))) @@ -60,7 +54,5 @@ class Amg2013(MakefilePackage): def install(self, spec, prefix): mkdirp(prefix.bin) - install("test/amg2013", prefix.bin) + install("test/amg", prefix.bin) install_tree("docs", prefix.docs) - install("COPYRIGHT", prefix.docs) - install("COPYING.LESSER", prefix.docs) diff --git a/var/spack/repos/builtin/packages/amg2023/package.py b/var/spack/repos/builtin/packages/amg2023/package.py new file mode 100644 index 0000000000..67042f4d7a --- /dev/null +++ b/var/spack/repos/builtin/packages/amg2023/package.py @@ -0,0 +1,83 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Amg2023(MakefilePackage): + """AMG2023 is a parallel algebraic multigrid solver for linear systems + arising from problems on unstructured grids. The driver provided here + builds linear systems for various 3-dimensional problems. It requires + an installation of hypre-2.27.0 or higher. + """ + + tags = ["benchmark"] + homepage = "https://github.com/LLNL/AMG2023" + git = "https://github.com/LLNL/AMG2023.git" + + version("develop", branch="main") + + variant("mpi", default=True, description="Enable MPI support") + variant("openmp", default=False, description="Enable OpenMP support") + variant("caliper", default=False, description="Enable Caliper monitoring") + variant("adiak", default=False, description="Enable Adiak metadata gathering") + + depends_on("caliper", when="+caliper") + depends_on("adiak", when="+adiak") + depends_on("hypre+caliper", when="+caliper") + depends_on("hypre@2.27.0:") + depends_on("mpi", when="+mpi") + + def flag_handler(self, name, flags): + if name == "ldlibs": + if self.spec.satisfies("+caliper"): + flags.append("-lcaliper") + if self.spec.satisfies("+adiak"): + flags.append("-ladiak") + return (flags, None, None) + + def edit(self, spec, prefix): + makefile = FileFilter("Makefile") + if "+mpi" in spec: + makefile.filter(r"CC\s*=.*", f"CC = {spec['mpi'].mpicc}") + makefile.filter(r"CXX\s*=.*", f"CXX = {spec['mpi'].mpicxx}") + makefile.filter(r"#MPIPATH = .*", f"MPIPATH = {spec['mpi'].prefix}") + makefile.filter(r"#MPIINCLUDE", "MPIINCLUDE") + if spec["mpi"].extra_attributes and "ldflags" in spec["mpi"].extra_attributes: + makefile.filter( + "#MPILIBS = .*", + "MPILIBS = {0}".format(spec["mpi"].extra_attributes["ldflags"]), + ) + else: + makefile.filter("#MPILIBDIRS", "MPILIBDIRS") + makefile.filter("#MPILIBS", "MPILIBS") + makefile.filter("#MPIFLAGS", "MPIFLAGS") + else: + makefile.filter(r"CC\s*=.*", "CC = {0}".format(spack_cc)) + makefile.filter(r"CXX\s*=.*", "CXX = {0}".format(spack_cxx)) + + makefile.filter(r"HYPRE_DIR = .*", f'HYPRE_DIR = {spec["hypre"].prefix}') + + if spec["hypre"].satisfies("+cuda"): + makefile.filter( + "HYPRE_CUDA_PATH = .*", "HYPRE_CUDA_PATH = %s" % (spec["cuda"].prefix) + ) + makefile.filter("HYPRE_CUDA_INCLUDE = #", "HYPRE_CUDA_INCLUDE = ") + makefile.filter("HYPRE_CUDA_LIBS = #", "HYPRE_CUDA_LIBS = ") + makefile.filter("HYPRE_HIP_PATH =", "#HYPRE_HIP_PATH =") + makefile.filter("HYPRE_HIP_INCLUDE =", "#HYPRE_HIP_INCLUDE =") + makefile.filter("HYPRE_HIP_LIBS =", "#HYPRE_HIP_LIBS =") + + if spec["hypre"].satisfies("+rocm"): + makefile.filter("HYPRE_HIP_PATH = .*", "HYPRE_HIP_PATH = ${ROCM_PATH}") + else: + makefile.filter("HYPRE_HIP_PATH =", "#HYPRE_HIP_PATH =") + makefile.filter("HYPRE_HIP_INCLUDE =", "#HYPRE_HIP_INCLUDE =") + makefile.filter("HYPRE_HIP_LIBS =", "#HYPRE_HIP_LIBS =") + + def install(self, spec, prefix): + make() + mkdirp(prefix.bin) + install("amg", prefix.bin) diff --git a/var/spack/repos/builtin/packages/ecp-proxy-apps/package.py b/var/spack/repos/builtin/packages/ecp-proxy-apps/package.py index 20572b951a..1427e7a72f 100644 --- a/var/spack/repos/builtin/packages/ecp-proxy-apps/package.py +++ b/var/spack/repos/builtin/packages/ecp-proxy-apps/package.py @@ -43,7 +43,7 @@ class EcpProxyApps(BundlePackage): depends_on("laghos@3.0", when="@3.0:") # Added with release 2.1 - depends_on("amg@1.2", when="@2.1:") + depends_on("amg2013@1.2", when="@2.1:") depends_on("miniamr@1.4.3", when="@2.1") # Added with release 2.0 @@ -60,7 +60,7 @@ class EcpProxyApps(BundlePackage): depends_on("xsbench@18", when="@2.0:2.1") # Dependencies for version 2.0 - depends_on("amg@1.1", when="@2.0") + depends_on("amg2013@1.1", when="@2.0") depends_on("miniamr@1.4.1", when="@2.0:2.1") # Added with release 1.1 @@ -70,7 +70,7 @@ class EcpProxyApps(BundlePackage): depends_on("swfft@1.0", when="@1.0:") # Dependencies for versions 1.0:1.1 - depends_on("amg@1.0", when="@1.0:1.1") + depends_on("amg2013@1.0", when="@1.0:1.1") depends_on("candle-benchmarks@0.0", when="+candle @1.0:1.1") depends_on("laghos@1.0", when="@1.0:1.1") depends_on("macsio@1.0", when="@1.0:1.1") -- cgit v1.2.3-70-g09d2