SIRIUS package: add v6.3.2 + Python/MKL support (#12472)
* Add version 6.3.2 (which does not require patches like 6.1.5) * Add +python variant to build Python bindings * Option to build shared libraries does not exist for newer versions including 6.3.2 * Update 'libs' property (library names are different for newer versions) * Add support to detect and build with MKL as blas provider
This commit is contained in:
parent
a38edff0c8
commit
c0cb92b2f6
@ -16,10 +16,12 @@ class Sirius(CMakePackage, CudaPackage):
|
||||
list_url = "https://github.com/electronic-structure/SIRIUS/releases"
|
||||
|
||||
version('6.1.5', sha256='379f0a2e5208fd6d91c2bd4939c3a5c40002975fb97652946fa1bfe4a3ef97cb')
|
||||
version('6.3.2', sha256='1723e5ad338dad9a816369a6957101b2cae7214425406b12e8712c82447a7ee5')
|
||||
|
||||
variant('shared', default=False, description="Build shared libraries")
|
||||
variant('openmp', default=True, description="Build with OpenMP support")
|
||||
variant('fortran', default=False, description="Build Fortran bindings")
|
||||
variant('python', default=False, description="Build Python bindings")
|
||||
variant('elpa', default=False, description="Use ELPA")
|
||||
variant('vdwxc', default=False, description="Enable libvdwxc support")
|
||||
variant('scalapack', default=False, description="Enable scalapack support")
|
||||
@ -33,34 +35,47 @@ class Sirius(CMakePackage, CudaPackage):
|
||||
depends_on('spglib')
|
||||
depends_on('hdf5+hl')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('py-mpi4py', when='+python')
|
||||
depends_on('py-pybind11', when='+python')
|
||||
|
||||
depends_on('elpa+openmp', when='+elpa+openmp')
|
||||
depends_on('elpa~openmp', when='+elpa~openmp')
|
||||
depends_on('libvdwxc+mpi', when='+vdwxc')
|
||||
depends_on('scalapack', when='+scalapack')
|
||||
depends_on("cuda", when="+cuda")
|
||||
depends_on('cuda', when='+cuda')
|
||||
|
||||
conflicts('+shared', when='@6.3.0:') # option to build shared libraries has been removed
|
||||
|
||||
# TODO:
|
||||
# add support for MKL, MAGMA, CRAY_LIBSCI, Python bindings, testing
|
||||
# add support for MAGMA, CRAY_LIBSCI, ROCm, testing
|
||||
|
||||
patch("strip-spglib-include-subfolder.patch")
|
||||
patch("link-libraries-fortran.patch")
|
||||
patch("cmake-fix-shared-library-installation.patch")
|
||||
patch("strip-spglib-include-subfolder.patch", when='@6.1.5')
|
||||
patch("link-libraries-fortran.patch", when='@6.1.5')
|
||||
patch("cmake-fix-shared-library-installation.patch", when='@6.1.5')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
libraries = []
|
||||
|
||||
if self.spec.satisfies('+fortran'):
|
||||
libraries += ['libsirius_f']
|
||||
if '@6.3.0:' in self.spec:
|
||||
libraries += ['libsirius']
|
||||
|
||||
if self.spec.satisfies('+cuda'):
|
||||
libraries += ['libsirius_cu']
|
||||
return find_libraries(
|
||||
libraries, root=self.prefix,
|
||||
shared=False, recursive=True
|
||||
)
|
||||
|
||||
return find_libraries(
|
||||
libraries, root=self.prefix,
|
||||
shared=self.spec.satisfies('+shared'), recursive=True
|
||||
)
|
||||
else:
|
||||
if '+fortran' in self.spec:
|
||||
libraries += ['libsirius_f']
|
||||
|
||||
if '+cuda' in self.spec:
|
||||
libraries += ['libsirius_cu']
|
||||
|
||||
return find_libraries(
|
||||
libraries, root=self.prefix,
|
||||
shared='+shared' in self.spec, recursive=True
|
||||
)
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
@ -75,28 +90,29 @@ def _def(variant, flag=None):
|
||||
flag if flag else "USE_{0}".format(
|
||||
variant.strip('+~').upper()
|
||||
),
|
||||
"ON" if spec.satisfies(variant) else "OFF"
|
||||
"ON" if variant in spec else "OFF"
|
||||
)
|
||||
|
||||
args = [
|
||||
'-DBUILD_SHARED_LIBS=ON',
|
||||
_def('+openmp'),
|
||||
_def('+elpa'),
|
||||
_def('+vdwxc'),
|
||||
_def('+scalapack'),
|
||||
_def('+fortran', 'CREATE_FORTRAN_BINDINGS'),
|
||||
_def('+python', 'CREATE_PYTHON_MODULE'),
|
||||
_def('+cuda')
|
||||
]
|
||||
|
||||
if '@:6.2.999' in self.spec:
|
||||
args += [_def('+shared', 'BUILD_SHARED_LIBS')]
|
||||
|
||||
lapack = spec['lapack']
|
||||
blas = spec['blas']
|
||||
|
||||
args += [
|
||||
'-DLAPACK_FOUND=true',
|
||||
'-DLAPACK_INCLUDE_DIRS={0}'.format(lapack.prefix.include),
|
||||
'-DLAPACK_LIBRARIES={0}'.format(lapack.libs.joined(';')),
|
||||
'-DBLAS_FOUND=true',
|
||||
'-DBLAS_INCLUDE_DIRS={0}'.format(blas.prefix.include),
|
||||
'-DBLAS_LIBRARIES={0}'.format(blas.libs.joined(';')),
|
||||
]
|
||||
|
||||
@ -109,14 +125,17 @@ def _def(variant, flag=None):
|
||||
spec['scalapack'].libs.joined(';')),
|
||||
]
|
||||
|
||||
if spec.satisfies('+elpa'):
|
||||
if spec['blas'].name in ['intel-mkl', 'intel-parallel-studio']:
|
||||
args += ['-DUSE_MKL=ON']
|
||||
|
||||
if '+elpa' in spec:
|
||||
elpa_incdir = os.path.join(
|
||||
spec['elpa'].headers.directories[0],
|
||||
'elpa'
|
||||
)
|
||||
args += ["-DELPA_INCLUDE_DIR={0}".format(elpa_incdir)]
|
||||
|
||||
if spec.satisfies('+cuda'):
|
||||
if '+cuda' in spec:
|
||||
cuda_arch = spec.variants['cuda_arch'].value
|
||||
if cuda_arch:
|
||||
args += [
|
||||
|
Loading…
Reference in New Issue
Block a user