-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JPRichings
committed
Oct 29, 2024
1 parent
dbdce91
commit c4d2059
Showing
4 changed files
with
257 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
"""ReFrame base module for applications tests""" | ||
|
||
import reframe as rfm | ||
import reframe.utility.sanity as sn | ||
import abc | ||
|
||
|
||
|
||
@rfm.simple_test | ||
class AppsFetchBase(rfm.RunonlyRegressionTest): | ||
"""Reframe base class for accessing application code""" | ||
descr = 'Fetch app code' | ||
version = variable(str, value='7.3') | ||
executable = 'wget' | ||
executable_opts = [ | ||
f'app-{version}' | ||
] | ||
local = True | ||
valid_systems = [''] | ||
valid_prog_environs = [''] | ||
|
||
@sanity_function | ||
def validate_download(self): | ||
return sn.assert_eq(self.job.exitcode, 0) | ||
|
||
|
||
@rfm.simple_test | ||
class AppsCompileBase(rfm.CompileOnlyRegressionTest, metaclass=abc.ABCMeta): | ||
"""Reframe base class for application compilation tests""" | ||
descr = 'Build app' | ||
build_system = '' | ||
valid_systems = [''] | ||
valid_prog_environs = [''] | ||
|
||
@abc.abstractmethod | ||
@run_after('init') | ||
def add_dependencies(self): | ||
self.depends_on('', udeps.fully) | ||
|
||
@sanity_function | ||
def validate_compilation_no_errors(self): | ||
"""Sanity check that software compiled correctly""" | ||
return sn.assert_eq(self.job.exitcode, 0) | ||
|
||
@abc.abstractmethod | ||
@sanity_function | ||
def validate_compilation_executable_produced(self): | ||
"""Sanity check that software compiled correctly""" | ||
pass | ||
|
||
|
||
@rfm.simple_test | ||
class AppsRunBase(rfm.RunOnlyRegressionTest, metaclass=abc.ABCMeta): | ||
"""ReFrame base class for applications execution tests""" | ||
|
||
# Test classifications | ||
tags = {""} # { "applications", "performance", "largescale", "hugescale"} | ||
|
||
# Test environments | ||
valid_prog_environs = [""] | ||
|
||
#Test executables | ||
executable = "" | ||
|
||
# | ||
extra_resources = {""} # {"qos": {"qos": "standard"}} | ||
strict_check = True | ||
|
||
# Depency | ||
appbinary = fixture(AppsCompileBase, scope="environment") | ||
|
||
# Outputs | ||
keep_files = [""] | ||
|
||
# Info | ||
maintainers =[""] | ||
|
||
|
||
# Sanity checks | ||
|
||
@sanity_function | ||
def validate_run_finished_no_error(self) -> bool: | ||
"""Sanity check that simulation finished successfully""" | ||
return sn.assert_eq(self.job.exitcode, 0) | ||
|
||
@abc.abstractmethod | ||
@sanity_function | ||
def validate_run_finished(self) -> bool: | ||
"""Sanity check that simulation finished successfully""" | ||
pass | ||
|
||
@abc.abstractmethod | ||
@sanity_function | ||
def assert_correctness(self) -> bool: | ||
"""Sanity check that simulation finished correctly""" | ||
pass | ||
|
||
# Application performance check | ||
|
||
@abc.abstractmethod | ||
@performance_function("app", perf_key="performance") | ||
def extract_performance(self): | ||
"""Extract performance value to compare with reference value""" | ||
#return sn.extractsingle("","") | ||
pass | ||
|
||
|
||
# Job performance tests | ||
|
||
@performance_function("J", perf_key="job_energy") | ||
def extract_job_energy(self): | ||
"""Extract value of energy used in job from slurm""" | ||
jobid = self.job.jobid | ||
|
||
slurm = rfm.utility.osext.run_command( | ||
"sacct -j " + str(jobid) + " --format=JobID,ConsumedEnergy --noconvert | tr '\n' ' ' ", | ||
check=True, | ||
shell=True, | ||
) | ||
|
||
energy_slurm = sn.extractall_s( | ||
r"JobID\s+ConsumedEnergy\s+------------ --------------\s+[0-9]+\s+[0-9]+\s+[0-9]+.bat\+\s+[0-9]+\s+[0-9]+.ext\+\s+[0-9]+\s+[0-9]+.0\s+(?P<energy>[0-9]+)", | ||
str(slurm.stdout), | ||
"energy", | ||
) | ||
return int(str(energy_slurm[0])) | ||
|
||
@performance_function("sec", perf_key="job_time") | ||
def extract_job_time(self): | ||
"""Extract value of the duration of the job from slurm""" | ||
return self.completion_time | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ class CP2KBaseCheck(rfm.RunOnlyRegressionTest): | |
# Output files to be retained | ||
keep_files = ["cp2k.out"] | ||
|
||
# Set time limit | ||
|
||
time_limit = "20m" | ||
|
||
maintainers = ["[email protected]"] | ||
use_multithreading = False | ||
tags = {"applications", "performance"} | ||
|
@@ -68,13 +72,13 @@ class CP2KARCHER2(CP2KBaseCheck): | |
# Select system to use | ||
valid_systems = ["archer2:compute"] | ||
# Set Programming Environment | ||
valid_prog_environs = ["PrgEnv-gnu"] | ||
valid_prog_environs = ["PrgEnv-gnu", "PrgEnv-gnu-hf"] | ||
# Description of test | ||
descr = "CP2K " | ||
# Command line options for executable | ||
executable_opts = ("-i input_bulk_HFX_3.inp -o cp2k.out ").split() | ||
# different cpu frequencies | ||
freq = parameter(["2250000", "2000000"]) | ||
freq = ["2250000", "2000000"] | ||
# slurm parameters | ||
num_tasks = 384 | ||
num_tasks_per_node = 16 | ||
|
@@ -89,20 +93,20 @@ class CP2KARCHER2(CP2KBaseCheck): | |
@run_after("init") | ||
def setup_params(self): | ||
"""sets up extra parameters""" | ||
self.descr += self.freq | ||
#self.descr += self.freq | ||
if self.current_system.name in ["archer2"]: | ||
self.env_vars = { | ||
"OMP_NUM_THREADS": str(self.num_cpus_per_task), | ||
"OMP_PLACES": "cores", | ||
"SLURM_CPU_FREQ_REQ": self.freq, | ||
} | ||
"OMP_PLACES": "cores"} | ||
# "SLURM_CPU_FREQ_REQ": self.freq, | ||
# } | ||
|
||
@run_before("performance") | ||
def set_reference(self): | ||
"""Changes reference values""" | ||
if self.current_system.name in ["archer2"]: | ||
# https://reframe-hpc.readthedocs.io/en/stable/utility_functions_reference.html#reframe.utility.ScopedDict | ||
self.reference["archer2:compute:performance"] = self.reference_performance[self.freq] | ||
self.reference["archer2:compute:performance"] = self.reference_performance["2250000" if self.current_environ.name[-3:] =='-hf' else "2000000"] | ||
|
||
|
||
@rfm.simple_test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Reframe test for XCompact3D""" | ||
|
||
# Based on original work from: | ||
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich) | ||
# ReFrame Project Developers. See the top-level LICENSE file for details. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
import reframe as rfm | ||
import reframe.utility.sanity as sn | ||
|
||
|
||
|
||
class XCompact3dFetchStable(AppsFetchBase): | ||
"""Test to fetch xcompact3d from github""" | ||
executable = 'git clone' | ||
executable_opts = [ | ||
f'https://github.com/xcompact3d/Incompact3d.git' | ||
] | ||
|
||
local = True | ||
|
||
valid_systems = ['*'] | ||
valid_prog_environs = [''] | ||
|
||
|
||
class Xcompact3dBuildStable(AppsCompileBase): | ||
"""Reframe base class for application compilation tests""" | ||
descr = 'Build app' | ||
build_system = '' | ||
valid_systems = [''] | ||
valid_prog_environs = [''] | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
@rfm.simple_test | ||
class XCompact3DTest(rfm.RegressionTest): | ||
"""XCompact 3D Test""" | ||
|
||
valid_systems = ["archer2:compute"] | ||
valid_prog_environs = ["PrgEnv-gnu"] | ||
|
||
tags = {"performance", "applications"} | ||
|
||
num_nodes = 64 | ||
num_tasks_per_node = 128 | ||
num_cpus_per_task = 1 | ||
num_tasks = num_nodes * num_tasks_per_node * num_cpus_per_task | ||
|
||
env_vars = {"OMP_NUM_THREADS": str(num_cpus_per_task)} | ||
|
||
time_limit = "1h" | ||
build_system = "CMake" | ||
prebuild_cmds = [ | ||
"git clone https://github.com/xcompact3d/Incompact3d.git", | ||
"cd Incompact3d", | ||
] | ||
builddir = "Incompact3d" | ||
executable = "Incompact3d/bin/xcompact3d" | ||
executable_opts = ["input-64.i3d"] | ||
modules = ["cmake/3.29.4"] | ||
|
||
reference = {"archer2:compute": {"steptime": (6.3, -0.2, 0.2, "seconds")}} | ||
|
||
@sanity_function | ||
def assert_finished(self): | ||
"""Sanity check that simulation finished successfully""" | ||
return sn.assert_found("Good job", self.stdout) | ||
|
||
@performance_function("seconds", perf_key="performance") | ||
def extract_perf(self): | ||
"""Extract performance value to compare with reference value""" | ||
return sn.extractsingle( | ||
r"Averaged time per step \(s\):\s+(?P<steptime>\S+)", | ||
self.stdout, | ||
"steptime", | ||
float, | ||
) |