Skip to content

Commit 8dce116

Browse files
committed
Support GPU aware MPI for the NVHPC toolchain in QuantumESPRESSO
1 parent 71b0102 commit 8dce116

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

easybuild/easyblocks/q/quantumespresso.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def extra_options():
109109
"""Custom easyconfig parameters for Quantum ESPRESSO."""
110110
extra_vars = {
111111
'with_cuda': [False, 'Enable CUDA support', CUSTOM],
112+
'with_gpu_aware_mpi': [False, 'Use GPU aware MPI operations', CUSTOM],
112113
'with_scalapack': [True, 'Enable ScaLAPACK support', CUSTOM],
113114
'with_fox': [False, 'Enable FoX support', CUSTOM],
114115
'with_gipaw': [True, 'Enable GIPAW support', CUSTOM],
@@ -169,6 +170,7 @@ def _add_toolchains_opts(self):
169170
self._add_mpi()
170171
self._add_openmp()
171172
self._add_cuda()
173+
self._add_gpu_aware_mpi()
172174

173175
def _add_libraries(self):
174176
"""Enable external libraries for Quantum ESPRESSO."""
@@ -213,6 +215,22 @@ def _add_cuda(self):
213215
self.cfg.update('configopts', '-DQE_ENABLE_CUDA=OFF')
214216
self.cfg.update('configopts', '-DQE_ENABLE_OPENACC=OFF')
215217

218+
def _check_toolchain_supports_gpu_aware_mpi(self):
219+
supported_toolchains = [toolchain.NVHPC]
220+
comp_fam = self.toolchain.comp_family()
221+
if comp_fam not in supported_toolchains:
222+
raise EasyBuildError("with_gpu_aware_mpi is supported by toolchains %s: " % supported_toolchains)
223+
224+
def _add_gpu_aware_mpi(self):
225+
"""Enable GPU ware MPI operations"""
226+
if self.cfg.get('with_gpu_aware_mpi', True):
227+
self._check_toolchain_supports_gpu_aware_mpi()
228+
if not (self.cfg.get('with_cuda', True) and self.cfg.get('usempi', True)):
229+
raise EasyBuildError('with_gpu_aware_mpi requires with_cuda and usempi')
230+
self.cfg.update('configopts', '-DQE_ENABLE_MPI_GPU_AWARE=ON')
231+
else:
232+
self.cfg.update('configopts', '-DQE_ENABLE_MPI_GPU_AWARE=OFF')
233+
216234
def _add_scalapack(self):
217235
"""Enable ScaLAPACK for Quantum ESPRESSO."""
218236
if self.cfg.get('with_scalapack', False):

0 commit comments

Comments
 (0)