Skip to content

Commit ccbd385

Browse files
authored
Merge pull request #830 from danielpeter/devel
updates tests; fixes issue w/ SAVE_SEISMOGRAMS_IN_ADJOINT_RUN
2 parents 996274e + 921a7b1 commit ccbd385

File tree

9 files changed

+125
-54
lines changed

9 files changed

+125
-54
lines changed

.github/workflows/CI.yml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
run: make tests
131131

132132
linuxCheck:
133-
name: Test on ${{ matrix.os }}
133+
name: Test on ${{ matrix.os }}
134134
runs-on: ${{ matrix.os }}
135135
needs: changesCheck
136136

@@ -147,7 +147,7 @@ jobs:
147147

148148
- name: configure
149149
run: ./configure
150-
150+
151151
- name: make
152152
run: make -j2 all
153153

@@ -176,31 +176,67 @@ jobs:
176176
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
177177
sudo apt-get update
178178
echo ""
179-
echo "packages intel oneapi:"
180-
sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mpi intel-oneapi-mpi-devel
179+
# info
180+
#sudo -E apt-cache pkgnames intel | grep intel-oneapi
181+
#echo ""
182+
echo "installing packages intel oneapi:"
183+
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
184+
echo ""
181185
182186
- name: compiler infos
183187
run: |
184188
echo ""
185189
source /opt/intel/oneapi/setvars.sh
186190
echo ""
187191
echo "compiler versions:"
192+
echo "icx --version"
193+
which icx
194+
icx --version
195+
echo ""
188196
echo "icc --version"
197+
which icc
189198
icc --version
199+
echo ""
200+
echo "ifx --version"
201+
which ifx
202+
ifx --version
203+
echo ""
190204
echo "ifort --version"
205+
which ifort
191206
ifort --version
207+
echo ""
192208
echo "mpiifort --version"
209+
which mpiifort
193210
mpiifort --version
211+
echo ""
194212
echo "mpif90 --version"
213+
which mpif90
214+
mpif90 --version
215+
echo ""
216+
# infos
217+
which ifort
218+
which icc
219+
which mpiifort
220+
echo "mpirun:"
221+
which mpirun
222+
echo ""
223+
# intel setup for running tests
224+
echo ""
225+
echo "replacing mpif90 with mpiifort link:"
226+
sudo ln -sf $(which mpiifort) $(which mpif90)
195227
mpif90 --version
196228
echo ""
229+
# debug
230+
#export I_MPI_DEBUG=5,pid,host
231+
#export I_MPI_LIBRARY_KIND=debug
232+
# remove -ftrapuv which leads to issues for running tests
233+
sed -i "s/-ftrapuv//g" flags.guess
234+
# environment setting
197235
export TERM=xterm
236+
# export info
198237
echo "exports:"
199238
export
200239
echo ""
201-
which ifort
202-
which icc
203-
which mpiifort
204240
echo ""
205241
printenv >> $GITHUB_ENV
206242
echo "CXX=icpc" >> $GITHUB_ENV
@@ -209,7 +245,8 @@ jobs:
209245
echo ""
210246
211247
- name: configure debug
212-
run: ./configure --enable-debug FC=ifort CC=icc MPIFC=mpiifort
248+
run: |
249+
./configure --enable-debug FC=ifort CC=icc MPIFC=mpiifort
213250
214251
- name: make debug
215252
run: |
@@ -218,16 +255,18 @@ jobs:
218255
make clean
219256
220257
- name: configure
221-
run: ./configure FC=ifort CC=icc MPIFC=mpiifort
258+
run: |
259+
./configure FC=ifort CC=icc MPIFC=mpiifort
222260
223261
- name: make
224262
run: |
225263
make -j2 all
226264
make clean
227265
228-
# fails due to MPI issue on virtual nodes
229-
#- name: make tests
230-
# run: make tests
266+
# note: fails with -ftrapuv flag due to MPI issue on virtual nodes
267+
- name: make tests
268+
run: |
269+
make tests
231270
232271
linuxTest_0:
233272
name: Test run example 0 - make tests

.travis.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,20 @@ before_install:
182182
#- test -n $CC && unset CC
183183

184184
# updates repository
185-
- |
186-
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
187-
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13
188-
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
189-
travis_retry sudo apt-get update
185+
# (fails currently...)
186+
#- |
187+
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
188+
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13
189+
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
190+
# apt explicit update
191+
#- |
192+
# echo "update apt-get"
193+
# travis_retry sudo apt-get update
194+
# echo
195+
addons:
196+
# apt update
197+
apt:
198+
update: true
190199

191200

192201
install:

flags.guess

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ case $my_FC in
9999
# I/O throughput lingers at 2.5 MB/s, with it it can increase to ~44 MB/s
100100
# However it does not make much of a difference on NFS mounted volumes or with SFS 3.1.1 / Lustre 1.6.7.1
101101
#
102+
# warnings about external function calls can be suppressed by "-warn all,noexternal" for version > 2018
102103
# optimization report: "-vec-report0" is old and will be replaced by "-qopt-report0 -qopt-report-phase=vec" for v >=15.0
103-
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
104+
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
104105
OPT_FFLAGS="-O3 -check nobounds"
105106
DEBUG_FFLAGS="-check all -debug -g -O0 -fp-stack-check -traceback -ftrapuv"
106107
# option "-openmp" is soon deprecated and replaced by "-qopenmp" for versions > 17.x

src/auxiliaries/write_profile.f90

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ program xwrite_profile
9090
! USER parameters
9191

9292
! initial position
93-
double precision,parameter :: COLAT_0 = 1.0
94-
double precision,parameter :: LON_0 = 1.0
93+
double precision,parameter :: COLAT_0 = 1.d0
94+
double precision,parameter :: LON_0 = 1.d0
9595

9696
! colatitude loop range (in degrees)
9797
integer,parameter :: COLAT_istart = 0 ! 0
@@ -149,6 +149,9 @@ program xwrite_profile
149149
! depth increment
150150
double precision :: delta
151151

152+
! tolerance in checks for equal (==) float values
153+
double precision, parameter :: TOL_ZERO = 1.d-12
154+
152155
character(len=MAX_STRING_LEN) :: outfile
153156
character(len=7) :: str_info
154157

@@ -286,10 +289,10 @@ program xwrite_profile
286289
phi_degrees = initial_lon + j*delta_lon ! longitude [0,360]
287290

288291
! checks limits
289-
if (theta_degrees < 0.0) stop 'Error invalid colatitude < 0'
290-
if (theta_degrees > 180.0) stop 'Error invalid colatitude > 180'
291-
if (phi_degrees < 0.0) phi_degrees = phi_degrees + 360.d0
292-
if (phi_degrees > 360.0) phi_degrees = phi_degrees - 360.d0
292+
if (theta_degrees < 0.d0) stop 'Error invalid colatitude < 0'
293+
if (theta_degrees > 180.d0) stop 'Error invalid colatitude > 180'
294+
if (phi_degrees < 0.d0) phi_degrees = phi_degrees + 360.d0
295+
if (phi_degrees > 360.d0) phi_degrees = phi_degrees - 360.d0
293296

294297
! loads corresponding GLL mesh
295298
if (MODEL_GLL) call load_GLL_mesh(theta_degrees,phi_degrees)
@@ -410,12 +413,14 @@ program xwrite_profile
410413

411414
! make sure that the Moho discontinuity is at the real moho
412415
if (CRUSTAL) then
413-
if (rmin == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) rmin = 1.0d0 - moho
414-
if (rmax == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) rmax = 1.0d0 - moho
416+
! checks rmin == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET
417+
if (abs(rmin - RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) < TOL_ZERO) rmin = 1.0d0 - moho
418+
! checks rmax == RMOHO_FICTITIOUS_IN_MESHER/R_PLANET
419+
if (abs(rmax - RMOHO_FICTITIOUS_IN_MESHER/R_PLANET) < TOL_ZERO) rmax = 1.0d0 - moho
415420
!print *,'rmin == moho at line ',iline
416421
endif
417422

418-
if (abs(rmin - rmax_last) < 1.d-9) then !!!! rmin == rmax_last: this means that we have just jumped between layers
423+
if (abs(rmin - rmax_last) < TOL_ZERO) then !!!! rmin == rmax_last: this means that we have just jumped between layers
419424
! depth increment
420425
! write values every 10 km in the deep earth and every 1 km in the shallow earth
421426
if (rmin > ((R_PLANET/1000.d0)-DELTA_HIRES_DEPTH)/(R_PLANET/1000.d0)) then
@@ -430,7 +435,7 @@ program xwrite_profile
430435
! sets maximum radius without ocean for 1D models
431436
if (((.not. CRUSTAL) .and. (ROCEAN < R_PLANET)) .and. (.not. TOPOGRAPHY)) then
432437
! stops at ocean depth and adds last ocean layers explicitly
433-
if (rmax == 1.0d0) rmax = ROCEAN/R_PLANET
438+
if (abs(rmax - 1.0d0) < TOL_ZERO) rmax = ROCEAN/R_PLANET ! rmax == 1.d0
434439
endif
435440

436441
! backup to detect jump between layers
@@ -439,26 +444,26 @@ program xwrite_profile
439444
! number of iterations in increments of delta between rmin and rmax
440445
! note: instead of (rmax - rmin), we add a factor (rmax * 0.999999 - rmin) to avoid getting an extra step
441446
! in case the difference is an exact delta match, since we add +1 to nit to reach rmax
442-
nit = floor((rmax*0.9999999 - rmin)/delta) + 1
447+
nit = floor((rmax*0.9999999d0 - rmin)/delta) + 1
443448

444449
! debug
445450
!print *,'debug: write profile ilayer/iregion ',ilayer,iregion_code,'rmin/rmax',rmin,rmax,'delta',delta,'nit',nit
446451

447452
do idep = 1,nit+1
448453
! line counters
449454
! inner core boundary
450-
if (rmin == RICB/R_PLANET .and. idep == 1) iline_icb = iline
455+
if (abs(rmin - RICB/R_PLANET) < TOL_ZERO .and. idep == 1) iline_icb = iline ! rmin == RICB/R_PLANET
451456
! core mantle boundary
452-
if (rmin == RCMB/R_PLANET .and. idep == 1) iline_cmb = iline
457+
if (abs(rmin - RCMB/R_PLANET) < TOL_ZERO .and. idep == 1) iline_cmb = iline ! rmin == RCMB/R_PLANET
453458
! moho
454459
if (CRUSTAL) then
455460
! uses 3D crustal model (e.g. Crust2.0)
456-
if (rmin == (1.0d0 - moho) .and. idep == 1) then
461+
if (abs(rmin - (1.0d0 - moho)) < TOL_ZERO .and. idep == 1) then ! rmin == (1.0d0 - moho)
457462
iline_moho = iline
458463
endif
459464
else
460465
! 1D crust from reference model
461-
if (rmin == RMOHO/R_PLANET .and. idep == 1) iline_moho = iline
466+
if (abs(rmin - RMOHO/R_PLANET) < TOL_ZERO .and. idep == 1) iline_moho = iline ! rmin == RMOHO/R_PLANET
462467
endif
463468

464469
! radius
@@ -470,8 +475,8 @@ program xwrite_profile
470475
! make sure we are within the right shell in PREM to honor discontinuities
471476
! use small geometrical tolerance
472477
r_prem = r
473-
if (r <= rmin*1.000001d0) r_prem = rmin*1.000001d0
474-
if (r >= rmax*0.999999d0) r_prem = rmax*0.999999d0
478+
if (r < rmin*1.000001d0) r_prem = rmin*1.000001d0
479+
if (r > rmax*0.999999d0) r_prem = rmax*0.999999d0
475480

476481
! gets model properties (similar to get_model() routine)
477482
call write_profile_model_values(r,r_prem,theta,phi,iregion_code,idoubling,rmin,rmax, &
@@ -784,6 +789,9 @@ subroutine write_profile_elevation(theta,phi,elevation)
784789
! local parameters
785790
double precision :: lat,lon
786791

792+
! initializes
793+
elevation = 0.d0
794+
787795
! topography elevation
788796
if (TOPOGRAPHY .or. OCEANS) then
789797
if (TOPOGRAPHY) then

src/shared/parallel.f90

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ subroutine init_mpi()
8888

8989
! initialize the MPI communicator and start the NPROCTOT MPI processes.
9090
call MPI_INIT(ier)
91-
if (ier /= 0 ) stop 'Error initializing MPI'
91+
if (ier /= 0) stop 'Error initializing MPI'
9292

9393
call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ier)
94-
if (ier /= 0 ) stop 'Error getting MPI rank'
94+
if (ier /= 0) stop 'Error getting MPI rank'
9595

9696
! we need to make sure that NUMBER_OF_SIMULTANEOUS_RUNS and BROADCAST_SAME_MESH_AND_MODEL are read before calling world_split()
9797
! thus read the parameter file
@@ -210,7 +210,7 @@ subroutine synchronize_all()
210210

211211
! synchronizes MPI processes
212212
call MPI_BARRIER(my_local_mpi_comm_world, ier)
213-
if (ier /= 0 ) stop 'Error synchronize MPI processes'
213+
if (ier /= 0) stop 'Error synchronize MPI processes'
214214

215215
end subroutine synchronize_all
216216

@@ -231,7 +231,7 @@ subroutine synchronize_all_comm(comm)
231231

232232
! synchronizes MPI processes
233233
call MPI_BARRIER(comm,ier)
234-
if (ier /= 0 ) stop 'Error synchronize MPI processes for specified communicator'
234+
if (ier /= 0) stop 'Error synchronize MPI processes for specified communicator'
235235

236236
end subroutine synchronize_all_comm
237237

@@ -787,7 +787,7 @@ subroutine max_allreduce_i(buffer,countval)
787787
send(:) = buffer(:)
788788

789789
call MPI_ALLREDUCE(send, buffer, countval, MPI_INTEGER, MPI_MAX, my_local_mpi_comm_world, ier)
790-
if (ier /= 0 ) stop 'Allreduce to get max values failed.'
790+
if (ier /= 0) stop 'Allreduce to get max values failed.'
791791

792792
end subroutine max_allreduce_i
793793

@@ -1771,7 +1771,7 @@ subroutine world_size(sizeval)
17711771
integer :: ier
17721772

17731773
call MPI_COMM_SIZE(my_local_mpi_comm_world,sizeval,ier)
1774-
if (ier /= 0 ) stop 'Error getting MPI world size'
1774+
if (ier /= 0) stop 'Error getting MPI world size'
17751775

17761776
end subroutine world_size
17771777

@@ -1792,7 +1792,7 @@ subroutine world_size_comm(sizeval,comm)
17921792
integer :: ier
17931793

17941794
call MPI_COMM_SIZE(comm,sizeval,ier)
1795-
if (ier /= 0 ) stop 'Error getting MPI world size'
1795+
if (ier /= 0) stop 'Error getting MPI world size'
17961796

17971797
end subroutine world_size_comm
17981798

@@ -1812,7 +1812,7 @@ subroutine world_rank(rank)
18121812
integer :: ier
18131813

18141814
call MPI_COMM_RANK(my_local_mpi_comm_world,rank,ier)
1815-
if (ier /= 0 ) stop 'Error getting MPI rank'
1815+
if (ier /= 0) stop 'Error getting MPI rank'
18161816

18171817
end subroutine world_rank
18181818

@@ -1833,7 +1833,7 @@ subroutine world_rank_comm(rank,comm)
18331833
integer :: ier
18341834

18351835
call MPI_COMM_RANK(comm,rank,ier)
1836-
if (ier /= 0 ) stop 'Error getting MPI rank'
1836+
if (ier /= 0) stop 'Error getting MPI rank'
18371837

18381838
end subroutine world_rank_comm
18391839

@@ -1861,7 +1861,7 @@ subroutine world_duplicate(comm)
18611861
! instead, a duplicate of a user-specified communicator should always be used."
18621862

18631863
call MPI_COMM_DUP(my_local_mpi_comm_world,comm,ier)
1864-
if (ier /= 0 ) stop 'Error duplicating my_local_mpi_comm_world communicator'
1864+
if (ier /= 0) stop 'Error duplicating my_local_mpi_comm_world communicator'
18651865

18661866
end subroutine world_duplicate
18671867

@@ -1930,7 +1930,7 @@ subroutine world_comm_free(comm)
19301930
integer :: ier
19311931

19321932
call MPI_Comm_free(comm,ier)
1933-
if (ier /= 0 ) stop 'Error freeing MPI communicator'
1933+
if (ier /= 0) stop 'Error freeing MPI communicator'
19341934

19351935
end subroutine world_comm_free
19361936

src/specfem3D/setup_sources_receivers.f90

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,9 +1247,6 @@ subroutine setup_receivers()
12471247
do_save_seismograms = .true.
12481248
endif
12491249

1250-
! sets local receivers to zero if no seismogram needs to be saved
1251-
if (.not. do_save_seismograms) nrec_local = 0
1252-
12531250
! seismogram array length (to write out time portions of the full seismograms)
12541251
nlength_seismogram = NTSTEP_BETWEEN_OUTPUT_SEISMOS / NTSTEP_BETWEEN_OUTPUT_SAMPLE
12551252

src/specfem3D/write_seismograms.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ subroutine write_seismograms()
4040
NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_OUTPUT_SAMPLE, &
4141
do_save_seismograms, &
4242
WRITE_SEISMOGRAMS_BY_MAIN,OUTPUT_SEISMOS_ASDF, &
43-
SAVE_SEISMOGRAMS_IN_ADJOINT_RUN,SAVE_SEISMOGRAMS_STRAIN, &
43+
SAVE_SEISMOGRAMS_STRAIN, &
4444
moment_der,sloc_der,shdur_der,stshift_der, &
4545
scale_displ
4646

@@ -173,7 +173,7 @@ subroutine write_seismograms()
173173
select case (SIMULATION_TYPE)
174174
case (1,3)
175175
! forward/reconstructed wavefields
176-
if (.not. ( SIMULATION_TYPE == 3 .and. (.not. SAVE_SEISMOGRAMS_IN_ADJOINT_RUN) ) ) &
176+
if (do_save_seismograms) &
177177
call write_seismograms_to_file()
178178
if (SAVE_SEISMOGRAMS_STRAIN) &
179179
call write_seismograms_strain()

0 commit comments

Comments
 (0)