Kokkos Kernels: adding missing TPLs and pre-conditions (#43043)

* Kokkos Kernels: adding missing TPLs and pre-conditions
  Adding variants and dependencies for rocBLAS and rocSPARSE.
  Also adding a "when=" close to the TPL variants that prevents
  enabling the TPLs in versions of the library when it was not
  yet available.
* Kokkos Kernels: remove comment for better format
* Kokkos Kernels: fix issue with unpacking wrong number of args
  After changing the tpls dictionary we need to update the unpacking
  logic to catch the right number of outputs out of it!
* Kokkos Kernels: updating doc string for tpls var and using f-string
  Improving comment a bit and switching to f-string for more readability.
  When setup to do more testing will try to use f-string in the CMake
  options generation part of the package.
* Style change
This commit is contained in:
Luc Berger 2024-03-07 10:00:10 -07:00 committed by GitHub
parent ac48ecd375
commit e3cb3b29d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,20 +135,22 @@ class KokkosKernels(CMakePackage, CudaPackage):
variant(eti, default=deflt, description=eti, values=vals, multi=True)
tpls = {
# variant name #deflt #spack name #root var name #docstring
"blas": (False, "blas", "BLAS", "Link to system BLAS"),
"lapack": (False, "lapack", "LAPACK", "Link to system LAPACK"),
"mkl": (False, "mkl", "MKL", "Link to system MKL"),
"cublas": (False, "cuda", None, "Link to CUDA BLAS library"),
"cusparse": (False, "cuda", None, "Link to CUDA sparse library"),
"superlu": (False, "superlu", "SUPERLU", "Link to SuperLU library"),
"cblas": (False, "cblas", "CBLAS", "Link to CBLAS library"),
"lapacke": (False, "clapack", "LAPACKE", "Link to LAPACKE library"),
# variant name #deflt #spack name #root var name #supporting versions #docstring
"blas": (False, "blas", "BLAS", "@3.0.00:", "Link to system BLAS"),
"lapack": (False, "lapack", "LAPACK", "@3.0.00:", "Link to system LAPACK"),
"mkl": (False, "mkl", "MKL", "@3.0.00:", "Link to system MKL"),
"cublas": (False, "cuda", None, "@3.0.00:", "Link to CUDA BLAS library"),
"cusparse": (False, "cuda", None, "@3.0.00:", "Link to CUDA sparse library"),
"superlu": (False, "superlu", "SUPERLU", "@3.1.00:", "Link to SuperLU library"),
"cblas": (False, "cblas", "CBLAS", "@3.1.00:", "Link to CBLAS library"),
"lapacke": (False, "clapack", "LAPACKE", "@3.1.00:", "Link to LAPACKE library"),
"rocblas": (False, "rocblas", "ROCBLAS", "@3.6.00:", "Link to AMD BLAS library"),
"rocsparse": (False, "rocsparse", "ROCSPARSE", "@3.6.00:", "Link to AMD sparse library"),
}
for tpl in tpls:
deflt_bool, spackname, rootname, descr = tpls[tpl]
variant(tpl, default=deflt_bool, description=descr)
deflt_bool, spackname, rootname, condition, descr = tpls[tpl]
variant(tpl, default=deflt_bool, when=f"{condition}", description=descr)
depends_on(spackname, when="+%s" % tpl)
variant("shared", default=True, description="Build shared libraries")
@ -174,7 +176,7 @@ def cmake_args(self):
for tpl in self.tpls:
on_flag = "+%s" % tpl
off_flag = "~%s" % tpl
dflt, spackname, rootname, descr = self.tpls[tpl]
dflt, spackname, rootname, condition, descr = self.tpls[tpl]
if on_flag in self.spec:
options.append("-DKokkosKernels_ENABLE_TPL_%s=ON" % tpl.upper())
if rootname: