Skip to content

Commit e5e90d8

Browse files
fix endrun exit issue
1 parent c742c1a commit e5e90d8

File tree

1 file changed

+12
-26
lines changed
  • GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOScatchCN_GridComp/GEOScatchCNCLM51_GridComp/CLM51

1 file changed

+12
-26
lines changed

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSland_GridComp/GEOScatchCN_GridComp/GEOScatchCNCLM51_GridComp/CLM51/shr_abort_mod.F90

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,46 +38,32 @@ module shr_abort_mod
3838
contains
3939

4040
!===============================================================================
41-
subroutine shr_abort_abort(string,ec,rc)
42-
! Consistent stopping mechanism
43-
41+
subroutine shr_abort_abort(string, ec, rc)
4442
!----- arguments -----
45-
character(len=*) , intent(in) , optional :: string ! error message string
46-
integer(shr_kind_in), intent(in) , optional :: ec ! error code
47-
integer(shr_kind_in), intent(out), optional :: rc ! error code
48-
49-
!----- local -----
50-
!logical :: flag
43+
character(len=*), intent(in), optional :: string
44+
integer(shr_kind_in), intent(in), optional :: ec
45+
integer(shr_kind_in), intent(out), optional :: rc
5146

52-
! Local version of the string.
53-
! (Gets a default value if string is not present.)
47+
!----- local -----
5448
character(len=shr_kind_cx) :: local_string
55-
!-------------------------------------------------------------------------------
49+
integer :: exit_code
5650

5751
if (present(string)) then
5852
local_string = trim(string)
5953
else
6054
local_string = "Unknown error submitted to shr_abort_abort."
6155
end if
6256

57+
! Log to stdout/stderr and flush.
6358
call print_error_to_logs("ERROR", local_string)
6459

65-
! call shr_abort_backtrace()
66-
67-
! call shr_mpi_initialized(flag)
68-
69-
if (present(ec)) then
70-
_ASSERT(.FALSE.,trim(local_string))
71-
else
72-
_ASSERT(.FALSE.,trim(local_string))
73-
endif
74-
75-
! A compiler's abort method may print a backtrace or do other nice
76-
! things, but in fact we can rarely leverage this, because MPI_Abort
77-
! usually sends SIGTERM to the process, and we don't catch that signal.
78-
!call abort()
60+
exit_code = 1
61+
if (present(ec)) exit_code = ec
62+
if (present(rc)) rc = exit_code
7963

64+
error stop "shr_abort_abort: hard abort" ! prints and exits nonzero
8065
end subroutine shr_abort_abort
66+
8167
!===============================================================================
8268

8369
!===============================================================================

0 commit comments

Comments
 (0)