Skip to content

Commit

Permalink
Merge branch 'user/z1l/bugfix' into dev/master
Browse files Browse the repository at this point in the history
* Modify mpp_error not calling stdout and add naming omp critical
  section for land model.
* update sat_vapor_pressure.F90 to only call stdout in initialiazaton
  routine.
* Update memutils.F90 to only open the file /proc/self/status on the
  first call of mem_dump.
  • Loading branch information
underwoo committed Feb 26, 2016
2 parents 8e6a215 + 8dc735d commit e1f15ba
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 64 deletions.
12 changes: 8 additions & 4 deletions memutils/memutils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,20 @@ subroutine mem_dump ( memuse )

character(len=32) :: file_name = '/proc/self/status'
character(len=32) :: string
integer :: mem_unit
integer, save :: mem_unit = -1
real :: multiplier

memuse = 0.0
multiplier = 1.0

if(mem_unit == -1) then
call mpp_open ( mem_unit, file_name, &
form=MPP_ASCII, action=MPP_RDONLY, &
access=MPP_SEQUENTIAL, threading=MPP_SINGLE )

else
rewind(mem_unit)
endif

do; read (mem_unit,'(a)', end=10) string
if ( INDEX ( string, 'VmHWM:' ) == 1 ) then
read (string(7:LEN_TRIM(string)-2),*) memuse
Expand All @@ -333,8 +337,8 @@ subroutine mem_dump ( memuse )
if (TRIM(string(LEN_TRIM(string)-1:)) == "kB" ) &
multiplier = 1.0/1024. ! Convert from kB to MB

10 call mpp_close ( mem_unit )
memuse = memuse * multiplier
!10 call mpp_close ( mem_unit )
10 memuse = memuse * multiplier

return
end subroutine mem_dump
Expand Down
13 changes: 7 additions & 6 deletions mpp/include/mpp_util_mpi.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subroutine mpp_error_basic( errortype, errormsg )
character(len=*), intent(in), optional :: errormsg
character(len=512) :: text
logical :: opened
integer :: istat, out_unit, errunit
integer :: istat, errunit

if( .NOT.module_is_initialized )call ABORT()

Expand All @@ -31,19 +31,18 @@ subroutine mpp_error_basic( errortype, errormsg )

if( npes.GT.1 )write( text,'(a,i6)' )trim(text)//' from PE', pe !this is the mpp part
if( PRESENT(errormsg) )text = trim(text)//': '//trim(errormsg)

out_unit = stdout()
!$OMP CRITICAL (MPP_ERROR_CRITICAL)
select case( errortype )
case(NOTE)
write( out_unit,'(a)' )trim(text)
if(pe==root_pe)write( out_unit,'(a)' )trim(text)
case default
errunit = stderr()
#ifdef __SX
write( errunit, * )trim(text)
#else
write( errunit, '(/a/)' )trim(text)
#endif
write( out_unit,'(/a/)' )trim(text)
if(pe==root_pe)write( out_unit,'(/a/)' )trim(text)
if( errortype.EQ.FATAL .OR. warnings_are_fatal )then
call FLUSH(out_unit)
#ifdef sgi_mipspro
Expand All @@ -54,7 +53,9 @@ subroutine mpp_error_basic( errortype, errormsg )
end select

error_state = errortype
return
!$OMP END CRITICAL (MPP_ERROR_CRITICAL)


end subroutine mpp_error_basic

!#####################################################################
Expand Down
Loading

0 comments on commit e1f15ba

Please sign in to comment.