Skip to content

Commit 882a118

Browse files
author
Vasileios Karakasis
committed
Reframe public version.
1 parent 041ca52 commit 882a118

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+30686
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
[GitHub pages](https://eth-cscs.github.io/reframe)
1+
# ReFrame
2+
3+
ReFrame is a new framework for writing regression tests for HPC systems.
4+
The goal of this framework is to abstract away the complexity of the interactions with the system, separating the logic of a regression test from the low-level details, which pertain to the system configuration and setup.
5+
This allows users to write easily portable regression tests, focusing only on the functionality.
6+
7+
Regression tests in ReFrame are simple Python classes that specify the basic parameters of the test.
8+
The framework will load the test and will send it down a well-defined pipeline that will take care of its execution.
9+
The stages of this pipeline take care of all the system interaction details, such as programming environment switching, compilation, job submission, job status query, sanity checking and performance assessment.
10+
11+
Writing system regression tests in a high-level modern programming language, like Python, poses a great advantage in organizing and maintaining the tests.
12+
Users can create their own test hierarchies, create test factories for generating multiple tests at the same time and also customize them in a simple and expressive way.
13+
14+
15+
## Documentation
16+
17+
The official documentation is maintaned [here](https://eth-cscs.github.io/reframe).

bin/reframe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../reframe.py

ci-scripts/ci-runner.bash

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
#!/bin/bash
2+
3+
##############################################################################
4+
#
5+
#
6+
# SCRIPT VARIABLES
7+
#
8+
#
9+
##############################################################################
10+
scriptname=`basename $0`
11+
CI_FOLDER=""
12+
TERM="${TERM:-xterm}"
13+
PROFILE=""
14+
MODULEUSE=""
15+
16+
#
17+
# This function prints the script usage form
18+
#
19+
20+
CI_EXITCODE=0
21+
22+
usage()
23+
{
24+
cat <<EOF
25+
Usage: $(tput setaf 1)$scriptname$(tput sgr0) $(tput setaf 3)[OPTIONS]$(tput sgr0) $(tput setaf 2)-f <regression-folder>$(tput sgr0)
26+
27+
$(tput setaf 3)OPTIONS:$(tput sgr0)
28+
29+
$(tput setaf 3)-f | --folder$(tput sgr0) $(tput setaf 1)DIR$(tput sgr0) ci folder, e.g. PyRegression-CI
30+
$(tput setaf 3)-i | --invocation$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) invocation for modified user checks. Multiple \`-i' options are multiple invocations
31+
$(tput setaf 3)-l | --load-profile$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) sources the given file before any execution of commands
32+
$(tput setaf 3)-m | --module-use$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) executes module use of the give folder before loading the regression
33+
$(tput setaf 3)-h | --help$(tput sgr0) prints this help and exits
34+
35+
EOF
36+
} # end of usage
37+
38+
checked_exec()
39+
{
40+
"$@"
41+
if [ $? -ne 0 ]; then
42+
CI_EXITCODE=1
43+
fi
44+
}
45+
46+
47+
run_user_checks()
48+
{
49+
cmd="python reframe.py --prefix . --notimestamp -r -t production $@"
50+
echo "Running user checks with \`$cmd'"
51+
checked_exec $cmd
52+
}
53+
54+
55+
##############################################################################
56+
#
57+
#
58+
# MAIN SCRIPT
59+
#
60+
#
61+
##############################################################################
62+
63+
#
64+
# Getting the machine name from the cmd line arguments
65+
#
66+
67+
#
68+
# GNU Linux version
69+
#
70+
shortopts="h,f:,i:,l:,m:"
71+
longopts="help,folder:,invocation:,load-profile:,module-use:"
72+
73+
eval set -- $(getopt -o ${shortopts} -l ${longopts} \
74+
-n ${scriptname} -- "$@" 2> /dev/null)
75+
76+
num_invocations=0
77+
invocations=()
78+
while [ $# -ne 0 ]; do
79+
case $1 in
80+
-h | --help)
81+
usage
82+
exit 0 ;;
83+
-f | --folder)
84+
shift
85+
CI_FOLDER="$1" ;;
86+
-i | --invocation)
87+
shift
88+
89+
# We need to set explicitly the array elements, in order to account
90+
# for whitespace characters. The alternative way of expanding the
91+
# array `invocations+=($1)' whould not treat whitespace correctly.
92+
invocations[$num_invocations]=$1
93+
((num_invocations++)) ;;
94+
-l | --load-profile)
95+
shift
96+
PROFILE="$1" ;;
97+
-m | --module-use)
98+
shift
99+
MODULEUSE="$1" ;;
100+
--)
101+
;;
102+
*)
103+
echo "${scriptname}: Unrecognized argument \`$1'" >&2
104+
usage
105+
exit 1 ;;
106+
esac
107+
shift
108+
done
109+
110+
#
111+
# Check if package_list_file was defined
112+
#
113+
if [ "X${CI_FOLDER}" == "X" ]; then
114+
usage
115+
exit 1
116+
fi
117+
118+
#
119+
# Sourcing a given profile
120+
#
121+
if [ "X${PROFILE}" != "X" ]; then
122+
source ${PROFILE}
123+
fi
124+
125+
#
126+
# module use for a given folder
127+
#
128+
if [ "X${MODULEUSE}" != "X" ]; then
129+
module use ${MODULEUSE}
130+
fi
131+
132+
module load PyRegression
133+
134+
echo "=============="
135+
echo "Loaded Modules"
136+
echo "=============="
137+
module list
138+
139+
cd ${CI_FOLDER}
140+
141+
echo "Running regression on ${CI_FOLDER}"
142+
143+
# Performing the unittests
144+
echo "=================="
145+
echo "Running unit tests"
146+
echo "=================="
147+
checked_exec ./test_reframe.py -v
148+
149+
# Find modified or added user checks
150+
userchecks=( $(git log --name-status --oneline --no-merges -1 | \
151+
grep -e '^[AM][[:space:]]*checks/.*\.py$' | \
152+
awk '{ print $2 }') )
153+
154+
155+
if [ ${#userchecks[@]} -ne 0 ]; then
156+
userchecks_path=""
157+
for check in ${userchecks[@]}; do
158+
userchecks_path="${userchecks_path} -c ${check}"
159+
done
160+
161+
echo "===================="
162+
echo "Modified user checks"
163+
echo "===================="
164+
echo ${userchecks_path}
165+
166+
#
167+
# Running the user checks
168+
#
169+
for i in ${!invocations[@]}; do
170+
run_user_checks ${userchecks_path} ${invocations[i]}
171+
done
172+
fi
173+
174+
exit $CI_EXITCODE

examples/apps/cp2k/cp2k_check.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import os
2+
import reframe.settings as settings
3+
4+
from reframe.core.pipeline import RunOnlyRegressionTest
5+
from reframe.utility.functions import standard_threshold
6+
from reframe.utility.parsers import CounterParser
7+
8+
9+
class CP2KCheck(RunOnlyRegressionTest):
10+
def __init__(self, check_name, check_descr, **kwargs):
11+
super().__init__('cp2k_example', os.path.dirname(__file__), **kwargs)
12+
self.descr = 'CP2K GPU example test'
13+
14+
# Uncomment and adjust for the GPU system
15+
# self.valid_systems = [ 'sys1', 'sys2' ]
16+
17+
# Uncomment and set the valid prog. environments for your site
18+
# self.valid_prog_environs = [ 'PrgEnv-gnu' ]
19+
20+
# Uncomment and adjust to load the CP2K module
21+
# self.modules = [ 'CP2K' ]
22+
23+
self.variables = { 'CRAY_CUDA_MPS' : '1' }
24+
self.num_gpus_per_node = 1
25+
26+
self.executable = 'cp2k.psmp'
27+
self.executable_opts = [ 'H2O-256.inp' ]
28+
29+
self.sanity_parser = CounterParser(10, exact=True)
30+
self.sanity_parser.on()
31+
self.sanity_patterns = {
32+
'-' : {
33+
'(?P<t_count_steps>STEP NUM)' : [
34+
('t_count_steps', str, self.sanity_parser.match)
35+
],
36+
'(?P<c_count_steps>PROGRAM STOPPED IN)' : [
37+
('c_count_steps', str, self.sanity_parser.match_eof)
38+
]
39+
}
40+
}
41+
42+
self.perf_parser = StatefulParser(standard_threshold)
43+
self.perf_patterns = {
44+
'-' : {
45+
'(?P<perf_section>T I M I N G)' : [
46+
('perf_section', str, self.perf_parser.on)
47+
],
48+
'^ CP2K(\s+[\d\.]+){4}\s+(?P<perf>\S+)' : [
49+
('perf', float, self.perf_parser.match)
50+
]
51+
}
52+
}
53+
54+
# Uncomment and adjust for your site
55+
# self.num_tasks = 48
56+
# self.num_tasks_per_node = 8
57+
58+
# Uncomment and set the maintainers and/or tags
59+
# self.maintainers = [ 'me' ]
60+
# self.tags = { 'example' }
61+
62+
self.reference = {
63+
# Uncomment and adjust the references for your systems/partitions
64+
# 'sys1' : {
65+
# 'perf' : (258, None, 0.15)
66+
# },
67+
# 'sys2' : {
68+
# 'perf' : (340, None, 0.15)
69+
# },
70+
'*' : {
71+
'perf_section' : None,
72+
}
73+
}
74+
75+
76+
def _get_checks(**kwargs):
77+
return [ CP2KCheck(**kwargs) ]

0 commit comments

Comments
 (0)