From 0857b9fbcab2f975408aa59623d128aa75e00d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 2 Dec 2024 14:15:07 +0100 Subject: [PATCH] also set CMAKE_CUDA_COMPILER and CMAKE_CUDA_ARCHITECTURES --- easybuild/easyblocks/generic/cmakemake.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/generic/cmakemake.py b/easybuild/easyblocks/generic/cmakemake.py index b5bd33f250..296e6f26fe 100644 --- a/easybuild/easyblocks/generic/cmakemake.py +++ b/easybuild/easyblocks/generic/cmakemake.py @@ -328,10 +328,18 @@ def configure_step(self, srcdir=None, builddir=None): # ensure CMake uses EB python, not system or virtualenv python options.update(get_cmake_python_config_dict()) - # pass the preferred host compiler to the CUDA compiler + # pass the preferred host compiler, CUDA compiler, and CUDA architectures to the CUDA compiler cuda_root = get_software_root('CUDA') if cuda_root: - self.cfg.update('preconfigopts', 'CUDAHOSTCXX=%s' % which(os.getenv('CXX', 'g++'))) + options['CMAKE_CUDA_HOST_COMPILER'] = which(os.getenv('CXX', 'g++')) + options['CMAKE_CUDA_COMPILER'] = 'nvcc' + cuda_cc = build_option('cuda_compute_capabilities') or self.cfg['cuda_compute_capabilities'] + if cuda_cc: + options['CMAKE_CUDA_ARCHITECTURES'] = '"%s"' % ';'.join([cc.replace('.', '') for cc in cuda_cc]) + else: + raise EasyBuildError('List of CUDA compute capabilities must be specified, either via ' + 'cuda_compute_capabilities easyconfig parameter or via ' + '--cuda-compute-capabilities') if not self.cfg.get('allow_system_boost', False): boost_root = get_software_root('Boost')