From 921a7b10180390e585e651eb67a6bb1ea1d0d4f3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 19 Dec 2023 11:50:34 +0100 Subject: [PATCH] updates test --- .github/workflows/CI.yml | 23 +++++++++++++++-------- flags.guess | 2 +- tests/auxiliaries/1.run_write_profile.sh | 21 +++++++++++++-------- tests/meshfem3D/test_save.f90 | 5 ++++- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a685a330e..007bca8fa 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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 @@ -147,7 +147,7 @@ jobs: - name: configure run: ./configure - + - name: make run: make -j2 all @@ -185,6 +185,7 @@ jobs: - name: compiler infos run: | + echo "" source /opt/intel/oneapi/setvars.sh echo "" echo "compiler versions:" @@ -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:" @@ -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 diff --git a/flags.guess b/flags.guess index b68f8bce5..32aa9dcf3 100644 --- a/flags.guess +++ b/flags.guess @@ -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" ;; diff --git a/tests/auxiliaries/1.run_write_profile.sh b/tests/auxiliaries/1.run_write_profile.sh index b03449b19..71f17c0f5 100755 --- a/tests/auxiliaries/1.run_write_profile.sh +++ b/tests/auxiliaries/1.run_write_profile.sh @@ -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; @@ -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 diff --git a/tests/meshfem3D/test_save.f90 b/tests/meshfem3D/test_save.f90 index ebbd3b028..abddcb4c0 100644 --- a/tests/meshfem3D/test_save.f90 +++ b/tests/meshfem3D/test_save.f90 @@ -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