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

avoid "done" message when there is no request #2808

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ 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
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