Handle a single pending local worker request, if any.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mbe_context_t), | intent(in) | :: | ctx | |||
| type(queue_t), | intent(inout) | :: | fragment_queue | |||
| integer(kind=int64), | intent(inout) | :: | worker_fragment_map(:) | |||
| integer, | intent(inout) | :: | local_finished_workers |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int64), | private | :: | fragment_idx | ||||
| logical, | private | :: | has_fragment | ||||
| logical, | private | :: | has_pending | ||||
| integer(kind=int32), | private | :: | local_dummy | ||||
| type(MPI_Status), | private | :: | local_status | ||||
| type(request_t), | private | :: | req |
subroutine handle_local_worker_requests(ctx, fragment_queue, worker_fragment_map, local_finished_workers) !! Handle a single pending local worker request, if any. use mqc_many_body_expansion, only: mbe_context_t type(mbe_context_t), intent(in) :: ctx type(queue_t), intent(inout) :: fragment_queue integer(int64), intent(inout) :: worker_fragment_map(:) integer, intent(inout) :: local_finished_workers integer(int64) :: fragment_idx integer(int32) :: local_dummy type(MPI_Status) :: local_status logical :: has_pending, has_fragment type(request_t) :: req call iprobe(ctx%resources%mpi_comms%node_comm, MPI_ANY_SOURCE, TAG_WORKER_REQUEST, has_pending, local_status) if (.not. has_pending) return if (worker_fragment_map(local_status%MPI_SOURCE) /= 0) return call irecv(ctx%resources%mpi_comms%node_comm, local_dummy, local_status%MPI_SOURCE, TAG_WORKER_REQUEST, req) call wait(req) call queue_pop(fragment_queue, fragment_idx, has_fragment) if (has_fragment) then call send_fragment_to_worker(ctx%resources%mpi_comms%node_comm, fragment_idx, ctx%polymers, local_status%MPI_SOURCE) worker_fragment_map(local_status%MPI_SOURCE) = fragment_idx else call isend(ctx%resources%mpi_comms%node_comm, -1, local_status%MPI_SOURCE, TAG_WORKER_FINISH, req) call wait(req) local_finished_workers = local_finished_workers + 1 end if end subroutine handle_local_worker_requests