Skip to content

Commit

Permalink
also set CMAKE_CUDA_COMPILER and CMAKE_CUDA_ARCHITECTURES
Browse files Browse the repository at this point in the history
  • Loading branch information
bedroge authored Dec 2, 2024
1 parent ee21659 commit 0857b9f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 0857b9f

Please sign in to comment.