Skip to content

Commit

Permalink
updates test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Dec 20, 2023
1 parent 2cf6e0f commit 921a7b1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
run: make tests

linuxCheck:
name: Test on ${{ matrix.os }}
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: changesCheck

Expand All @@ -147,7 +147,7 @@ jobs:

- name: configure
run: ./configure

- name: make
run: make -j2 all

Expand Down Expand Up @@ -185,6 +185,7 @@ jobs:
- name: compiler infos
run: |
echo ""
source /opt/intel/oneapi/setvars.sh
echo ""
echo "compiler versions:"
Expand Down Expand Up @@ -212,19 +213,25 @@ jobs:
which mpif90
mpif90 --version
echo ""
# infos
which ifort
which icc
which mpiifort
echo "mpirun:"
which mpirun
echo ""
# intel setup for running tests
echo ""
echo "replacing mpif90 with mpiifort link:"
sudo ln -sf $(which mpiifort) $(which mpif90)
mpif90 --version
echo ""
echo "mpirun:"
which mpirun
echo ""
export I_MPI_DEBUG=5,pid,host
export I_MPI_LIBRARY_KIND=debug
# debug
#export I_MPI_DEBUG=5,pid,host
#export I_MPI_LIBRARY_KIND=debug
# remove -ftrapuv which leads to issues for running tests
sed -i "s/-ftrapuv//g" flags.guess
# environment setting
export TERM=xterm
# export info
echo "exports:"
Expand Down Expand Up @@ -256,7 +263,7 @@ jobs:
make -j2 all
make clean
# fails due to MPI issue on virtual nodes
# note: fails with -ftrapuv flag due to MPI issue on virtual nodes
- name: make tests
run: |
make tests
Expand Down
2 changes: 1 addition & 1 deletion flags.guess
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ case $my_FC in
# optimization report: "-vec-report0" is old and will be replaced by "-qopt-report0 -qopt-report-phase=vec" for v >=15.0
DEF_FFLAGS="-xHost -fpe0 -ftz -assume buffered_io -assume byterecl -align sequence -std08 -diag-disable 6477 -implicitnone -gen-interfaces -warn all,noexternal" # -mcmodel=medium -shared-intel
OPT_FFLAGS="-O3 -check nobounds"
DEBUG_FFLAGS="-check all -debug -g -O0 -fp-stack-check -traceback" # -ftrapuv -init=snan,arrays
DEBUG_FFLAGS="-check all -debug -g -O0 -fp-stack-check -traceback -ftrapuv"
# option "-openmp" is soon deprecated and replaced by "-qopenmp" for versions > 17.x
OMP_FFLAGS="-qopenmp"
;;
Expand Down
21 changes: 13 additions & 8 deletions tests/auxiliaries/1.run_write_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ my_test(){
sed '/^[[:blank:]]*#.*$/d;s/#.//' tmp2.dat > tmpB.dat
# joins file lines
paste tmpA.dat tmpB.dat > tmp.dat;
head -n 20 tmp.dat
# debug
#head -n 20 tmp.dat
# compare radius
# more sensitive test (works only w/ gfortran tests)
#awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($1 - $10)**2;print $0," - val = ",val;}}END{print "L2 radius = ",val;if(val>0.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($1 - $10)**2;print $0," - val = ",val;}}END{print "L2 radius = ",val;if(val>1.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
# less sensitive test
# works w/ intel ifort: two of the ouputted radius locations are shifted by 1km (val > 2.01 check) due to a different numerical precision
# all other outputted values are still the same as w/ gfortran
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($1 - $10)**2;}}END{print "L2 radius = ",val;if(val>2.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
if [[ $? -ne 0 ]]; then echo "error model: $model "; echo "comparison failed, please check..."; exit 1; fi
# compare rho
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($2 - $11)**2;}}END{print "L2 rho = ",val;if(val>0.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
if [[ $? -ne 0 ]]; then echo "error model: $model "; echo "comparison failed, please check..."; exit 1; fi
# compare vpv
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($3 - $12)**2;print $0," - val = ",val;}}END{print "L2 vpv = ",val;if(val>0.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($3 - $12)**2;}}END{print "L2 vpv = ",val;if(val>0.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
if [[ $? -ne 0 ]]; then echo "error model: $model "; echo "comparison failed, please check..."; exit 1; fi
# compare vsv
awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($4 - $13)**2;}}END{print "L2 vsv = ",val;if(val>0.01){print "failed",val;exit 1;}else{print "good";exit 0;}}' tmp.dat;
Expand Down Expand Up @@ -144,11 +149,11 @@ do
fi

# debug
echo ""
head -n 20 OUTPUT_FILES/CARDS_th0042_ph0338
echo ""
tail -n 20 OUTPUT_FILES/CARDS_th0042_ph0338
echo ""
#echo ""
#head -n 20 OUTPUT_FILES/CARDS_th0042_ph0338
#echo ""
#tail -n 20 OUTPUT_FILES/CARDS_th0042_ph0338
#echo ""

# test seismograms
my_test >> $testdir/results.log
Expand Down
5 changes: 4 additions & 1 deletion tests/meshfem3D/test_save.f90
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ program test_save
! calculated volume: 0.69301991575060418
!
print *,'volume_total = ',volume_total
if (abs(volume_total - 0.6930199157d0) > 1.d-10) then
! more sensitive threshold (works only for gfortran tests)
!if (abs(volume_total - 0.6930199157d0) > 1.d-10) then
! less sensitive threshold (works also on intel ifort tests)
if (abs(volume_total - 0.6930199157d0) > 1.d-5) then
print *,'volume expected: ',0.6930199157d0,' difference: ',abs(volume_total - 0.6930199157d0)
print *,'ERROR: volume_total value invalid'
stop 1
Expand Down

0 comments on commit 921a7b1

Please sign in to comment.