diff --git a/easybuild/easyblocks/b/blis.py b/easybuild/easyblocks/b/blis.py index a58f4683cc..136d059bac 100644 --- a/easybuild/easyblocks/b/blis.py +++ b/easybuild/easyblocks/b/blis.py @@ -26,6 +26,7 @@ EasyBuild support for BLIS and AOCL-BLAS, implemented as an easyblock @author: Samuel Moors (Vrije Universiteit Brussel) +@author: Pua Cheng Xuan Frederick (National University of Singapore) """ import re @@ -33,7 +34,7 @@ from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError from easybuild.tools.modules import MODULE_LOAD_ENV_HEADERS -from easybuild.tools.systemtools import get_shared_lib_ext +from easybuild.tools.systemtools import get_cpu_arch_name, get_shared_lib_ext class EB_BLIS(ConfigureMake): @@ -44,6 +45,9 @@ def extra_options(extra_vars=None): """Extra easyconfig parameters.""" extra_vars = { 'cpu_architecture': ['auto', 'CPU architecture (default is autodetect)', CUSTOM], + 'enable_cblas': [True, "Enable CBLAS", CUSTOM], + 'enable_shared': [True, "Enable builing shared library", CUSTOM], + 'threading_implementation': ["openmp", "Multithreading implementation(s) to build for", CUSTOM], } return ConfigureMake.extra_options(extra_vars) @@ -51,10 +55,28 @@ def extra_options(extra_vars=None): def configure_step(self): """Custom configopts.""" + if self.cfg['enable_cblas']: + self.cfg.update('configopts', '--enable-cblas') + + if self.cfg['enable_shared']: + self.cfg.update('configopts', '--enable-shared') + if self.toolchain.options.get('openmp', None): + if self.cfg['threading_implementation'] != 'openmp': + error_msg = ("Conflicting multithreading implementations specified: `openmp=True` in `toolchainopts`" + f" vs. `threading_implemenation = {self.cfg['threading_implementation']}`") + raise EasyBuildError(error_msg) self.cfg.update('configopts', '--enable-threading=openmp') + else: + self.cfg.update('configopts', f"--enable-threading={self.cfg['threading_implementation']}") + + self.cfg.update('configopts', f'CC="$CC" {self.cfg["cpu_architecture"]}') - self.cfg.update('configopts', f'--enable-cblas --enable-shared CC="$CC" {self.cfg["cpu_architecture"]}') + # arch_name will only be available when archspec is available to easybuild, else arch_name will be unknown + arch_name = get_cpu_arch_name() + if self.version in ('0.9.0', '1.0', '1.1') and arch_name == 'a64fx': + # see https://github.com/flame/blis/issues/800 + self.cfg.update('configopts', 'CFLAGS="$CFLAGS -DCACHE_SECTOR_SIZE_READONLY"') output = super().configure_step()