Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gnu debug #178

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4584,8 +4584,9 @@ subroutine GEOS_openfile(FileOpenedHash, fname_full, fid, tile_coord, m_hinterp,
call FileOpenedHash%get(fname_full,fid)

if( fid == -9999 ) then ! not open yet
ierr=nf90_open(fname_full,IOR(NF90_NOWRITE, NF90_MPIIO), fid, &
comm = comm,info = MPI_INFO_NULL)
!ierr=nf90_open(fname_full,IOR(NF90_NOWRITE, NF90_MPIIO), fid, &
! comm = comm,info = MPI_INFO_NULL)
ierr=nf90_open(fname_full,NF90_NOWRITE, fid)

if(master_logit) then
write(logunit,*) "opening file: "//trim(fname_full)
Expand Down Expand Up @@ -4746,14 +4747,14 @@ end subroutine GEOS_openfile
subroutine GEOS_closefile(fid)
use netcdf
implicit none
integer,intent (inout) :: fid
integer,intent (in) :: fid
integer :: ierr

ierr = nf90_close(fid)
if(ierr /= nf90_noerr) then
print *, " error GEOS_closefile"
stop 2
endif
fid = -9999

endsubroutine
! ****************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ MODULE LDAS_HashTable
IMPLICIT NONE ! Use strong typing
private
INTEGER, PARAMETER :: tbl_size = 50
integer, parameter :: keylen = 512

TYPE nodelist
TYPE(nodelist), POINTER :: child => NULL()
Expand Down Expand Up @@ -35,11 +36,16 @@ RECURSIVE SUBROUTINE put_nodeinfo(list,key,fid)
CHARACTER(len=*), INTENT(in) :: key
integer, INTENT(in) :: fid
! local
INTEGER :: keylen
INTEGER :: klen

klen = LEN(key)
if ( klen > keylen) then
print*, key
stop (' key loo long')
endif

keylen = LEN(key)
IF (ALLOCATED(list%key)) THEN
IF (list%key /= key) THEN
IF (trim(list%key) /= trim(key)) THEN
IF ( .NOT. ASSOCIATED(list%child) ) then
ALLOCATE(list%child)
ENDIF
Expand All @@ -60,28 +66,34 @@ RECURSIVE SUBROUTINE get_nodeinfo(list,key,fid)
CHARACTER(len=*), INTENT(in) :: key
integer, INTENT(out) :: fid

IF (ALLOCATED(list%key) .AND. (list%key == key)) THEN
fid = list%fid
ELSE IF(ASSOCIATED(list%child)) THEN ! keep going
CALL get_nodeinfo(list%child,key,fid)
ELSE ! At the end of the list, no key found
fid = -9999
RETURN
END IF
if (ALLOCATED(list%key)) then
if (trim(list%key) == trim(key)) THEN
fid = list%fid
return
endif
endif

IF(ASSOCIATED(list%child)) THEN ! keep going
CALL get_nodeinfo(list%child,key,fid)
ELSE ! At the end of the list, no key found
fid = -9999
END IF

END SUBROUTINE get_nodeinfo

RECURSIVE SUBROUTINE free_nodeinfo(list,closefile)
CLASS(nodelist), INTENT(inout) :: list
external :: closefile
integer :: rc

IF (ASSOCIATED(list%child)) THEN
CALL free_nodeinfo(list%child, closefile )
DEALLOCATE(list%child)
END IF
list%child => NULL()
if (list%fid > 0) call closefile(list%fid)

IF (ALLOCATED(list%key)) then
DEALLOCATE(list%key)
call closefile(list%fid)
DEALLOCATE(list%key)
ENDIF

END SUBROUTINE free_nodeinfo
Expand Down Expand Up @@ -119,10 +131,10 @@ END FUNCTION sum_string

SUBROUTINE put_hash_table(tbl,key,fid)
CLASS(hash_table), INTENT(inout) :: tbl
CHARACTER(len=*), INTENT(in) :: key
integer, INTENT(in) :: fid
CHARACTER(len=*), INTENT(in) :: key
integer, INTENT(in) :: fid
!local
INTEGER :: hash
INTEGER :: hash

hash = MOD(sum_string(key),tbl%vec_len)
CALL tbl%vec(hash)%put(key,fid)
Expand Down