From 9aed13adb93cfc2f3bcf68a7bf9d4b61e9a4483e Mon Sep 17 00:00:00 2001 From: Alberto Invernizzi <9337627+albestro@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:01:11 +0100 Subject: [PATCH] nvpl-blas and nvpl-lapack: new packages for NVidia performance libraries (#41775) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Raffaele SolcĂ  --- .../builtin/packages/nvpl-blas/package.py | 69 +++++++++++++++++++ .../builtin/packages/nvpl-lapack/package.py | 69 +++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 var/spack/repos/builtin/packages/nvpl-blas/package.py create mode 100644 var/spack/repos/builtin/packages/nvpl-lapack/package.py diff --git a/var/spack/repos/builtin/packages/nvpl-blas/package.py b/var/spack/repos/builtin/packages/nvpl-blas/package.py new file mode 100644 index 0000000000..211717d2bb --- /dev/null +++ b/var/spack/repos/builtin/packages/nvpl-blas/package.py @@ -0,0 +1,69 @@ +# Copyright 2013-2024 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 NvplBlas(Package): + """ + NVPL BLAS (NVIDIA Performance Libraries BLAS) is part of NVIDIA Performance Libraries + that provides standard Fortran 77 BLAS APIs as well as C (CBLAS). + """ + + homepage = "https://docs.nvidia.com/nvpl/_static/blas/index.html" + url = ( + "https://developer.download.nvidia.com/compute/nvpl/redist" + "/nvpl_blas/linux-sbsa/nvpl_blas-linux-sbsa-0.1.0-archive.tar.xz" + ) + + maintainers("albestro", "rasolca") + + license("UNKNOWN") + + version("0.1.0", sha256="4ccc894593cbcbfaa1a4f3c54505982691971667acf191c9ab0f4252a37c8063") + + provides("blas") + + variant("ilp64", default=False, description="Force 64-bit Fortran native integers") + variant( + "threads", + default="none", + description="Multithreading support", + values=("openmp", "none"), + multi=False, + ) + + requires("target=armv8.2a:", msg="Any CPU with Arm-v8.2a+ microarch") + + conflicts("%gcc@:7") + conflicts("%clang@:13") + + conflicts("threads=openmp", when="%clang") + + @property + def blas_headers(self): + return find_all_headers(self.spec.prefix.include) + + @property + def blas_libs(self): + spec = self.spec + + if "+ilp64" in spec: + int_type = "ilp64" + else: + int_type = "lp64" + + if spec.satisfies("threads=openmp"): + threading_type = "gomp" + else: + # threads=none + threading_type = "seq" + + name = ["libnvpl_blas_core", f"libnvpl_blas_{int_type}_{threading_type}"] + + return find_libraries(name, spec.prefix.lib, shared=True, recursive=True) + + def install(self, spec, prefix): + install_tree(".", prefix) diff --git a/var/spack/repos/builtin/packages/nvpl-lapack/package.py b/var/spack/repos/builtin/packages/nvpl-lapack/package.py new file mode 100644 index 0000000000..3a2aa064e8 --- /dev/null +++ b/var/spack/repos/builtin/packages/nvpl-lapack/package.py @@ -0,0 +1,69 @@ +# Copyright 2013-2024 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 NvplLapack(Package): + """ + NVPL LAPACK (NVIDIA Performance Libraries LAPACK) is part of NVIDIA Performance Libraries + that provides standard Fortran 90 LAPACK APIs. + """ + + homepage = "https://docs.nvidia.com/nvpl/_static/lapack/index.html" + url = ( + "https://developer.download.nvidia.com/compute/nvpl/redist" + "/nvpl_lapack/linux-sbsa/nvpl_lapack-linux-sbsa-0.2.0.1-archive.tar.xz" + ) + + maintainers("albestro", "rasolca") + + license("UNKNOWN") + + version("0.1.0", sha256="7054f775b18916ee662c94ad7682ace53debbe8ee36fa926000fe412961edb0b") + + provides("lapack") + + variant("ilp64", default=False, description="Force 64-bit Fortran native integers") + variant( + "threads", + default="none", + description="Multithreading support", + values=("openmp", "none"), + multi=False, + ) + + requires("target=armv8.2a:", msg="Any CPU with Arm-v8.2a+ microarch") + + conflicts("%gcc@:7") + conflicts("%clang@:13") + + conflicts("threads=openmp", when="%clang") + + @property + def lapack_headers(self): + return find_all_headers(self.spec.prefix.include) + + @property + def lapack_libs(self): + spec = self.spec + + if "+ilp64" in spec: + int_type = "ilp64" + else: + int_type = "lp64" + + if spec.satisfies("threads=openmp"): + threading_type = "gomp" + else: + # threads=none + threading_type = "seq" + + name = ["libnvpl_lapack_core", f"libnvpl_lapack_{int_type}_{threading_type}"] + + return find_libraries(name, spec.prefix.lib, shared=True, recursive=True) + + def install(self, spec, prefix): + install_tree(".", prefix)