Skip to content
Merged
38 changes: 30 additions & 8 deletions easybuild/easyblocks/s/superlu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
EasyBuild support for building and installing the SuperLU library, implemented as an easyblock

@author: Xavier Besseron (University of Luxembourg)

Updated to use FlexiBlas, updated for version 5.3.0, come cleanup
Author: J. Sassmannshausen (ICL/UK)
"""

import os
Expand All @@ -44,7 +47,7 @@ class EB_SuperLU(CMakeMake):
@staticmethod
def extra_options():
extra_vars = CMakeMake.extra_options()
extra_vars['build_shared_libs'][0] = False
extra_vars['build_shared_libs'][0] = True
extra_vars['separate_build_dir'][0] = True
return extra_vars

Expand All @@ -61,7 +64,13 @@ def configure_step(self):
Set the CMake options for SuperLU
"""
# Make sure not to build the slow BLAS library included in the package
self.cfg.update('configopts', '-Denable_blaslib=OFF')
# At least for version 5.3.0 the name has changed:
superlu_version = self.version
if LooseVersion(superlu_version) >= LooseVersion('5.3'):
self.cfg.update('configopts', '-Denable_internal_blaslib=OFF')

else:
self.cfg.update('configopts', '-Denable_blaslib=OFF')

# Set the BLAS library to use
# For this, use the BLA_VENDOR option from the FindBLAS module of CMake
Expand All @@ -72,6 +81,7 @@ def configure_step(self):
raise EasyBuildError("No BLAS library found in the toolchain")

toolchain_blas = toolchain_blas_list[0]
cmake_version = get_software_version('cmake')
if toolchain_blas == 'imkl':
imkl_version = get_software_version('imkl')
if LooseVersion(imkl_version) >= LooseVersion('10'):
Expand All @@ -87,12 +97,24 @@ def configure_step(self):
elif toolchain_blas in ['ACML', 'ATLAS']:
self.cfg.update('configopts', '-DBLA_VENDOR="%s"' % toolchain_blas)

elif toolchain_blas == 'OpenBLAS':
# Unfortunately, OpenBLAS is not recognized by FindBLAS from CMake,
# we have to specify the OpenBLAS library manually
openblas_lib = os.path.join(get_software_root('OpenBLAS'), get_software_libdir('OpenBLAS'), "libopenblas.a")
self.cfg.update('configopts', '-DBLAS_LIBRARIES="%s;-pthread"' % openblas_lib)

if LooseVersion(cmake_version) >= LooseVersion('3.6'):
self.cfg.update('configopts', '-DBLA_VENDOR="%s"' % toolchain_blas)
else:
# Unfortunately, OpenBLAS is not recognized by FindBLAS from CMake,
# we have to specify the OpenBLAS library manually
openblas_lib = os.path.join(get_software_root('OpenBLAS'), get_software_libdir('OpenBLAS'),
"libopenblas.a")
self.cfg.update('configopts', '-DBLAS_LIBRARIES="%s;pthread"' % openblas_lib)

elif toolchain_blas == 'FlexiBLAS':
if LooseVersion(cmake_version) >= LooseVersion('3.19'):
self.cfg.update('configopts', '-DBLA_VENDOR="%s"' % toolchain_blas)
else:
# Unfortunately, FlexiBLAS is not recognized by FindBLAS from CMake,
# we have to specify the FlexiBLAS library manually
flexiblas_lib = os.path.join(get_software_root('FlexiBLAS'), get_software_libdir('FlexiBLAS'),
"libflexiblas.so")
self.cfg.update('configopts', '-DBLAS_LIBRARIES="%s;pthread"' % flexiblas_lib)
else:
# This BLAS library is not supported yet
raise EasyBuildError("BLAS library '%s' is not supported yet", toolchain_blas)
Expand Down