Calc testjobs linux.sh: Difference between revisions
From Biowerkzeug Wiki
Jump to navigationJump to search
mNo edit summary |
try <source/> |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
* The testing of the mpi binaries is not tested and probably does not work. However, they are ''only'' needed for replica exchange simulations and there are no test cases for those anyway. | * The testing of the mpi binaries is not tested and probably does not work. However, they are ''only'' needed for replica exchange simulations and there are no test cases for those anyway. | ||
* [http://forums.biowerkzeug.org/viewtopic.php?f=22&t=6&p=15&hilit=OpenMP#p15 Not all tests support multi-threaded runs] (with | * [http://forums.biowerkzeug.org/viewtopic.php?f=22&t=6&p=15&hilit=OpenMP#p15 Not all tests support multi-threaded runs] (with OpenMP); these tests ignore the NSLOTS argument. | ||
< | <source lang="bash">#!/bin/bash | ||
# $Id: calc_testjobs_linux.sh 2535 2008-12-07 16:07:19Z www-data $ | # $Id: calc_testjobs_linux.sh 2535 2008-12-07 16:07:19Z www-data $ | ||
# Running Hippo tests (Linux) | # Running Hippo tests (Linux) | ||
Line 142: | Line 142: | ||
echo "Finished running hippo test suite" | echo "Finished running hippo test suite" | ||
</ | </source> |
Latest revision as of 15:41, 8 December 2008
This script allows running Hippo benchmarks without having to think too much about finding the correct binary and supplemental files. In addition it gives the total wall time required to run each test case; this can be used for crude benchmarks.
- The testing of the mpi binaries is not tested and probably does not work. However, they are only needed for replica exchange simulations and there are no test cases for those anyway.
- Not all tests support multi-threaded runs (with OpenMP); these tests ignore the NSLOTS argument.
#!/bin/bash
# $Id: calc_testjobs_linux.sh 2535 2008-12-07 16:07:19Z www-data $
# Running Hippo tests (Linux)
# Copyright (c) 2008 Biowerkzeug
# Oliver Beckstein <orbeckst@gmail.com>
#set -x
prog=$(basename $0)
CURDIR=${PWD}
# defaults (: can be set in environment)
: ${HIPPO_DIR:="${CURDIR}/.."}
HIPPO_TESTS="hexane_NVT_dp_MD octane_NPT_sp_MC pentadecane_NPT_sp_MD tip3p_NPT_sp_MD trpzip2_GBSA_MC vpu_GBIM_MC walp_octane_NPT_sp_MD"
RUN_TESTS=${HIPPO_TESTS}
USE_MPI=0
usage="usage $prog [opts] [tests]
Run Hippo tests. By default it runs all of them:
${HIPPO_TESTS}
OPTIONS:
-h help
-n number of threads (not possible for all tests)
-D directory where we look for Hippo executables [${HIPPO_DIR}]
-M use mpi (replica exchange) binaries [${USE_MPI}]
Environment variables:
HIPPO_DIR overrides -D [${HIPPO_DIR}]
"
function die () {
local msg="$1" err=${2:-1}
echo 1>&2 "ERROR: failed in $PWD: ${msg}"
cd ${CURDIR}
exit $err
}
NSLOTS=1
# opt processing
while getopts hn:D:M: opt; do
case $opt in
h) echo "$usage"; exit 0;;
n) NSLOTS=${OPTARG};;
D) HIPPO_DIR=${OPTARG};;
M) USE_MPI=${OPTARG};;
*) die "Unknown option" 1;;
esac
done
#echo "OPTIND=$OPTIND OPTARG=$OPTARG argv=$*"
shift $((OPTIND - 1))
if [ -n "$*" ]; then
RUN_TESTS="$*"
fi
echo "Running the following tests using ${NSLOTS} threads: ${RUN_TESTS}"
# find working executable
# we'll use the first one that only complain about missing input file
#
if [ ${USE_MPI} = 0 ]; then
echo "Trying standard binaries (with OpenMP)"
_HIPPO_BINARIES="hippo hippo_p3"
else
echo "Testing mpi binaries. Note: these are ONLY needed for replica exchange simulations"
_HIPPO_BINARIES="hippo_mpi hippo_p3_mpi"
fi
HIPPO="not_found"
rm -f hippo_input.txt # clean any input files
for h in ${_HIPPO_BINARIES}; do
exe="${HIPPO_DIR}/${h}"
if ${exe} 2>&1 | egrep "^Hippo.*Copyright.*Biowerkzeug" >/dev/null; then
HIPPO=${exe}
break
fi
done
if [ "${HIPPO}" = "not_found" ]; then
ARCH=$(uname -m);
OS=$(uname -s);
die "No usable hippo executable found; see if there is one at
http://www.biowerkzeug.com for your architecture ${ARCH} and operating
system ${OS}. "
fi
echo "Using executable ${HIPPO}"
TOPOLOGY=${HIPPO_DIR}/hippo_protein_database.dat
FF=${HIPPO_DIR}/oplsaa_forcefield.dat
echo "Setting up test directory"
rm -rf test
mkdir test
cd test
topdir="${CURDIR}/test"
function setup_hippo () {
local numthreads=${1:-1}
local input=hippo_input.txt
cp ${HIPPO} ./hippo || return $?
cp ${TOPOLOGY} . || return $?
cp ${FF} . || return $?
test -e $input || die "Missing run input file $input in $PWD"
if [ $NSLOTS -gt 1 ]; then
# adjusting for OpenMP run
sed -i.orig -e "s/[[:space:]]*openMP numthreads.*/openMP numthreads ${numthreads}/" $input
fi
return 0
}
function run_test () {
local testdir="$1" numthreads="${2:-1}"
echo "---------------------------------------------------------"
cd ${testdir} || die "Cannot 'cd ${testdir}'"
setup_hippo ${numthreads} || die "setup_hippo() failed"
echo "Set up all files for NSLOTS=${numthreads}"
echo "Running hippo test case ${testdir}..."
t_start=$(date +%s)
./hippo
t_stop=$(date +%s)
delta_t=$(( t_stop-t_start ))
echo "Completed hippo test case ${testdir} in ${delta_t} seconds, running ${numthreads} threads"
echo "BENCHMARK: ${testdir} ${numthreads} ${delta_t}"
cd ${topdir}
}
cp -r ../jobs/* .
for t in ${RUN_TESTS};
do run_test $t ${NSLOTS}
done
echo "Finished running hippo test suite"