From 8bbc2e2ade73c206944fc2952c538a9eaa392eee Mon Sep 17 00:00:00 2001 From: Cameron Rutherford Date: Fri, 1 Dec 2023 21:49:11 -0500 Subject: resolve: add package with cuda and rocm support (#40871) --- .../repos/builtin/packages/resolve/package.py | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 var/spack/repos/builtin/packages/resolve/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/resolve/package.py b/var/spack/repos/builtin/packages/resolve/package.py new file mode 100644 index 0000000000..4a68f9f584 --- /dev/null +++ b/var/spack/repos/builtin/packages/resolve/package.py @@ -0,0 +1,62 @@ +# 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 Resolve(CMakePackage, CudaPackage, ROCmPackage): + """ReSolve is a library of GPU-resident sparse linear solvers. It contains iterative and direct + solvers designed to run on NVIDIA and AMD GPUs, as well as CPU devices.""" + + homepage = "https://github.com/ORNL/ReSolve" + git = "https://github.com/ORNL/ReSolve.git" + + maintainers("cameronrutherford", "pelesh", "ryandanehy", "kswirydo") + + # version("1.0.0", submodules=False, branch="develop") + version("develop", submodules=False, branch="develop") + + variant("klu", default=True, description="Use KLU, AMD and COLAMD Libraries from SuiteSparse") + + depends_on("suite-sparse", when="+klu") + + with when("+rocm"): + # Need at least 5.6+ + depends_on("rocsparse@5.6:") + depends_on("rocblas@5.6:") + depends_on("rocsolver@5.6:") + + # Optional profiling dependecies + # Will be controlled by variant in the future + # depends_on("roctracer-dev@5.6:") + # depends_on("roctracer-dev-api@5.6:") + # depends_on("rocprofiler-dev@5.6:") + + def cmake_args(self): + args = [] + spec = self.spec + + args.extend( + [self.define("RESOLVE_USE_KLU", "klu"), self.define("RESOLVE_TEST_WITH_BSUB", False)] + ) + + if "+cuda" in spec: + cuda_arch_list = spec.variants["cuda_arch"].value + if cuda_arch_list[0] != "none": + args.append(self.define("CMAKE_CUDA_ARCHITECTURES", cuda_arch_list)) + else: + args.append(self.define("CMAKE_CUDA_ARCHITECTURES", "70;75;80")) + args.append(self.define("RESOLVE_USE_CUDA", True)) + + elif "+rocm" in spec: + rocm_arch_list = spec.variants["amdgpu_target"].value + # `+rocm` conflicts with amdgpu_target == "none"... + # if rocm_arch_list[0] == "none": + # rocm_arch_list = "gfx90a" + args.append(self.define("GPU_TARGETS", rocm_arch_list)) + args.append(self.define("AMDGPU_TARGETS", rocm_arch_list)) + args.append(self.define("RESOLVE_USE_HIP", True)) + + return args -- cgit v1.2.3-60-g2f50