Skip to content

Commit

Permalink
Merge pull request easybuilders#3336 from laraPPr/LAMMPS_checks
Browse files Browse the repository at this point in the history
enhance custom easyblock for LAMMPS: add `sanity_check_test_inputs` custom easyconfig parameter, add mapping for zen4, also support building of non-stable LAMMPS versions
  • Loading branch information
boegel authored Aug 14, 2024
2 parents e9ab043 + c390e73 commit 99f7254
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions easybuild/easyblocks/l/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def extra_options(**kwargs):
'kokkos': [True, "Enable kokkos build.", CUSTOM],
'kokkos_arch': [None, "Set kokkos processor arch manually, if auto-detection doesn't work.", CUSTOM],
'user_packages': [None, "List user packages (without prefix PKG_ or USER-PKG_).", CUSTOM],
'sanity_check_test_inputs': [None, "List of tests for sanity-check.", CUSTOM],
})
extra_vars['separate_build_dir'][0] = True
return extra_vars
Expand All @@ -233,6 +234,7 @@ def update_kokkos_cpu_mapping(self):

if LooseVersion(self.cur_version) >= LooseVersion(translate_lammps_version('21sep2021')):
self.kokkos_cpu_mapping['a64fx'] = 'A64FX'
self.kokkos_cpu_mapping['zen4'] = 'ZEN3'

def prepare_step(self, *args, **kwargs):
"""Custom prepare step for LAMMPS."""
Expand Down Expand Up @@ -469,7 +471,7 @@ def install_step(self):

mkdir(site_packages, parents=True)

self.lammpsdir = os.path.join(self.builddir, '%s-stable_%s' % (self.name.lower(), self.version))
self.lammpsdir = os.path.join(self.builddir, '%s-*_%s' % (self.name.lower(), self.version))
self.python_dir = os.path.join(self.lammpsdir, 'python')

# The -i flag is added through a patch to the lammps source file python/install.py
Expand All @@ -492,19 +494,22 @@ def sanity_check_step(self, *args, **kwargs):
# Output files need to go somewhere (and has to work for --module-only as well)
execution_dir = tempfile.mkdtemp()

check_files = [
'atm', 'balance', 'colloid', 'crack', 'dipole', 'friction',
'hugoniostat', 'indent', 'melt', 'min', 'msst',
'nemd', 'obstacle', 'pour', 'voronoi',
]
if self.cfg['sanity_check_test_inputs']:
sanity_check_test_inputs = self.cfg['sanity_check_test_inputs']
else:
sanity_check_test_inputs = [
'atm', 'balance', 'colloid', 'crack', 'dipole', 'friction',
'hugoniostat', 'indent', 'melt', 'min', 'msst',
'nemd', 'obstacle', 'pour', 'voronoi',
]

custom_commands = [
# LAMMPS test - you need to call specific test file on path
'from lammps import lammps; l=lammps(); l.file("%s")' %
# Examples are part of the install with paths like (installdir)/examples/filename/in.filename
os.path.join(self.installdir, "examples", "%s" % check_file, "in.%s" % check_file)
# And this should be done for every file specified above
for check_file in check_files
for check_file in sanity_check_test_inputs
]

# mpirun command needs an l.finalize() in the sanity check from LAMMPS 29Sep2021
Expand Down

0 comments on commit 99f7254

Please sign in to comment.