Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions easybuild/easyblocks/c/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,30 @@ def configure_step(self):
else:
options['DFLAGS'] += ' -D__ELPA3'

# CUDA
# CUDA support
# see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2j-cuda-optional-improved-performance-on-gpu-systems
cuda = get_software_root('CUDA')
if cuda:
options['DFLAGS'] += ' -D__ACC -D__DBCSR_ACC'
options['LIBS'] += ' -lcudart -lcublas -lcufft -lrt'
options['NVCC'] = ' nvcc'
# check GPU architecture(s) to build for
cuda_cc_sm_vals = self.cfg.template_values.get('cuda_sm_comma_sep')
if cuda_cc_sm_vals:
gpu_targets = '--gpu-code=%s' % cuda_cc_sm_vals
else:
gpu_targets = ''

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a better default, and/or a warning if no CUDA compute capabilities were specified?


options['DFLAGS'] += ' -D__ACC -D__DBCSR_ACC -D__PW_CUDA -D__GRID_CUDA'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need easyconfig parameters to opt-out of using -D__PW_CUDA and -D__GRID_CUDA?

options['LIBS'] += ' -lcudart -lnvrtc -lcuda -lcublas -lcufft -lrt'
options['NVCC'] = 'nvcc'
options['NVFLAGS'] = ' '.join([
options['DFLAGS'],
'-O3',
'--std=c++11',
gpu_targets,
# control host compilers + options
'-ccbin="%s"' % os.getenv('CXX'),
'-Xcompiler="%s"' % os.getenv('CXXFLAGS'),
])
options['GPUVER'] = 'V100'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously hardcoded, should we auto-detect what the correct value should be for this?

Not sure what the significance of this is, actually...

@Flamefire Flamefire Mar 31, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the point where you said in the call that only a single GPU arch is supported?

I just searched the source of CP2K and didn't find any place where this is actually used: https://github.com/cp2k/cp2k/search?q=GPUVER
All uses are either in the autotools build chain, which we don't use (I'd guess we could?) So I guess we don't need it at all. Or did I miss anything?

I'd say only the NVFLAGS are required

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is really required, I tried without it. It's used by the DBCSR component.

I have an updated version of this, which I apparently haven't pushed yet, doing that right now (see 68e15c5)


# avoid group nesting
options['LIBS'] = options['LIBS'].replace('-Wl,--start-group', '').replace('-Wl,--end-group', '')
Expand Down