forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: add package with cuda and rocm support (spack#40871)
- Loading branch information
Cameron Rutherford
authored
Dec 2, 2023
1 parent
1509e54
commit 8bbc2e2
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("[email protected]:") | ||
depends_on("[email protected]:") | ||
depends_on("[email protected]:") | ||
|
||
# Optional profiling dependecies | ||
# Will be controlled by variant in the future | ||
# depends_on("[email protected]:") | ||
# depends_on("[email protected]:") | ||
# depends_on("[email protected]:") | ||
|
||
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 |