Skip to content

Commit

Permalink
:eature/mpi_abort Fix mpi_abort calls in chgres_cube and
Browse files Browse the repository at this point in the history
sfc_climo_gen.

Issue ufs-community#140.
  • Loading branch information
GeorgeGayno-NOAA authored and climbfuji committed Sep 25, 2020
1 parent 7123831 commit 790a760
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 7 additions & 2 deletions sorc/chgres_cube.fd/utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ subroutine error_handler(string, rc)

implicit none

include 'mpif.h'

character(len=*), intent(in) :: string

integer, intent(in) :: rc

integer :: ierr

print*,"- FATAL ERROR: ", string
print*,"- IOSTAT IS: ", rc
call mpi_abort
call mpi_abort(mpi_comm_world, 999, ierr)

end subroutine error_handler

Expand All @@ -20,6 +24,7 @@ subroutine netcdf_err( err, string )
integer, intent(in) :: err
character(len=*), intent(in) :: string
character(len=256) :: errmsg
integer :: iret

include "mpif.h"

Expand All @@ -28,7 +33,7 @@ subroutine netcdf_err( err, string )
print*,''
print*,'FATAL ERROR: ', trim(string), ': ', trim(errmsg)
print*,'STOP.'
call mpi_abort(mpi_comm_world, 999)
call mpi_abort(mpi_comm_world, 999, iret)

return
end subroutine netcdf_err
Expand Down
4 changes: 2 additions & 2 deletions sorc/sfc_climo_gen.fd/interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)

integer, parameter :: landice=15

integer :: i, j
integer :: i, j, ierr

real :: landice_value

Expand Down Expand Up @@ -348,7 +348,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)
enddo
case default
print*,'- FATAL ERROR IN ROUTINE ADJUST_FOR_LANDICE. UNIDENTIFIED FIELD : ', field_ch
call mpi_abort(mpi_comm_world, 57)
call mpi_abort(mpi_comm_world, 57, ierr)
end select

end subroutine adjust_for_landice
6 changes: 4 additions & 2 deletions sorc/sfc_climo_gen.fd/model_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ subroutine define_model_grid(localpet, npets)

implicit none

include 'mpif.h'

integer, intent(in) :: localpet, npets

character(len=500) :: the_file

integer :: error, id_dim, id_tiles, ncid
integer :: id_grid_tiles
integer :: id_grid_tiles, ierr
integer :: extra, rc, tile
integer, allocatable :: decomptile(:,:)

Expand Down Expand Up @@ -124,7 +126,7 @@ subroutine define_model_grid(localpet, npets)
if (mod(npets,num_tiles) /= 0) then
print*,'- FATAL ERROR: MUST RUN THIS PROGRAM WITH A TASK COUNT THAT'
print*,'- IS A MULTIPLE OF THE NUMBER OF TILES.'
call mpi_abort
call mpi_abort(mpi_comm_world, 44, ierr)
endif

!-----------------------------------------------------------------------
Expand Down

0 comments on commit 790a760

Please sign in to comment.