diff --git a/tests/2exec/comp2exec b/tests/2exec/comp2exec index 1c2a50d6..8edfebb2 100755 --- a/tests/2exec/comp2exec +++ b/tests/2exec/comp2exec @@ -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) @@ -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. @@ -100,7 +112,7 @@ 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 @@ -108,13 +120,15 @@ function mycmp { # 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 @@ -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 @@ -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 @@ -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 diff --git a/tests/2exec/suite b/tests/2exec/suite index 0f1933b6..e6d6a002 100644 --- a/tests/2exec/suite +++ b/tests/2exec/suite @@ -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 @@ -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;