summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorG-Ragghianti <33492707+G-Ragghianti@users.noreply.github.com>2021-05-05 11:16:15 -0400
committerGitHub <noreply@github.com>2021-05-05 08:16:15 -0700
commita45cb952b78398514a30ea48f8973f6980d17da2 (patch)
tree06672718011d30f702e61241dbf4115adc7a7b89
parent4f7bd11d61b67666bf11a827650900666f920672 (diff)
downloadspack-a45cb952b78398514a30ea48f8973f6980d17da2.tar.gz
spack-a45cb952b78398514a30ea48f8973f6980d17da2.tar.bz2
spack-a45cb952b78398514a30ea48f8973f6980d17da2.tar.xz
spack-a45cb952b78398514a30ea48f8973f6980d17da2.zip
Packages: BLAS++ and LAPACK++ (#23372)
* Adding hip support * Added new blaspp version and rocm support. Fixed error in mesa18 package. * Correcting variant name. * Code style fixes * Change of name of library * Change "make check" to correctly run from the build directory. * Upgraded version to fix testing errors * Fixed testing directory * Removed unnecessary variant entry (already inherited from CudaPackage) * Generalization of version matching logic * Code style * Corrected version requirement
-rw-r--r--var/spack/repos/builtin/packages/blaspp/package.py27
-rw-r--r--var/spack/repos/builtin/packages/lapackpp/package.py22
2 files changed, 37 insertions, 12 deletions
diff --git a/var/spack/repos/builtin/packages/blaspp/package.py b/var/spack/repos/builtin/packages/blaspp/package.py
index 5361013681..1013a954a0 100644
--- a/var/spack/repos/builtin/packages/blaspp/package.py
+++ b/var/spack/repos/builtin/packages/blaspp/package.py
@@ -7,7 +7,7 @@ from spack import *
import os
-class Blaspp(CMakePackage, CudaPackage):
+class Blaspp(CMakePackage, CudaPackage, ROCmPackage):
"""C++ API for the Basic Linear Algebra Subroutines. Developed by the
Innovative Computing Laboratory at the University of Tennessee,
Knoxville."""
@@ -18,39 +18,52 @@ class Blaspp(CMakePackage, CudaPackage):
maintainers = ['teonnik', 'Sely85', 'G-Ragghianti', 'mgates3']
version('master', branch='master')
+ version('2021.04.01', sha256='11fc7b7e725086532ada58c0de53f30e480c2a06f1497b8081ea6d8f97e26150')
version('2020.10.02', sha256='36e45bb5a8793ba5d7bc7c34fc263f91f92b0946634682937041221a6bf1a150')
version('2020.10.01', sha256='1a05dbc46caf797d59a7c189216b876fdb1b2ff3e2eb48f1e6ca4b2756c59153')
version('2020.10.00', sha256='ce148cfe397428d507c72d7d9eba5e9d3f55ad4cd842e6e873c670183dcb7795')
variant('openmp', default=True, description='Use OpenMP internally.')
- variant('cuda', default=False, description='Build with CUDA')
variant('shared', default=True, description='Build shared libraries')
depends_on('cmake@3.15.0:', type='build')
depends_on('blas')
depends_on('llvm-openmp', when='%apple-clang +openmp')
+ depends_on('rocblas', when='+rocm')
# only supported with clingo solver: virtual dependency preferences
# depends_on('openblas threads=openmp', when='+openmp ^openblas')
- # BLASpp tests will fail when using openblas > 0.3.5 without multithreading support
+ # BLAS++ tests will fail when using openblas > 0.3.5 without multithreading support
# locking is only supported in openblas 3.7+
- conflicts('^openblas@0.3.6 threads=none', msg='BLASpp requires a threadsafe openblas')
- conflicts('^openblas@0.3.7: ~locking', msg='BLASpp requires a threadsafe openblas')
+ conflicts('^openblas@0.3.6 threads=none', msg='BLAS++ requires a threadsafe openblas')
+ conflicts('^openblas@0.3.7: ~locking', msg='BLAS++ requires a threadsafe openblas')
+
+ conflicts('+rocm', when='@:2020.10.02', msg='ROCm support requires BLAS++ 2021.04.00 or greater')
+ conflicts('+rocm', when='+cuda', msg='BLAS++ can only support one GPU backend at a time')
def cmake_args(self):
spec = self.spec
+ backend_config = '-Duse_cuda=%s' % ('+cuda' in spec)
+ if self.version >= Version('2021.04.01'):
+ backend = 'none'
+ if '+cuda' in spec:
+ backend = 'cuda'
+ if '+rocm' in spec:
+ backend = 'hip'
+ backend_config = '-Dgpu_backend=%s' % backend
return [
'-Dbuild_tests=%s' % self.run_tests,
'-Duse_openmp=%s' % ('+openmp' in spec),
'-DBUILD_SHARED_LIBS=%s' % ('+shared' in spec),
- '-Duse_cuda=%s' % ('+cuda' in spec),
+ backend_config,
'-DBLAS_LIBRARIES=%s' % spec['blas'].libs.joined(';')
]
def check(self):
# If the tester fails to build, ensure that the check() fails.
if os.path.isfile(join_path(self.build_directory, 'test', 'tester')):
- make('check')
+ with working_dir(self.build_directory):
+ make('check')
else:
raise Exception('The tester was not built!')
diff --git a/var/spack/repos/builtin/packages/lapackpp/package.py b/var/spack/repos/builtin/packages/lapackpp/package.py
index 87116837f0..155ee379ab 100644
--- a/var/spack/repos/builtin/packages/lapackpp/package.py
+++ b/var/spack/repos/builtin/packages/lapackpp/package.py
@@ -6,6 +6,16 @@
from spack import *
import os
+# Each LAPACK++ version requires a specific BLAS++ version
+_versions = [
+ # LAPACK++, BLAS++
+ ['master', 'master'],
+ ['2020.10.00', '2020.10.00'],
+ ['2020.10.01', '2020.10.01'],
+ ['2020.10.02', '2020.10.02'],
+ ['2021.04.00', '2021.04.01:'], # or later
+]
+
class Lapackpp(CMakePackage):
"""LAPACK++: C++ API for the LAPACK Linear Algebra Package. Developed
@@ -18,16 +28,17 @@ class Lapackpp(CMakePackage):
maintainers = ['teonnik', 'Sely85', 'G-Ragghianti', 'mgates3']
version('master', branch='master')
+ version('2021.04.00', sha256='67abd8de9757dba86eb5d154cdb91f176b6c8b2b7d8e2a669ba0c221c4bb60ed')
version('2020.10.02', sha256='8dde9b95d75b494c4f8b893d68034e95b7a7541981359acb97b6c1c4a9c45cd9')
version('2020.10.01', sha256='ecd659730b4c3cfb8d2595f9bbb6af65d96b79397db654f17fe045bdfea841c0')
version('2020.10.00', sha256='5f6ab3bd3794711818a3a50198efd29571520bf455e13ffa8ba50fa8376d7d1a')
variant('shared', default=True, description='Build shared library')
- # Needs to compile against a matching blaspp version
- depends_on('blaspp')
- for ver in ['master', '2020.10.02', '2020.10.01', '2020.10.00']:
- depends_on('blaspp@' + ver, when='@' + ver)
+ # Match each LAPACK++ version to a specific BLAS++ version
+ for (lpp_ver, bpp_ver) in _versions:
+ depends_on('blaspp@' + bpp_ver, when='@' + lpp_ver)
+
depends_on('blas')
depends_on('lapack')
@@ -42,6 +53,7 @@ class Lapackpp(CMakePackage):
def check(self):
# If the tester fails to build, ensure that the check() fails.
if os.path.isfile(join_path(self.build_directory, 'test', 'tester')):
- make('check')
+ with working_dir(self.build_directory):
+ make('check')
else:
raise Exception('The tester was not built!')