Skip to content

Commit

Permalink
Reframe public version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasileios Karakasis committed May 5, 2017
1 parent 041ca52 commit 882a118
Show file tree
Hide file tree
Showing 95 changed files with 30,686 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
[GitHub pages](https://eth-cscs.github.io/reframe)
# ReFrame

ReFrame is a new framework for writing regression tests for HPC systems.
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.
This allows users to write easily portable regression tests, focusing only on the functionality.

Regression tests in ReFrame are simple Python classes that specify the basic parameters of the test.
The framework will load the test and will send it down a well-defined pipeline that will take care of its execution.
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.

Writing system regression tests in a high-level modern programming language, like Python, poses a great advantage in organizing and maintaining the tests.
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.


## Documentation

The official documentation is maintaned [here](https://eth-cscs.github.io/reframe).
1 change: 1 addition & 0 deletions bin/reframe
174 changes: 174 additions & 0 deletions ci-scripts/ci-runner.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#!/bin/bash

##############################################################################
#
#
# SCRIPT VARIABLES
#
#
##############################################################################
scriptname=`basename $0`
CI_FOLDER=""
TERM="${TERM:-xterm}"
PROFILE=""
MODULEUSE=""

#
# This function prints the script usage form
#

CI_EXITCODE=0

usage()
{
cat <<EOF
Usage: $(tput setaf 1)$scriptname$(tput sgr0) $(tput setaf 3)[OPTIONS]$(tput sgr0) $(tput setaf 2)-f <regression-folder>$(tput sgr0)
$(tput setaf 3)OPTIONS:$(tput sgr0)
$(tput setaf 3)-f | --folder$(tput sgr0) $(tput setaf 1)DIR$(tput sgr0) ci folder, e.g. PyRegression-CI
$(tput setaf 3)-i | --invocation$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) invocation for modified user checks. Multiple \`-i' options are multiple invocations
$(tput setaf 3)-l | --load-profile$(tput sgr0) $(tput setaf 1)ARGS$(tput sgr0) sources the given file before any execution of commands
$(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
$(tput setaf 3)-h | --help$(tput sgr0) prints this help and exits
EOF
} # end of usage

checked_exec()
{
"$@"
if [ $? -ne 0 ]; then
CI_EXITCODE=1
fi
}


run_user_checks()
{
cmd="python reframe.py --prefix . --notimestamp -r -t production $@"
echo "Running user checks with \`$cmd'"
checked_exec $cmd
}


##############################################################################
#
#
# MAIN SCRIPT
#
#
##############################################################################

#
# Getting the machine name from the cmd line arguments
#

#
# GNU Linux version
#
shortopts="h,f:,i:,l:,m:"
longopts="help,folder:,invocation:,load-profile:,module-use:"

eval set -- $(getopt -o ${shortopts} -l ${longopts} \
-n ${scriptname} -- "$@" 2> /dev/null)

num_invocations=0
invocations=()
while [ $# -ne 0 ]; do
case $1 in
-h | --help)
usage
exit 0 ;;
-f | --folder)
shift
CI_FOLDER="$1" ;;
-i | --invocation)
shift

# We need to set explicitly the array elements, in order to account
# for whitespace characters. The alternative way of expanding the
# array `invocations+=($1)' whould not treat whitespace correctly.
invocations[$num_invocations]=$1
((num_invocations++)) ;;
-l | --load-profile)
shift
PROFILE="$1" ;;
-m | --module-use)
shift
MODULEUSE="$1" ;;
--)
;;
*)
echo "${scriptname}: Unrecognized argument \`$1'" >&2
usage
exit 1 ;;
esac
shift
done

#
# Check if package_list_file was defined
#
if [ "X${CI_FOLDER}" == "X" ]; then
usage
exit 1
fi

#
# Sourcing a given profile
#
if [ "X${PROFILE}" != "X" ]; then
source ${PROFILE}
fi

#
# module use for a given folder
#
if [ "X${MODULEUSE}" != "X" ]; then
module use ${MODULEUSE}
fi

module load PyRegression

echo "=============="
echo "Loaded Modules"
echo "=============="
module list

cd ${CI_FOLDER}

echo "Running regression on ${CI_FOLDER}"

# Performing the unittests
echo "=================="
echo "Running unit tests"
echo "=================="
checked_exec ./test_reframe.py -v

# Find modified or added user checks
userchecks=( $(git log --name-status --oneline --no-merges -1 | \
grep -e '^[AM][[:space:]]*checks/.*\.py$' | \
awk '{ print $2 }') )


if [ ${#userchecks[@]} -ne 0 ]; then
userchecks_path=""
for check in ${userchecks[@]}; do
userchecks_path="${userchecks_path} -c ${check}"
done

echo "===================="
echo "Modified user checks"
echo "===================="
echo ${userchecks_path}

#
# Running the user checks
#
for i in ${!invocations[@]}; do
run_user_checks ${userchecks_path} ${invocations[i]}
done
fi

exit $CI_EXITCODE
77 changes: 77 additions & 0 deletions examples/apps/cp2k/cp2k_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import os
import reframe.settings as settings

from reframe.core.pipeline import RunOnlyRegressionTest
from reframe.utility.functions import standard_threshold
from reframe.utility.parsers import CounterParser


class CP2KCheck(RunOnlyRegressionTest):
def __init__(self, check_name, check_descr, **kwargs):
super().__init__('cp2k_example', os.path.dirname(__file__), **kwargs)
self.descr = 'CP2K GPU example test'

# Uncomment and adjust for the GPU system
# self.valid_systems = [ 'sys1', 'sys2' ]

# Uncomment and set the valid prog. environments for your site
# self.valid_prog_environs = [ 'PrgEnv-gnu' ]

# Uncomment and adjust to load the CP2K module
# self.modules = [ 'CP2K' ]

self.variables = { 'CRAY_CUDA_MPS' : '1' }
self.num_gpus_per_node = 1

self.executable = 'cp2k.psmp'
self.executable_opts = [ 'H2O-256.inp' ]

self.sanity_parser = CounterParser(10, exact=True)
self.sanity_parser.on()
self.sanity_patterns = {
'-' : {
'(?P<t_count_steps>STEP NUM)' : [
('t_count_steps', str, self.sanity_parser.match)
],
'(?P<c_count_steps>PROGRAM STOPPED IN)' : [
('c_count_steps', str, self.sanity_parser.match_eof)
]
}
}

self.perf_parser = StatefulParser(standard_threshold)
self.perf_patterns = {
'-' : {
'(?P<perf_section>T I M I N G)' : [
('perf_section', str, self.perf_parser.on)
],
'^ CP2K(\s+[\d\.]+){4}\s+(?P<perf>\S+)' : [
('perf', float, self.perf_parser.match)
]
}
}

# Uncomment and adjust for your site
# self.num_tasks = 48
# self.num_tasks_per_node = 8

# Uncomment and set the maintainers and/or tags
# self.maintainers = [ 'me' ]
# self.tags = { 'example' }

self.reference = {
# Uncomment and adjust the references for your systems/partitions
# 'sys1' : {
# 'perf' : (258, None, 0.15)
# },
# 'sys2' : {
# 'perf' : (340, None, 0.15)
# },
'*' : {
'perf_section' : None,
}
}


def _get_checks(**kwargs):
return [ CP2KCheck(**kwargs) ]
Loading

0 comments on commit 882a118

Please sign in to comment.