Ghost as cuda package (#7501)
* add headers property to netlib-lapack and intel-mkl * ghost: fix finding cblas header and libs (at least for mkl and netlib-lapack, which provide headers()) * fix flake8 errors * ghost: remove unnecessary query parameter * fix flake8 errors * ghost: make it a CudaPackage (as suggested by @davydden, thanks!) * ghost: missing whitespace
This commit is contained in:
parent
ed4640c75b
commit
35e7b9ac44
3 changed files with 30 additions and 12 deletions
|
@ -26,7 +26,7 @@
|
|||
from spack import *
|
||||
|
||||
|
||||
class Ghost(CMakePackage):
|
||||
class Ghost(CMakePackage, CudaPackage):
|
||||
"""GHOST: a General, Hybrid and Optimized Sparse Toolkit.
|
||||
This library provides highly optimized building blocks for implementing
|
||||
sparse iterative eigenvalue and linear solvers multi- and manycore
|
||||
|
@ -44,8 +44,6 @@ class Ghost(CMakePackage):
|
|||
description='Enables the build of shared libraries')
|
||||
variant('mpi', default=True,
|
||||
description='enable/disable MPI')
|
||||
variant('cuda', default=False,
|
||||
description='enable/disable CUDA')
|
||||
variant('scotch', default=False,
|
||||
description='enable/disable matrix reordering with PT-SCOTCH')
|
||||
variant('zoltan', default=False,
|
||||
|
@ -58,17 +56,14 @@ class Ghost(CMakePackage):
|
|||
depends_on('hwloc')
|
||||
depends_on('blas')
|
||||
depends_on('mpi', when='+mpi')
|
||||
depends_on('cuda@8:', when='+cuda')
|
||||
depends_on('scotch', when='+scotch')
|
||||
depends_on('zoltan', when='+zoltan')
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
cblas_include_dir = ''
|
||||
if '^mkl' not in spec:
|
||||
cblas_include_dir = '-DCBLAS_INCLUDE_DIR=' + \
|
||||
spec['blas'].prefix.include
|
||||
|
||||
# note: we require the cblas_include_dir property from the blas
|
||||
# provider, this is implemented at least for intel-mkl and
|
||||
# netlib-lapack
|
||||
args = ['-DGHOST_ENABLE_MPI:BOOL=%s'
|
||||
% ('ON' if '+mpi' in spec else 'OFF'),
|
||||
'-DGHOST_USE_CUDA:BOOL=%s'
|
||||
|
@ -78,9 +73,12 @@ def cmake_args(self):
|
|||
'-DGHOST_USE_ZOLTAN:BOOL=%s'
|
||||
% ('ON' if '+zoltan' in spec else 'OFF'),
|
||||
'-DBUILD_SHARED_LIBS:BOOL=%s'
|
||||
% ('ON' if '+shared' in spec else 'OFF'), cblas_include_dir
|
||||
% ('ON' if '+shared' in spec else 'OFF'),
|
||||
'-DCBLAS_INCLUDE_DIR:STRING=%s'
|
||||
% format(spec['blas'].headers.directories[0]),
|
||||
'-DBLAS_LIBRARIES=%s'
|
||||
% spec['blas:c'].libs.joined(';')
|
||||
]
|
||||
|
||||
return args
|
||||
|
||||
def check(self):
|
||||
|
|
|
@ -182,6 +182,18 @@ def scalapack_libs(self):
|
|||
|
||||
return libs
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
prefix = self.spec.prefix
|
||||
if sys.platform != 'darwin':
|
||||
include_dir = prefix.compilers_and_libraries.linux.mkl.include
|
||||
else:
|
||||
include_dir = prefix.include
|
||||
|
||||
cblas_h = join_path(include_dir, 'mkl_cblas.h')
|
||||
lapacke_h = join_path(include_dir, 'mkl_lapacke.h')
|
||||
return HeaderList([cblas_h, lapacke_h])
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
# set up MKLROOT for everyone using MKL package
|
||||
if sys.platform == 'darwin':
|
||||
|
|
|
@ -48,7 +48,8 @@ class NetlibLapack(Package):
|
|||
version('3.4.0', '02d5706ec03ba885fc246e5fa10d8c70')
|
||||
version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
|
||||
|
||||
variant('debug', default=False, description='Activates the Debug build type')
|
||||
variant('debug', default=False,
|
||||
description='Activates the Debug build type')
|
||||
variant('shared', default=True, description="Build shared library version")
|
||||
variant('external-blas', default=False,
|
||||
description='Build lapack with an external blas')
|
||||
|
@ -123,6 +124,13 @@ def lapack_libs(self):
|
|||
libraries, root=self.prefix, shared=shared, recursive=True
|
||||
)
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
include_dir = self.spec.prefix.include
|
||||
cblas_h = join_path(include_dir, 'cblas.h')
|
||||
lapacke_h = join_path(include_dir, 'lapacke.h')
|
||||
return HeaderList([cblas_h, lapacke_h])
|
||||
|
||||
def install_one(self, spec, prefix, shared):
|
||||
cmake_args = [
|
||||
'-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if shared else 'OFF'),
|
||||
|
|
Loading…
Reference in a new issue