Skip to content

Commit 39fe1a4

Browse files
authored
Merge pull request #87 from laraPPr/LAMMPS_hook
Update LAMMPS pre-configure hook to disable SIMD for ARM + CUDA
2 parents 5bedd42 + 3e5e8db commit 39fe1a4

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

eb_hooks.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,19 +1003,44 @@ def pre_configure_hook_wrf_aarch64(self, *args, **kwargs):
10031003
raise EasyBuildError("WRF-specific hook triggered for non-WRF easyconfig?!")
10041004

10051005

1006-
def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs):
1006+
def pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda(self, *args, **kwargs):
10071007
"""
10081008
pre-configure hook for LAMMPS:
1009-
- set kokkos_arch on x86_64/amd/zen4
1009+
- set kokkos_arch on x86_64/amd/zen4 and aarch64/nvidia/grace
1010+
- Disable SIMD for Aarch64 + cuda builds
10101011
"""
10111012

1013+
# Get cpu_target for zen4 hook
10121014
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
1015+
10131016
if self.name == 'LAMMPS':
1017+
# Set kokkos_arch for LAMMPS version which do not have support for the target architecture
1018+
# This is no longer required with easybuild 5.1.2
10141019
if self.version in ('2Aug2023_update2', '2Aug2023_update4', '29Aug2024'):
10151020
if get_cpu_architecture() == X86_64:
10161021
if cpu_target == CPU_TARGET_ZEN4:
10171022
# There is no support for ZEN4 in LAMMPS yet so falling back to ZEN3
10181023
self.cfg['kokkos_arch'] = 'ZEN3'
1024+
elif get_cpu_architecture() == AARCH64:
1025+
if cpu_target == CPU_TARGET_NVIDIA_GRACE:
1026+
# There is no support for NVIDA grace in LAMMPS yet so falling back to ARMV81
1027+
self.cfg['kokkos_arch'] = 'ARMV81'
1028+
1029+
# Disable SIMD for specific CUDA versions
1030+
if self.version == '2Aug2023_update2':
1031+
if get_cpu_architecture() == AARCH64:
1032+
if self.cuda:
1033+
for dep in self.cfg.dependencies():
1034+
if 'CUDA' == dep['name']:
1035+
# This was broken until CUDA 13.1
1036+
if dep['version'] < LooseVersion('13.1'):
1037+
self.cfg['kokkos_arch'] = 'ARMV70'
1038+
cxxflags = os.getenv('CXXFLAGS', '')
1039+
cxxflags = cxxflags.replace('-mcpu=native', '')
1040+
cxxflags += ' -march=armv8-a+nosimd'
1041+
self.log.info("Setting CXXFLAGS to disable NEON: %s", cxxflags)
1042+
env.setvar('CXXFLAGS', cxxflags)
1043+
10191044
else:
10201045
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
10211046

@@ -1579,7 +1604,7 @@ def post_easyblock_hook(self, *args, **kwargs):
15791604
'PMIx': pre_configure_hook_pmix_ipv6,
15801605
'PRRTE': pre_configure_hook_prrte_ipv6,
15811606
'WRF': pre_configure_hook_wrf_aarch64,
1582-
'LAMMPS': pre_configure_hook_LAMMPS_zen4,
1607+
'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda,
15831608
'Score-P': pre_configure_hook_score_p,
15841609
'VSEARCH': pre_configure_hook_vsearch,
15851610
'CMake': pre_configure_hook_cmake_system,

0 commit comments

Comments
 (0)