enable cuda support for suite-sparse (#4163)

* enable cuda support for suite-sparse

* do not use spec.satisfies

* cuda restructure, give clearer comment of why

* str format compatibility

* flake8 checks
This commit is contained in:
Stephen McDowell 2017-05-10 09:13:14 -04:00 committed by Adam J. Stewart
parent b5eb298f3e
commit c0ceece9cc

View File

@ -37,8 +37,9 @@ class SuiteSparse(Package):
version('4.5.3', '8ec57324585df3c6483ad7f556afccbd') version('4.5.3', '8ec57324585df3c6483ad7f556afccbd')
version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319') version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319')
variant('tbb', default=False, description='Build with Intel TBB') variant('tbb', default=False, description='Build with Intel TBB')
variant('pic', default=True, description='Build position independent code (required to link with shared libraries)') variant('pic', default=True, description='Build position independent code (required to link with shared libraries)')
variant('cuda', default=False, description='Build with CUDA')
depends_on('blas') depends_on('blas')
depends_on('lapack') depends_on('lapack')
@ -48,6 +49,8 @@ class SuiteSparse(Package):
# flags does not seem to be used, which leads to linking errors on Linux. # flags does not seem to be used, which leads to linking errors on Linux.
depends_on('tbb', when='@4.5.3:+tbb') depends_on('tbb', when='@4.5.3:+tbb')
depends_on('cuda', when='+cuda')
patch('tbb_453.patch', when='@4.5.3:+tbb') patch('tbb_453.patch', when='@4.5.3:+tbb')
def install(self, spec, prefix): def install(self, spec, prefix):
@ -65,19 +68,16 @@ def install(self, spec, prefix):
'CC=%s' % self.compiler.cc, 'CC=%s' % self.compiler.cc,
'CXX=%s' % self.compiler.cxx, 'CXX=%s' % self.compiler.cxx,
'F77=%s' % self.compiler.f77, 'F77=%s' % self.compiler.f77,
'CUDA_ROOT =', # CUDA=no does NOT disable cuda, it only disables internal search
'GPU_BLAS_PATH =', # for CUDA_PATH. If in addition the latter is empty, then CUDA is
'GPU_CONFIG =', # completely disabled. See
'CUDA_PATH =', # [SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk] for more.
'CUDART_LIB =', 'CUDA=no',
'CUBLAS_LIB =', 'CUDA_PATH={0}'.format(
'CUDA_INC_PATH =', spec['cuda'].prefix if '+cuda' in spec else ''
'NV20 =', )
'NV30 =',
'NV35 =',
'NVCC = echo',
'NVCCFLAGS =',
]) ])
if '+pic' in spec: if '+pic' in spec:
make_args.extend([ make_args.extend([
'CFLAGS={0}'.format(self.compiler.pic_flag), 'CFLAGS={0}'.format(self.compiler.pic_flag),