Skip to content

Commit 81859fa

Browse files
committed
Upadate LAMMPS pre-configure hook to disable SIMD for ARM + CUDA
Signed-off-by: laraPPr <lara.peeters@ugent.be>
1 parent a1b77a3 commit 81859fa

1 file changed

Lines changed: 34 additions & 10 deletions

File tree

eb_hooks.py

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -929,22 +929,46 @@ def pre_configure_hook_wrf_aarch64(self, *args, **kwargs):
929929
raise EasyBuildError("WRF-specific hook triggered for non-WRF easyconfig?!")
930930

931931

932-
def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs):
932+
def pre_configure_hook_LAMMPS_zen4_and_Aarch64_cuda(self, *args, **kwargs):
933933
"""
934934
pre-configure hook for LAMMPS:
935935
- set kokkos_arch on x86_64/amd/zen4
936+
- Disable SIMD for Aarch64 + cuda builds
936937
"""
937-
938+
939+
# Get cpu_target for zen4 hook
938940
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
941+
942+
# Get the dependencies to check CUDA
943+
deps = self.cfg.dependencies()
944+
cuda_versions = ('12.1.1')
945+
939946
if self.name == 'LAMMPS':
940-
if self.version in ('2Aug2023_update2', '2Aug2023_update4', '29Aug2024'):
941-
if get_cpu_architecture() == X86_64:
942-
if cpu_target == CPU_TARGET_ZEN4:
943-
# There is no support for ZEN4 in LAMMPS yet so falling back to ZEN3
944-
self.cfg['kokkos_arch'] = 'ZEN3'
945-
else:
946-
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
947947

948+
# Set kokkos_arch for LAMMPS version which do not have support for versions that do not support ZEN4
949+
if self.version in ('2Aug2023_update2', '2Aug2023_update4', '29Aug2024'):
950+
if get_cpu_architecture() == X86_64:
951+
if cpu_target == CPU_TARGET_ZEN4:
952+
# There is no support for ZEN4 in LAMMPS yet so falling back to ZEN3
953+
self.cfg['kokkos_arch'] = 'ZEN3'
954+
955+
# Disable SIMD for specific CUDA versions
956+
if self.version == '2Aug2023_update2':
957+
if get_cpu_architecture() == AARCH64:
958+
if ('CUDA' in [dep['name'] for dep in deps]):
959+
for dep in deps:
960+
if 'CUDA' == dep['name']:
961+
if dep['version'] in cuda_version:
962+
cxxflags = os.getenv('CXXFLAGS', '')
963+
cxxflags = cxxflags.replace('-mcpu=native', '')
964+
# All ARM targets of 2Aug2023_update are build with ARMV80 or ARM81.
965+
# This is not the case for newer versions.
966+
cxxflags += ' -march=armv8-a+nosimd'
967+
self.log.info("Setting CXXFLAGS to disable NEON: %s", cxxflags)
968+
env.setvar('CXXFLAGS', cxxflags)
969+
970+
else:
971+
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
948972

949973
def pre_configure_hook_cmake_system(self, *args, **kwargs):
950974
"""
@@ -1502,7 +1526,7 @@ def post_easyblock_hook(self, *args, **kwargs):
15021526
'MetaBAT': pre_configure_hook_metabat_filtered_zlib_dep,
15031527
'OpenBLAS': pre_configure_hook_openblas_optarch_generic,
15041528
'WRF': pre_configure_hook_wrf_aarch64,
1505-
'LAMMPS': pre_configure_hook_LAMMPS_zen4,
1529+
'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_Aarch64_cuda,
15061530
'Score-P': pre_configure_hook_score_p,
15071531
'VSEARCH': pre_configure_hook_vsearch,
15081532
'CMake': pre_configure_hook_cmake_system,

0 commit comments

Comments
 (0)