Skip to content

Commit 6a0f356

Browse files
authored
Merge pull request #3945 from Thyre/20250925142337_new_pr_lammps
change LAMMPS easyblock to check for `kokkos_arch` before generic `optarch`
2 parents cae1c39 + e5c559a commit 6a0f356

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

easybuild/easyblocks/l/lammps.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -270,37 +270,24 @@ def get_kokkos_arch(self, cuda_cc, kokkos_arch):
270270
# to the compiler flags, which may override the ones set by EasyBuild.
271271
# https://github.com/lammps/lammps/blob/stable_29Aug2024/lib/kokkos/cmake/kokkos_arch.cmake#L228-L531
272272
processor_arch = None
273-
if build_option('optarch') == OPTARCH_GENERIC:
273+
if kokkos_arch:
274+
# If someone is trying a manual override for this case, let them
275+
if kokkos_arch not in KOKKOS_CPU_ARCH_LIST:
276+
warning_msg = "Specified CPU ARCH (%s) " % kokkos_arch
277+
warning_msg += "was not found in listed options [%s]." % KOKKOS_CPU_ARCH_LIST
278+
warning_msg += "Still might work though."
279+
print_warning(warning_msg)
280+
processor_arch = kokkos_arch
281+
elif build_option('optarch') == OPTARCH_GENERIC:
274282
# For generic Arm builds we use an existing target;
275283
# this ensures that KOKKOS_ARCH_ARM_NEON is enabled (Neon is required for armv8-a).
276284
# For other architectures we set a custom/non-existent type, which will disable all optimizations,
277285
# and it should use the compiler (optimization) flags set by EasyBuild for this architecture.
278286
if get_cpu_architecture() == AARCH64:
279-
if kokkos_arch:
280-
# If someone is trying a manual override for this case, let them
281-
if kokkos_arch not in KOKKOS_CPU_ARCH_LIST:
282-
warning_msg = "Specified CPU ARCH (%s) " % kokkos_arch
283-
warning_msg += "was not found in listed options [%s]." % KOKKOS_CPU_ARCH_LIST
284-
warning_msg += "Still might work though."
285-
print_warning(warning_msg)
286-
processor_arch = kokkos_arch
287-
else:
288-
processor_arch = 'ARMV80'
287+
processor_arch = 'ARMV80'
289288
else:
290289
processor_arch = 'EASYBUILD_GENERIC'
291-
292290
_log.info("Generic build requested, setting CPU ARCH to %s." % processor_arch)
293-
if kokkos_arch:
294-
msg = "The specified kokkos_arch (%s) will be ignored " % kokkos_arch
295-
msg += "because a generic build was requested (via --optarch=GENERIC)"
296-
print_warning(msg)
297-
elif kokkos_arch:
298-
if kokkos_arch not in KOKKOS_CPU_ARCH_LIST:
299-
warning_msg = "Specified CPU ARCH (%s) " % kokkos_arch
300-
warning_msg += "was not found in listed options [%s]." % KOKKOS_CPU_ARCH_LIST
301-
warning_msg += "Still might work though."
302-
print_warning(warning_msg)
303-
processor_arch = kokkos_arch
304291

305292
# If kokkos_arch was not set...
306293
elif LooseVersion(self.cur_version) >= LooseVersion(translate_lammps_version('2Aug2023')):

0 commit comments

Comments
 (0)