From c4eaef5ef16a9767d1ad214618314b52c5fefe11 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 30 Nov 2023 10:12:20 +0100 Subject: [PATCH 1/8] updates travis --- .travis.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 878ef72b6..9e128b80a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -182,11 +182,20 @@ before_install: #- test -n $CC && unset CC # updates repository - - | - travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157 - travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13 - travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157 - travis_retry sudo apt-get update + # (fails currently...) + #- | + # travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157 + # travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13 + # travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157 + # apt explicit update + #- | + # echo "update apt-get" + # travis_retry sudo apt-get update + # echo +addons: + # apt update + apt: + update: true install: From 62eb9df77cc21dc50d3298e75d0a4f5695c42bca Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 30 Nov 2023 10:48:02 +0100 Subject: [PATCH 2/8] updates github actions (intel oneapi ifort) --- .github/workflows/CI.yml | 52 +++++++++++++++++++----- flags.guess | 5 ++- src/shared/parallel.f90 | 22 +++++----- tests/auxiliaries/1.run_write_profile.sh | 9 +++- 4 files changed, 64 insertions(+), 24 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8e5c4cc7..a685a330e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -176,31 +176,60 @@ jobs: sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt-get update echo "" - echo "packages intel oneapi:" - sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mpi intel-oneapi-mpi-devel + # info + #sudo -E apt-cache pkgnames intel | grep intel-oneapi + #echo "" + echo "installing packages intel oneapi:" + sudo apt-get install -y intel-oneapi-compiler-fortran-2023.2.2 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.2 intel-oneapi-mpi intel-oneapi-mpi-devel + echo "" - name: compiler infos run: | - echo "" source /opt/intel/oneapi/setvars.sh echo "" echo "compiler versions:" + echo "icx --version" + which icx + icx --version + echo "" echo "icc --version" + which icc icc --version + echo "" + echo "ifx --version" + which ifx + ifx --version + echo "" echo "ifort --version" + which ifort ifort --version + echo "" echo "mpiifort --version" + which mpiifort mpiifort --version + echo "" echo "mpif90 --version" + which mpif90 + mpif90 --version + echo "" + which ifort + which icc + which mpiifort + 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 export TERM=xterm + # export info echo "exports:" export echo "" - which ifort - which icc - which mpiifort echo "" printenv >> $GITHUB_ENV echo "CXX=icpc" >> $GITHUB_ENV @@ -209,7 +238,8 @@ jobs: echo "" - name: configure debug - run: ./configure --enable-debug FC=ifort CC=icc MPIFC=mpiifort + run: | + ./configure --enable-debug FC=ifort CC=icc MPIFC=mpiifort - name: make debug run: | @@ -218,7 +248,8 @@ jobs: make clean - name: configure - run: ./configure FC=ifort CC=icc MPIFC=mpiifort + run: | + ./configure FC=ifort CC=icc MPIFC=mpiifort - name: make run: | @@ -226,8 +257,9 @@ jobs: make clean # fails due to MPI issue on virtual nodes - #- name: make tests - # run: make tests + - name: make tests + run: | + make tests linuxTest_0: name: Test run example 0 - make tests diff --git a/flags.guess b/flags.guess index 59792811d..b68f8bce5 100644 --- a/flags.guess +++ b/flags.guess @@ -99,10 +99,11 @@ case $my_FC in # I/O throughput lingers at 2.5 MB/s, with it it can increase to ~44 MB/s # However it does not make much of a difference on NFS mounted volumes or with SFS 3.1.1 / Lustre 1.6.7.1 # + # warnings about external function calls can be suppressed by "-warn all,noexternal" for version > 2018 # 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" # -mcmodel=medium -shared-intel + 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" + DEBUG_FFLAGS="-check all -debug -g -O0 -fp-stack-check -traceback" # -ftrapuv -init=snan,arrays # option "-openmp" is soon deprecated and replaced by "-qopenmp" for versions > 17.x OMP_FFLAGS="-qopenmp" ;; diff --git a/src/shared/parallel.f90 b/src/shared/parallel.f90 index a6847d538..3ca43da87 100644 --- a/src/shared/parallel.f90 +++ b/src/shared/parallel.f90 @@ -88,10 +88,10 @@ subroutine init_mpi() ! initialize the MPI communicator and start the NPROCTOT MPI processes. call MPI_INIT(ier) - if (ier /= 0 ) stop 'Error initializing MPI' + if (ier /= 0) stop 'Error initializing MPI' call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ier) - if (ier /= 0 ) stop 'Error getting MPI rank' + if (ier /= 0) stop 'Error getting MPI rank' ! we need to make sure that NUMBER_OF_SIMULTANEOUS_RUNS and BROADCAST_SAME_MESH_AND_MODEL are read before calling world_split() ! thus read the parameter file @@ -210,7 +210,7 @@ subroutine synchronize_all() ! synchronizes MPI processes call MPI_BARRIER(my_local_mpi_comm_world, ier) - if (ier /= 0 ) stop 'Error synchronize MPI processes' + if (ier /= 0) stop 'Error synchronize MPI processes' end subroutine synchronize_all @@ -231,7 +231,7 @@ subroutine synchronize_all_comm(comm) ! synchronizes MPI processes call MPI_BARRIER(comm,ier) - if (ier /= 0 ) stop 'Error synchronize MPI processes for specified communicator' + if (ier /= 0) stop 'Error synchronize MPI processes for specified communicator' end subroutine synchronize_all_comm @@ -787,7 +787,7 @@ subroutine max_allreduce_i(buffer,countval) send(:) = buffer(:) call MPI_ALLREDUCE(send, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier) - if (ier /= 0 ) stop 'Allreduce to get max values failed.' + if (ier /= 0) stop 'Allreduce to get max values failed.' end subroutine max_allreduce_i @@ -1771,7 +1771,7 @@ subroutine world_size(sizeval) integer :: ier call MPI_COMM_SIZE(my_local_mpi_comm_world,sizeval,ier) - if (ier /= 0 ) stop 'Error getting MPI world size' + if (ier /= 0) stop 'Error getting MPI world size' end subroutine world_size @@ -1792,7 +1792,7 @@ subroutine world_size_comm(sizeval,comm) integer :: ier call MPI_COMM_SIZE(comm,sizeval,ier) - if (ier /= 0 ) stop 'Error getting MPI world size' + if (ier /= 0) stop 'Error getting MPI world size' end subroutine world_size_comm @@ -1812,7 +1812,7 @@ subroutine world_rank(rank) integer :: ier call MPI_COMM_RANK(my_local_mpi_comm_world,rank,ier) - if (ier /= 0 ) stop 'Error getting MPI rank' + if (ier /= 0) stop 'Error getting MPI rank' end subroutine world_rank @@ -1833,7 +1833,7 @@ subroutine world_rank_comm(rank,comm) integer :: ier call MPI_COMM_RANK(comm,rank,ier) - if (ier /= 0 ) stop 'Error getting MPI rank' + if (ier /= 0) stop 'Error getting MPI rank' end subroutine world_rank_comm @@ -1861,7 +1861,7 @@ subroutine world_duplicate(comm) ! instead, a duplicate of a user-specified communicator should always be used." call MPI_COMM_DUP(my_local_mpi_comm_world,comm,ier) - if (ier /= 0 ) stop 'Error duplicating my_local_mpi_comm_world communicator' + if (ier /= 0) stop 'Error duplicating my_local_mpi_comm_world communicator' end subroutine world_duplicate @@ -1930,7 +1930,7 @@ subroutine world_comm_free(comm) integer :: ier call MPI_Comm_free(comm,ier) - if (ier /= 0 ) stop 'Error freeing MPI communicator' + if (ier /= 0) stop 'Error freeing MPI communicator' end subroutine world_comm_free diff --git a/tests/auxiliaries/1.run_write_profile.sh b/tests/auxiliaries/1.run_write_profile.sh index 117c4fb48..5571bc874 100755 --- a/tests/auxiliaries/1.run_write_profile.sh +++ b/tests/auxiliaries/1.run_write_profile.sh @@ -123,7 +123,7 @@ do rm -rf OUTPUT_FILES/* # MODEL s362ani profile - ./bin/xwrite_profile 1 1 47.5 -22.0 >> $testdir/results.log 2>&1 + mpirun -np 1 ./bin/xwrite_profile 1 1 47.5 -22.0 >> $testdir/results.log 2>&1 # checks exit code if [[ $? -ne 0 ]]; then @@ -141,6 +141,13 @@ do exit 1 fi + # debug + 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 From 4dca5e5662a0bd836eb0ec369337999677f9e188 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Fri, 1 Dec 2023 12:49:17 +0100 Subject: [PATCH 3/8] updates write_profile (tolerance checks) --- src/auxiliaries/write_profile.f90 | 35 ++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/auxiliaries/write_profile.f90 b/src/auxiliaries/write_profile.f90 index bc4beb6f8..a01567597 100644 --- a/src/auxiliaries/write_profile.f90 +++ b/src/auxiliaries/write_profile.f90 @@ -149,6 +149,9 @@ program xwrite_profile ! depth increment double precision :: delta + ! tolerance in checks for equal (==) float values + double precision, parameter :: TOL_ZERO = 1.d-12 + character(len=MAX_STRING_LEN) :: outfile character(len=7) :: str_info @@ -205,6 +208,17 @@ program xwrite_profile ilon_start = LON_istart ilon_end = LON_iend + ! initializes + iline = 0 + iline_icb = -1 + iline_cmb = -1 + iline_moho = -1 + iline_ocean = -1 + rmax_last = 0.0d0 + lat = 0.d0 + lon = 0.d0 + elevation = 0.d0 + ! checks program arguments count = command_argument_count() if (count == 0 .or. (count /= 2 .and. count /= 4)) call usage() @@ -410,12 +424,14 @@ program xwrite_profile ! make sure that the Moho discontinuity is at the real moho if (CRUSTAL) then - if (rmin == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) rmin = 1.0d0 - moho - if (rmax == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) rmax = 1.0d0 - moho + ! checks rmin == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET + if (abs(rmin - RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) < TOL_ZERO) rmin = 1.0d0 - moho + ! checks rmax == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET + if (abs(rmax - RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) < TOL_ZERO) rmax = 1.0d0 - moho !print *,'rmin == moho at line ',iline endif - if (abs(rmin - rmax_last) < 1.d-9) then !!!! rmin == rmax_last: this means that we have just jumped between layers + if (abs(rmin - rmax_last) < TOL_ZERO) then !!!! rmin == rmax_last: this means that we have just jumped between layers ! depth increment ! write values every 10 km in the deep earth and every 1 km in the shallow earth if (rmin > ((R_PLANET/1000.d0)-DELTA_HIRES_DEPTH)/(R_PLANET/1000.d0)) then @@ -430,7 +446,7 @@ program xwrite_profile ! sets maximum radius without ocean for 1D models if (((.not. CRUSTAL) .and. (ROCEAN < R_PLANET)) .and. (.not. TOPOGRAPHY)) then ! stops at ocean depth and adds last ocean layers explicitly - if (rmax == 1.0d0) rmax = ROCEAN/R_PLANET + if (abs(rmax - 1.0d0) < TOL_ZERO) rmax = ROCEAN/R_PLANET ! rmax == 1.d0 endif ! backup to detect jump between layers @@ -447,18 +463,18 @@ program xwrite_profile do idep = 1,nit+1 ! line counters ! inner core boundary - if (rmin == RICB/R_PLANET .and. idep == 1) iline_icb = iline + if (abs(rmin - RICB/R_PLANET) < TOL_ZERO .and. idep == 1) iline_icb = iline ! rmin == RICB/R_PLANET ! core mantle boundary - if (rmin == RCMB/R_PLANET .and. idep == 1) iline_cmb = iline + if (abs(rmin - RCMB/R_PLANET) < TOL_ZERO .and. idep == 1) iline_cmb = iline ! rmin == RCMB/R_PLANET ! moho if (CRUSTAL) then ! uses 3D crustal model (e.g. Crust2.0) - if (rmin == (1.0d0 - moho) .and. idep == 1) then + if (abs(rmin - (1.0d0 - moho)) < TOL_ZERO .and. idep == 1) then ! rmin == (1.0d0 - moho) iline_moho = iline endif else ! 1D crust from reference model - if (rmin == RMOHO/R_PLANET .and. idep == 1) iline_moho = iline + if (abs(rmin - RMOHO/R_PLANET) < TOL_ZERO .and. idep == 1) iline_moho = iline ! rmin == RMOHO/R_PLANET endif ! radius @@ -784,6 +800,9 @@ subroutine write_profile_elevation(theta,phi,elevation) ! local parameters double precision :: lat,lon + ! initializes + elevation = 0.d0 + ! topography elevation if (TOPOGRAPHY .or. OCEANS) then if (TOPOGRAPHY) then From a955a2ad22dccc6742f1dc09ccd53c5a9c1eab66 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Fri, 1 Dec 2023 13:48:10 +0100 Subject: [PATCH 4/8] updates check --- tests/auxiliaries/1.run_write_profile.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auxiliaries/1.run_write_profile.sh b/tests/auxiliaries/1.run_write_profile.sh index 5571bc874..7182ec0b5 100755 --- a/tests/auxiliaries/1.run_write_profile.sh +++ b/tests/auxiliaries/1.run_write_profile.sh @@ -20,8 +20,9 @@ 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 # compare radius - awk 'BEGIN{val=0;}{if(index($0,"#") == 0){val+=($1 - $10)**2;}}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>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 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; From db1f7d84365f27cd8358b8d841e50b3e5499c6e3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Fri, 1 Dec 2023 20:07:42 +0100 Subject: [PATCH 5/8] increases numerical accuracy for test in write_profile --- src/auxiliaries/write_profile.f90 | 25 +++++++----------------- tests/auxiliaries/1.run_write_profile.sh | 2 +- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/auxiliaries/write_profile.f90 b/src/auxiliaries/write_profile.f90 index a01567597..67f97f571 100644 --- a/src/auxiliaries/write_profile.f90 +++ b/src/auxiliaries/write_profile.f90 @@ -90,8 +90,8 @@ program xwrite_profile ! USER parameters ! initial position - double precision,parameter :: COLAT_0 = 1.0 - double precision,parameter :: LON_0 = 1.0 + double precision,parameter :: COLAT_0 = 1.d0 + double precision,parameter :: LON_0 = 1.d0 ! colatitude loop range (in degrees) integer,parameter :: COLAT_istart = 0 ! 0 @@ -208,17 +208,6 @@ program xwrite_profile ilon_start = LON_istart ilon_end = LON_iend - ! initializes - iline = 0 - iline_icb = -1 - iline_cmb = -1 - iline_moho = -1 - iline_ocean = -1 - rmax_last = 0.0d0 - lat = 0.d0 - lon = 0.d0 - elevation = 0.d0 - ! checks program arguments count = command_argument_count() if (count == 0 .or. (count /= 2 .and. count /= 4)) call usage() @@ -300,10 +289,10 @@ program xwrite_profile phi_degrees = initial_lon + j*delta_lon ! longitude [0,360] ! checks limits - if (theta_degrees < 0.0) stop 'Error invalid colatitude < 0' - if (theta_degrees > 180.0) stop 'Error invalid colatitude > 180' - if (phi_degrees < 0.0) phi_degrees = phi_degrees + 360.d0 - if (phi_degrees > 360.0) phi_degrees = phi_degrees - 360.d0 + if (theta_degrees < 0.d0) stop 'Error invalid colatitude < 0' + if (theta_degrees > 180.d0) stop 'Error invalid colatitude > 180' + if (phi_degrees < 0.d0) phi_degrees = phi_degrees + 360.d0 + if (phi_degrees > 360.d0) phi_degrees = phi_degrees - 360.d0 ! loads corresponding GLL mesh if (MODEL_GLL) call load_GLL_mesh(theta_degrees,phi_degrees) @@ -455,7 +444,7 @@ program xwrite_profile ! number of iterations in increments of delta between rmin and rmax ! note: instead of (rmax - rmin), we add a factor (rmax * 0.999999 - rmin) to avoid getting an extra step ! in case the difference is an exact delta match, since we add +1 to nit to reach rmax - nit = floor((rmax*0.9999999 - rmin)/delta) + 1 + nit = floor((rmax*0.99999999d0 - rmin)/delta) + 1 ! debug !print *,'debug: write profile ilayer/iregion ',ilayer,iregion_code,'rmin/rmax',rmin,rmax,'delta',delta,'nit',nit diff --git a/tests/auxiliaries/1.run_write_profile.sh b/tests/auxiliaries/1.run_write_profile.sh index 7182ec0b5..9924e8e60 100755 --- a/tests/auxiliaries/1.run_write_profile.sh +++ b/tests/auxiliaries/1.run_write_profile.sh @@ -28,7 +28,7 @@ my_test(){ 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;}}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;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; 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; From eebe8f252dcd32f86df88b217e2aa6922849c8a4 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Fri, 1 Dec 2023 22:07:01 +0100 Subject: [PATCH 6/8] updates write_profile --- src/auxiliaries/write_profile.f90 | 6 +++--- tests/auxiliaries/1.run_write_profile.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/auxiliaries/write_profile.f90 b/src/auxiliaries/write_profile.f90 index 67f97f571..ebf4a25f8 100644 --- a/src/auxiliaries/write_profile.f90 +++ b/src/auxiliaries/write_profile.f90 @@ -444,7 +444,7 @@ program xwrite_profile ! number of iterations in increments of delta between rmin and rmax ! note: instead of (rmax - rmin), we add a factor (rmax * 0.999999 - rmin) to avoid getting an extra step ! in case the difference is an exact delta match, since we add +1 to nit to reach rmax - nit = floor((rmax*0.99999999d0 - rmin)/delta) + 1 + nit = floor((rmax*0.9999999d0 - rmin)/delta) + 1 ! debug !print *,'debug: write profile ilayer/iregion ',ilayer,iregion_code,'rmin/rmax',rmin,rmax,'delta',delta,'nit',nit @@ -475,8 +475,8 @@ program xwrite_profile ! make sure we are within the right shell in PREM to honor discontinuities ! use small geometrical tolerance r_prem = r - if (r <= rmin*1.000001d0) r_prem = rmin*1.000001d0 - if (r >= rmax*0.999999d0) r_prem = rmax*0.999999d0 + if (r < rmin*1.000001d0) r_prem = rmin*1.000001d0 + if (r > rmax*0.999999d0) r_prem = rmax*0.999999d0 ! gets model properties (similar to get_model() routine) call write_profile_model_values(r,r_prem,theta,phi,iregion_code,idoubling,rmin,rmax, & diff --git a/tests/auxiliaries/1.run_write_profile.sh b/tests/auxiliaries/1.run_write_profile.sh index 9924e8e60..b03449b19 100755 --- a/tests/auxiliaries/1.run_write_profile.sh +++ b/tests/auxiliaries/1.run_write_profile.sh @@ -22,7 +22,8 @@ my_test(){ paste tmpA.dat tmpB.dat > tmp.dat; head -n 20 tmp.dat # compare radius - 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>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; 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; From 2cf6e0f720ae644c2f825054ed25d948ff44f1f3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 19 Dec 2023 11:50:19 +0100 Subject: [PATCH 7/8] fixes kernel runs w/out saving seismos --- src/specfem3D/setup_sources_receivers.f90 | 3 --- src/specfem3D/write_seismograms.f90 | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/specfem3D/setup_sources_receivers.f90 b/src/specfem3D/setup_sources_receivers.f90 index d51128d09..a56879f44 100644 --- a/src/specfem3D/setup_sources_receivers.f90 +++ b/src/specfem3D/setup_sources_receivers.f90 @@ -1247,9 +1247,6 @@ subroutine setup_receivers() do_save_seismograms = .true. endif - ! sets local receivers to zero if no seismogram needs to be saved - if (.not. do_save_seismograms) nrec_local = 0 - ! seismogram array length (to write out time portions of the full seismograms) nlength_seismogram = NTSTEP_BETWEEN_OUTPUT_SEISMOS / NTSTEP_BETWEEN_OUTPUT_SAMPLE diff --git a/src/specfem3D/write_seismograms.f90 b/src/specfem3D/write_seismograms.f90 index f42ecbbc5..73a7eda9a 100644 --- a/src/specfem3D/write_seismograms.f90 +++ b/src/specfem3D/write_seismograms.f90 @@ -40,7 +40,7 @@ subroutine write_seismograms() NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_OUTPUT_SAMPLE, & do_save_seismograms, & WRITE_SEISMOGRAMS_BY_MAIN,OUTPUT_SEISMOS_ASDF, & - SAVE_SEISMOGRAMS_IN_ADJOINT_RUN,SAVE_SEISMOGRAMS_STRAIN, & + SAVE_SEISMOGRAMS_STRAIN, & moment_der,sloc_der,shdur_der,stshift_der, & scale_displ @@ -173,7 +173,7 @@ subroutine write_seismograms() select case (SIMULATION_TYPE) case (1,3) ! forward/reconstructed wavefields - if (.not. ( SIMULATION_TYPE == 3 .and. (.not. SAVE_SEISMOGRAMS_IN_ADJOINT_RUN) ) ) & + if (do_save_seismograms) & call write_seismograms_to_file() if (SAVE_SEISMOGRAMS_STRAIN) & call write_seismograms_strain() From 921a7b10180390e585e651eb67a6bb1ea1d0d4f3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Tue, 19 Dec 2023 11:50:34 +0100 Subject: [PATCH 8/8] 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