你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
Update reframe tests to use PrgEnv-gnu as recommended by ARCHER2 docs
这个提交包含在:
@@ -5,7 +5,14 @@ from shutil import copyfile
|
|||||||
|
|
||||||
import reframe as rfm
|
import reframe as rfm
|
||||||
import reframe.utility.sanity as sn
|
import reframe.utility.sanity as sn
|
||||||
from reframe.core.builtins import performance_function, require_deps, run_after, run_before, sanity_function, variable
|
from reframe.core.builtins import (
|
||||||
|
performance_function,
|
||||||
|
require_deps,
|
||||||
|
run_after,
|
||||||
|
run_before,
|
||||||
|
sanity_function,
|
||||||
|
variable,
|
||||||
|
)
|
||||||
from reframe.utility import udeps
|
from reframe.utility import udeps
|
||||||
from utilities.deferrable import path_join
|
from utilities.deferrable import path_join
|
||||||
|
|
||||||
@@ -16,15 +23,16 @@ PATH_TO_PYENV = os.path.join(".venv", "bin", "activate")
|
|||||||
@rfm.simple_test
|
@rfm.simple_test
|
||||||
class CreatePyenvTest(rfm.RunOnlyRegressionTest):
|
class CreatePyenvTest(rfm.RunOnlyRegressionTest):
|
||||||
valid_systems = ["generic", "archer2:login"]
|
valid_systems = ["generic", "archer2:login"]
|
||||||
valid_prog_environs = ["builtin", "PrgEnv-cray"]
|
valid_prog_environs = ["builtin", "PrgEnv-gnu"]
|
||||||
modules = ["cray-python"]
|
modules = ["cray-python"]
|
||||||
|
|
||||||
prerun_cmds = [
|
prerun_cmds = [
|
||||||
"python -m venv --system-site-packages --prompt gprMax .venv",
|
"python -m venv --system-site-packages --prompt gprMax .venv",
|
||||||
f"source {PATH_TO_PYENV}",
|
f"source {PATH_TO_PYENV}",
|
||||||
f"pip install -r {os.path.join(GPRMAX_ROOT_DIR, 'requirements.txt')}",
|
f"CC=cc CXX=CC FC=ftn python -m pip install --upgrade pip')",
|
||||||
|
f"CC=cc CXX=CC FC=ftn python -m pip install -r {os.path.join(GPRMAX_ROOT_DIR, 'requirements.txt')}",
|
||||||
]
|
]
|
||||||
executable = f"pip install -e {GPRMAX_ROOT_DIR}"
|
executable = f"CC=cc CXX=CC FC=ftn python -m pip install -e {GPRMAX_ROOT_DIR}"
|
||||||
|
|
||||||
@sanity_function
|
@sanity_function
|
||||||
def check_requirements_installed(self):
|
def check_requirements_installed(self):
|
||||||
@@ -33,8 +41,12 @@ class CreatePyenvTest(rfm.RunOnlyRegressionTest):
|
|||||||
Check gprMax installed successfully and no other errors thrown
|
Check gprMax installed successfully and no other errors thrown
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
sn.assert_found(r"Successfully installed (?!gprMax)", self.stdout, "Failed to install requirements")
|
sn.assert_found(
|
||||||
and sn.assert_found(r"Successfully installed gprMax", self.stdout, "Failed to install gprMax")
|
r"Successfully installed (?!gprMax)", self.stdout, "Failed to install requirements"
|
||||||
|
)
|
||||||
|
and sn.assert_found(
|
||||||
|
r"Successfully installed gprMax", self.stdout, "Failed to install gprMax"
|
||||||
|
)
|
||||||
and sn.assert_not_found(r"finished with status 'error'", self.stdout)
|
and sn.assert_not_found(r"finished with status 'error'", self.stdout)
|
||||||
and sn.assert_not_found(r"ERROR:", self.stderr)
|
and sn.assert_not_found(r"ERROR:", self.stderr)
|
||||||
)
|
)
|
||||||
@@ -42,7 +54,8 @@ class CreatePyenvTest(rfm.RunOnlyRegressionTest):
|
|||||||
|
|
||||||
class GprMaxBaseTest(rfm.RunOnlyRegressionTest):
|
class GprMaxBaseTest(rfm.RunOnlyRegressionTest):
|
||||||
valid_systems = ["archer2:compute"]
|
valid_systems = ["archer2:compute"]
|
||||||
valid_prog_environs = ["PrgEnv-cray"]
|
valid_prog_environs = ["PrgEnv-gnu"]
|
||||||
|
modules = ["cray-python"]
|
||||||
executable = "time -p python -m gprMax --log-level 25"
|
executable = "time -p python -m gprMax --log-level 25"
|
||||||
exclusive_access = True
|
exclusive_access = True
|
||||||
|
|
||||||
@@ -76,13 +89,19 @@ class GprMaxBaseTest(rfm.RunOnlyRegressionTest):
|
|||||||
"""Check simulation completed successfully"""
|
"""Check simulation completed successfully"""
|
||||||
# TODO: Check for correctness/regression rather than just completing
|
# TODO: Check for correctness/regression rather than just completing
|
||||||
return sn.assert_not_found(
|
return sn.assert_not_found(
|
||||||
r"(?i)error", self.stderr, f"An error occured. See '{path_join(self.stagedir, self.stderr)}' for details."
|
r"(?i)error",
|
||||||
) and sn.assert_found(r"=== Simulation completed in ", self.stdout, "Simulation did not complete")
|
self.stderr,
|
||||||
|
f"An error occured. See '{path_join(self.stagedir, self.stderr)}' for details.",
|
||||||
|
) and sn.assert_found(
|
||||||
|
r"=== Simulation completed in ", self.stdout, "Simulation did not complete"
|
||||||
|
)
|
||||||
|
|
||||||
@performance_function("s", perf_key="run_time")
|
@performance_function("s", perf_key="run_time")
|
||||||
def extract_run_time(self):
|
def extract_run_time(self):
|
||||||
"""Extract total runtime from the last task to complete"""
|
"""Extract total runtime from the last task to complete"""
|
||||||
return sn.extractsingle(r"real\s+(?P<run_time>\S+)", self.stderr, "run_time", float, self.num_tasks - 1)
|
return sn.extractsingle(
|
||||||
|
r"real\s+(?P<run_time>\S+)", self.stderr, "run_time", float, self.num_tasks - 1
|
||||||
|
)
|
||||||
|
|
||||||
@performance_function("s", perf_key="simulation_time")
|
@performance_function("s", perf_key="simulation_time")
|
||||||
def extract_simulation_time(self):
|
def extract_simulation_time(self):
|
||||||
@@ -91,7 +110,9 @@ class GprMaxBaseTest(rfm.RunOnlyRegressionTest):
|
|||||||
# sn.extractall throws an error if a group has value None.
|
# sn.extractall throws an error if a group has value None.
|
||||||
# Therefore have to handle the < 1 min, >= 1 min and >= 1 hour cases separately.
|
# Therefore have to handle the < 1 min, >= 1 min and >= 1 hour cases separately.
|
||||||
timeframe = sn.extractsingle(
|
timeframe = sn.extractsingle(
|
||||||
r"=== Simulation completed in \S+ (?P<timeframe>hour|minute|second)", self.stdout, "timeframe"
|
r"=== Simulation completed in \S+ (?P<timeframe>hour|minute|second)",
|
||||||
|
self.stdout,
|
||||||
|
"timeframe",
|
||||||
)
|
)
|
||||||
if timeframe == "hour":
|
if timeframe == "hour":
|
||||||
simulation_time = sn.extractall(
|
simulation_time = sn.extractall(
|
||||||
@@ -117,7 +138,10 @@ class GprMaxBaseTest(rfm.RunOnlyRegressionTest):
|
|||||||
hours = 0
|
hours = 0
|
||||||
minutes = 0
|
minutes = 0
|
||||||
seconds = sn.extractsingle(
|
seconds = sn.extractsingle(
|
||||||
r"=== Simulation completed in (?P<seconds>\S+) seconds? =*", self.stdout, "seconds", float
|
r"=== Simulation completed in (?P<seconds>\S+) seconds? =*",
|
||||||
|
self.stdout,
|
||||||
|
"seconds",
|
||||||
|
float,
|
||||||
)
|
)
|
||||||
return hours * 3600 + minutes * 60 + seconds
|
return hours * 3600 + minutes * 60 + seconds
|
||||||
|
|
||||||
@@ -146,7 +170,9 @@ class GprMaxRegressionTest(GprMaxBaseTest):
|
|||||||
Create reference file from the test output if it does not exist.
|
Create reference file from the test output if it does not exist.
|
||||||
"""
|
"""
|
||||||
if sn.path_exists(self.reference_file):
|
if sn.path_exists(self.reference_file):
|
||||||
h5diff_output = sn.extractsingle(f"{self.h5diff_header}\n(?P<h5diff>[\S\s]*)", self.stdout, "h5diff")
|
h5diff_output = sn.extractsingle(
|
||||||
|
f"{self.h5diff_header}\n(?P<h5diff>[\S\s]*)", self.stdout, "h5diff"
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
self.test_simulation_complete()
|
self.test_simulation_complete()
|
||||||
and sn.assert_found(self.h5diff_header, self.stdout, "Failed to find h5diff header")
|
and sn.assert_found(self.h5diff_header, self.stdout, "Failed to find h5diff header")
|
||||||
@@ -161,7 +187,9 @@ class GprMaxRegressionTest(GprMaxBaseTest):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
copyfile(self.output_file, self.reference_file)
|
copyfile(self.output_file, self.reference_file)
|
||||||
return sn.assert_true(False, f"No reference file exists. Creating... '{self.reference_file}'")
|
return sn.assert_true(
|
||||||
|
False, f"No reference file exists. Creating... '{self.reference_file}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class GprMaxMpiTest(GprMaxBaseTest):
|
class GprMaxMpiTest(GprMaxBaseTest):
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
# using threading.
|
# using threading.
|
||||||
export OMP_NUM_THREADS=1
|
export OMP_NUM_THREADS=1
|
||||||
|
|
||||||
|
module load cray-python
|
||||||
|
|
||||||
source ../.venv/bin/activate
|
source ../.venv/bin/activate
|
||||||
|
|
||||||
reframe -C configuration/archer2_settings.py -c reframe_tests.py -c base_tests.py -r "$@"
|
reframe -C configuration/archer2_settings.py -c reframe_tests.py -c base_tests.py -r "$@"
|
||||||
|
在新工单中引用
屏蔽一个用户