Skip to content

Commit

Permalink
Improvements in tests/2exec/
Browse files Browse the repository at this point in the history
- added test mode 'ocl'.
- added optional flag FFTCOMP, which is helpful for comparing different FFT methods
- removed a number of ignores, which were used during comparison of ADDA 1.1 vs. 1.0.
- added error message when unknown first argument is given.
- a few minor/cleaning improvements.
- extended suite to include an array of grid sizes from 2 to 32 (to test FFT accuracy/robustness versus transform size).
  • Loading branch information
myurkin committed Jan 30, 2013
1 parent a90206a commit 62a90bc
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 26 deletions.
64 changes: 40 additions & 24 deletions tests/2exec/comp2exec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# First parameter is seq (default), mpi, mpi_seq, or ocl_seq.
# First parameter is seq (default), mpi, mpi_seq, ocl, or ocl_seq.
# One-word mode compares corresponding current version with previous stable version (e.g. 1.0)
# - some differences are always expected.
# Two-word mode compares two current versions corresponding to different modes (e.g. mpi vs. seq)
Expand All @@ -18,27 +18,39 @@ INPUTDIR="./../../input"
ADDASEQ="./../../src/seq/adda"
ADDAMPI="./../../src/mpi/adda_mpi"
ADDAOCL="./../../src/ocl/adda_ocl"
# Number of mpi procs
MPIPROCS=2
# MPI command prefix
MPIRUN="mpiexec -n 2"

MODE=${1:-seq}
SUITEFILE=${2:-suite}
DEFSUITE=suite
SUITEFILE=${2:-$DEFSUITE}

if [ $MODE == "seq" ]; then
EXECREF="./adda_1.0" # !!! This should be adjusted
EXECREF="./adda" # !!! This should be adjusted
EXECTEST=$ADDASEQ
IGERRREF=1
elif [ $MODE == "mpi" ]; then
EXECREF="mpiexec -n $MPIPROCS ./adda_mpi_1.0.exe" # !!! This should be adjusted
EXECTEST="mpiexec -n $MPIPROCS $ADDAMPI"
EXECREF="$MPIRUN ./adda_mpi" # !!! This should be adjusted
EXECTEST="$MPIRUN $ADDAMPI"
IGERRREF=1
elif [ $MODE == "mpi_seq" ]; then
EXECREF=$ADDASEQ
EXECTEST="mpiexec -n $MPIPROCS $ADDAMPI"
EXECTEST="$MPIRUN $ADDAMPI"
elif [ $MODE == "ocl" ]; then
EXECREF="./adda_ocl_amd" # !!! This should be adjusted
EXECTEST=$ADDAOCL
IGERRREF=1
elif [ $MODE == "ocl_seq" ]; then
# Currently ocl version can only be compared with the sequential one
EXECREF=$ADDASEQ
EXECTEST=$ADDAOCL
else
echo -e "\nERROR: unkwnown mode '$MODE'" >&2
exit 1
fi

# Set the following flag to ignore differences related to different FFT methods, such as FFT grid sizes and memory
#FFTCOMP=1

# Whether errors in running reference version of ADDA should be ignored. Useful for comparing with
# older versions, which lack all the tested functionality. This variable is set above for some
# modes.
Expand Down Expand Up @@ -100,21 +112,23 @@ function mycmp {
asmin rtol 2
elif [ -z "$cmdline" ]; then
asmin atol 8
asmin rtol 3
asmin rtol 3
else
asmin atol 14
asmin rtol 8
fi
# behavior is mainly determined by file name
base=`basename $1`
if [ "$base" == $SONAME ]; then
# 2nd and 3rd parts are due to difference between versions 1.0 and 1.1
IGNORE="^all data is saved in '.*'|^box dimensions: [0-9]+x[0-9]+x[0-9]+|^[0-9]+ : [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ "
IGNORE="^all data is saved in '.*'"
if [ $MODE == "mpi_seq" ]; then
IGNORE="$IGNORE|^(M|Total m|Maximum m|Additional m)emory usage"
elif [ $MODE == "ocl_seq" ]; then
IGNORE="$IGNORE|^Using OpenCL device|^Searching for OpenCL devices|^Initializing (clFFT|FFTW3)|^(M|Total m|OpenCL m)emory usage|^Device memory"
fi
IGNORE="$IGNORE|^Using OpenCL device|^Device memory|^Searching for OpenCL devices|^Initializing (clFFT|FFTW3)|^(M|Total m|OpenCL m)emory usage"
fi
if [ -n "$FFTCOMP" ]; then
IGNORE="$IGNORE|^(M|Total m|OpenCL m)emory usage"
fi
if [[ $MODE == "mpi" || $MODE == "mpi_seq" ]]; then
CUT="^Error posting writev, " # due to typical random errors of MPICH under Windows
else
Expand All @@ -130,12 +144,14 @@ function mycmp {
fi
igndiff $1 $2 "^Usage: '.*'|^Type '.*' for details" "$CUT"
elif [ "$base" == "log" ]; then
# All parts except the first two are due to difference between versions 1.0 and 1.1
IGNORE="^Generated by ADDA v\.|^command: '.*'|^WARNING:.*deprecated|^Incident beam: [pP]lane wave|^Polariza(tion|bility) relation: |^Total number of matrix-vector products: "
IGNORE="^Generated by ADDA v\.|^command: '.*'"
if [ $MODE == "mpi_seq" ]; then
IGNORE="$IGNORE|^The program was run on: |^(M|Total m|Maximum m|Additional m)emory usage"
elif [ $MODE == "ocl_seq" ]; then
IGNORE="$IGNORE|^Using OpenCL device|The FFT grid is: [0-9]+x[0-9]+x[0-9]+||^(M|Total m|OpenCL m)emory usage|^Device memory"
IGNORE="$IGNORE|^Using OpenCL device|^Device memory|^OpenCL FFT algorithm: by |^(M|Total m|OpenCL m)emory usage"
fi
if [ -n "$FFTCOMP" ]; then
IGNORE="$IGNORE|^(|OpenCL )FFT algorithm: by |The FFT grid is: [0-9]+x[0-9]+x[0-9]+|^(M|Total m|OpenCL m)emory usage"
fi
CUT="^Total wall time: "
asmin rtol 4
Expand Down Expand Up @@ -227,7 +243,7 @@ while read -r cmpfiles cmdline; do
# reference run
runref="$EXECREF $cmdline -dir $DIRREF"
if !($runref <&3 > $SOREF); then
if $IGNERRREF; then
if [ -n "$IGERRREF" ]; then
refok=0
else
echo -e "\nERROR while running \n$runref\nsee $SOREF" >&2
Expand All @@ -254,12 +270,12 @@ while read -r cmpfiles cmdline; do
fi
for file in $cmpfiles; do
if [[ "$file" == VisFrp* ]]; then # special case for changed name of output file
file2="${file%.dat}"
file2="${file2/VisFrp/RadForce}"
else
file2="$file"
fi
mydiff "$DIRREF/$file" "$DIRTEST/$file2"
file2="${file%.dat}"
file2="${file2/VisFrp/RadForce}"
else
file2="$file"
fi
mydiff "$DIRREF/$file" "$DIRTEST/$file2"
done
else
if [[ "$cmpfiles" == $SONAME || "$cmpfiles" == $ALLNAME ]]; then
Expand Down
18 changes: 16 additions & 2 deletions tests/2exec/suite
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
;mg4n; ;m; -grid 4 ;n;
# default addition to make particle completely non-symmetric
;sep; ;se; ;p;
# default for testing of different grids
;smn; -size 8 ;m; ;n;

# Elementary variables
;m; -m 1.1 0.1
Expand All @@ -27,8 +29,20 @@
# directly to ADDA.

all
# a single relatively long run
all -grid 32 -size 8 ;m; ;n;
# testing of different grids - relevant for FFT methods
# to remove redundant warnings for ocl_seq, only (2,3,5) numbers are used
all -grid 2 ;smn;
all -grid 4 ;smn;
all -grid 6 ;smn;
all -grid 8 ;smn;
all -grid 10 ;smn;
all -grid 12 ;smn;
all -grid 16 ;smn;
all -grid 18 ;smn;
all -grid 20 ;smn;
all -grid 24 ;smn;
all -grid 30 ;smn;
all -grid 32 ;smn;

all -h alldir_inp
all -alldir_inp adp.dat -Csca ;mgn;
Expand Down

0 comments on commit 62a90bc

Please sign in to comment.