Skip to content

Commit

Permalink
Merge pull request #2808 from GEOS-ESM/feature/wjiang/no_done
Browse files Browse the repository at this point in the history
avoid "done" message when there is no request
  • Loading branch information
mathomp4 authored May 20, 2024
2 parents 8cc8dbd + a47cd28 commit 8ddd7bc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- pFIO Clients don't send "Done" message when there is no request
- Update `components.yaml`
- ESMA_cmake v3.45.1
- Fix bug in meson detection
- Updated `checkpoint_simulator` to not create and close file if not writing

### Fixed
Expand Down
12 changes: 12 additions & 0 deletions pfio/BaseThread.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module pFIO_BaseThreadMod
procedure :: clear_RequestHandle
procedure :: get_RequestHandle
procedure :: insert_RequestHandle
procedure :: isEmpty_RequestHandle
end type BaseThread

contains
Expand Down Expand Up @@ -66,6 +67,17 @@ function get_RequestHandle(this,request_id, rc) result(rh_ptr)
_RETURN(_SUCCESS)
end function get_RequestHandle

function isEmpty_RequestHandle(this, rc) result(empty)
class (BaseThread), target, intent(in) :: this
integer, optional, intent(out) :: rc
logical :: empty
type (IntegerRequestMapIterator) :: iter

iter = this%open_requests%begin()
empty = (iter == this%open_requests%end())
_RETURN(_SUCCESS)
end function isEmpty_RequestHandle

subroutine insert_RequestHandle(this,request_id, handle, rc)
class (BaseThread), target, intent(inout) :: this
integer, intent(in) :: request_id
Expand Down
16 changes: 16 additions & 0 deletions pfio/ClientThread.F90
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ subroutine done_prefetch(this, rc)
class(AbstractSocket),pointer :: connection
integer :: status

if (this%isEmpty_RequestHandle()) then
_RETURN(_SUCCESS)
endif

connection=>this%get_connection()
call connection%send(PrefetchDoneMessage(),_RC)
_RETURN(_SUCCESS)
Expand All @@ -420,6 +424,10 @@ subroutine done_collective_prefetch(this, rc)
integer, optional, intent(out) :: rc
class(AbstractSocket),pointer :: connection
integer :: status

if (this%isEmpty_RequestHandle()) then
_RETURN(_SUCCESS)
endif

connection=>this%get_connection()
call connection%send(CollectivePrefetchDoneMessage(),_RC)
Expand All @@ -432,6 +440,10 @@ subroutine done_stage(this, rc)
class(AbstractSocket),pointer :: connection
integer :: status

if (this%isEmpty_RequestHandle()) then
_RETURN(_SUCCESS)
endif

connection=>this%get_connection()
call connection%send(StageDoneMessage(),_RC)
_RETURN(_SUCCESS)
Expand All @@ -443,6 +455,10 @@ subroutine done_collective_stage(this, rc)
class(AbstractSocket),pointer :: connection
integer :: status

if (this%isEmpty_RequestHandle()) then
_RETURN(_SUCCESS)
endif

connection=>this%get_connection()
call connection%send(CollectiveStageDoneMessage(),_RC)
_RETURN(_SUCCESS)
Expand Down

0 comments on commit 8ddd7bc

Please sign in to comment.