diff --git a/Custom_EasyBlocks/elpa.py b/Custom_EasyBlocks/elpa.py index c0c5c5be527d452aa0fc66fb56a59dd970a3ca07..663832f0abf000d22efbdcc12de8c2e59d6a328d 100644 --- a/Custom_EasyBlocks/elpa.py +++ b/Custom_EasyBlocks/elpa.py @@ -37,7 +37,6 @@ from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError from easybuild.tools.config import build_option from easybuild.tools.filetools import apply_regex_substitutions -from easybuild.tools.modules import get_software_root from easybuild.tools.systemtools import get_cpu_features, get_shared_lib_ext from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC from easybuild.tools.utilities import nub @@ -54,7 +53,7 @@ class EB_ELPA(ConfigureMake): """Custom easyconfig parameters for ELPA.""" extra_vars = { 'auto_detect_cpu_features': [True, "Auto-detect available CPU features, and configure accordingly", CUSTOM], - 'cuda': [True, "Enable CUDA build if CUDA is among the dependencies", CUSTOM], + 'cuda': [None, "Enable CUDA build if CUDA is among the dependencies", CUSTOM], 'with_shared': [True, "Enable building of shared ELPA libraries", CUSTOM], 'with_single': [True, "Enable building of single precision ELPA functions", CUSTOM], 'with_generic_kernel': [True, "Enable building of ELPA generic kernels", CUSTOM], @@ -110,7 +109,6 @@ class EB_ELPA(ConfigureMake): self.log.info("Enabling use of %s (should be supported based on CPU features)", flag.upper()) setattr(self, flag, True) - def run_all_steps(self, *args, **kwargs): """ Put configure options in place for different builds (with and without openmp). @@ -164,18 +162,22 @@ class EB_ELPA(ConfigureMake): self.cfg.update('configopts', 'LIBS="$LIBLAPACK"') # Add CUDA features - if 'CUDA' in [i['name'] for i in self.cfg.dependencies()]: + cuda_is_dep = 'CUDA' in [i['name'] for i in self.cfg.dependencies()] + if cuda_is_dep and (self.cfg['cuda'] is None or self.cfg['cuda']): self.cfg.update('configopts', '--enable-nvidia-gpu') - cuda_cc_space_sep = self.cfg.template_values['cuda_cc_space_sep'].replace('.','').split() + cuda_cc_space_sep = self.cfg.template_values['cuda_cc_space_sep'].replace('.', '').split() # Just one is supported, so pick the highest one (but prioritize sm_80) selected_cc = "0" for cc in cuda_cc_space_sep: if int(cc) > int(selected_cc) and int(selected_cc) != 80: selected_cc = cc - self.cfg.update('configopts', f'--with-NVIDIA-GPU-compute-capability=sm_{selected_cc}') + self.cfg.update('configopts', '--with-NVIDIA-GPU-compute-capability=sm_%s' % selected_cc) if selected_cc == "80": self.cfg.update('configopts', '--enable-nvidia-sm80-gpu') - + elif not self.cfg['cuda']: + self.log.warning("CUDA is disabled") + elif not cuda_is_dep and self.cfg['cuda']: + raise EasyBuildError("CUDA is not a dependency, but support for CUDA is enabled.") # make all builds verbose self.cfg.update('buildopts', 'V=1')