Skip to content

Commit

Permalink
Fixup 06146f9 - Have all ranks error stop on failed correctness check (
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Sep 7, 2023
1 parent f7a9608 commit 03e3282
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions src/programs/ectrans-benchmark.F90
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ program transform_test

character(len=16) :: cgrid = ''

integer :: ierr
integer(kind=jpim) :: ierr

!===================================================================================================

Expand Down Expand Up @@ -801,31 +801,30 @@ program transform_test
write(nout,*)
write(nout,'("max error combined = = ",e10.3)') zmaxerrg
write(nout,*)

if (ncheck > 0) then
ierr = 0
if (myproc == 1) then
! If the maximum spectral norm error across all fields is greater than 100 times the machine
! epsilon, fail the test
if (zmaxerrg > real(ncheck, jprb) * epsilon(1.0_jprb)) then
write(nout, '(a)') '*******************************'
write(nout, '(a)') 'Correctness test failed'
write(nout, '(a,1e7.2)') 'Maximum spectral norm error = ', zmaxerrg
write(nout, '(a,1e7.2)') 'Error tolerance = ', real(ncheck, jprb) * epsilon(1.0_jprb)
write(nout, '(a)') '*******************************'
ierr = 1
endif
endif
if (ncheck > 0) then
ierr = 0
if (myproc == 1) then
! If the maximum spectral norm error across all fields is greater than 100 times the machine
! epsilon, fail the test
if (zmaxerrg > real(ncheck, jprb) * epsilon(1.0_jprb)) then
write(nout, '(a)') '*******************************'
write(nout, '(a)') 'Correctness test failed'
write(nout, '(a,1e7.2)') 'Maximum spectral norm error = ', zmaxerrg
write(nout, '(a,1e7.2)') 'Error tolerance = ', real(ncheck, jprb) * epsilon(1.0_jprb)
write(nout, '(a)') '*******************************'
ierr = 1
endif
endif

! Root rank broadcasts the correctness checker result to the other ranks
if (luse_mpi) then
call mpl_broadcast(ierr, ktag=0)
endif
! Root rank broadcasts the correctness checker result to the other ranks
if (luse_mpi) then
call mpl_broadcast(ierr,kroot=1,ktag=1)
endif

! Halt if correctness checker failed
if (ierr == 1) then
error stop
endif
! Halt if correctness checker failed
if (ierr == 1) then
error stop
endif
endif
endif
Expand Down

0 comments on commit 03e3282

Please sign in to comment.