SuperLU-Dist: Add CUDA variant (#19847)

* Add CUDA support to superlu-dist

* Use spec['cuda'].libs.directories[0] iso spec['cuda'].prefix.lib
so it works for both lib and lib64

The suggested:
args.append('-DTPL_CUDA_LIBRARIES=' +
            spec['cuda'].libs.ld_flags)
did not work because it does not link with cuBLAS.
This commit is contained in:
Pieter Ghysels 2020-11-12 06:57:44 -08:00 committed by GitHub
parent 821b195ba4
commit d1493fb3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@
from spack import * from spack import *
class SuperluDist(CMakePackage): class SuperluDist(CMakePackage, CudaPackage):
"""A general purpose library for the direct solution of large, sparse, """A general purpose library for the direct solution of large, sparse,
nonsymmetric systems of linear equations on high performance machines.""" nonsymmetric systems of linear equations on high performance machines."""
@ -14,7 +14,7 @@ class SuperluDist(CMakePackage):
url = "https://github.com/xiaoyeli/superlu_dist/archive/v6.0.0.tar.gz" url = "https://github.com/xiaoyeli/superlu_dist/archive/v6.0.0.tar.gz"
git = "https://github.com/xiaoyeli/superlu_dist.git" git = "https://github.com/xiaoyeli/superlu_dist.git"
maintainers = ['xiaoye', 'gchavez2', 'balay'] maintainers = ['xiaoye', 'gchavez2', 'balay', 'pghysels']
version('develop', branch='master') version('develop', branch='master')
version('xsdk-0.2.0', tag='xsdk-0.2.0') version('xsdk-0.2.0', tag='xsdk-0.2.0')
@ -44,6 +44,8 @@ class SuperluDist(CMakePackage):
depends_on('parmetis') depends_on('parmetis')
depends_on('metis@5:') depends_on('metis@5:')
conflicts('+cuda', when='@:6.3.999')
patch('xl-611.patch', when='@:6.1.1 %xl') patch('xl-611.patch', when='@:6.1.1 %xl')
patch('xl-611.patch', when='@:6.1.1 %xl_r') patch('xl-611.patch', when='@:6.1.1 %xl_r')
@ -78,6 +80,15 @@ def cmake_args(self):
args.append('-Denable_openmp=OFF') args.append('-Denable_openmp=OFF')
args.append('-DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=ON') args.append('-DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=ON')
if '+cuda' in spec:
args.append('-DTPL_ENABLE_CUDALIB=TRUE')
args.append('-DTPL_CUDA_LIBRARIES=-L%s -lcublas -lcudart'
% spec['cuda'].libs.directories[0])
cuda_arch = spec.variants['cuda_arch'].value
if cuda_arch[0] != 'none':
args.append(
'-DCMAKE_CUDA_FLAGS=-arch=sm_{0}'.format(cuda_arch[0]))
if '+shared' in spec: if '+shared' in spec:
args.append('-DBUILD_SHARED_LIBS:BOOL=ON') args.append('-DBUILD_SHARED_LIBS:BOOL=ON')
else: else: