handle_local_worker_requests_group Subroutine

private subroutine handle_local_worker_requests_group(resources, term_queue, term_ids, atom_sets, worker_term_map, local_finished_workers)

Uses

  • proc~~handle_local_worker_requests_group~2~~UsesGraph proc~handle_local_worker_requests_group~2 handle_local_worker_requests_group module~mqc_resources mqc_resources proc~handle_local_worker_requests_group~2->module~mqc_resources module~mqc_mpi_comms mqc_mpi_comms module~mqc_resources->module~mqc_mpi_comms pic_mpi_lib pic_mpi_lib module~mqc_mpi_comms->pic_mpi_lib

Arguments

Type IntentOptional Attributes Name
type(resources_t), intent(in) :: resources
type(queue_t), intent(inout) :: term_queue
integer(kind=int64), intent(in) :: term_ids(:)
integer, intent(in) :: atom_sets(:,:)
integer(kind=int64), intent(inout) :: worker_term_map(:)
integer, intent(inout) :: local_finished_workers

Calls

proc~~handle_local_worker_requests_group~2~~CallsGraph proc~handle_local_worker_requests_group~2 handle_local_worker_requests_group iprobe iprobe proc~handle_local_worker_requests_group~2->iprobe irecv irecv proc~handle_local_worker_requests_group~2->irecv isend isend proc~handle_local_worker_requests_group~2->isend proc~queue_pop queue_pop proc~handle_local_worker_requests_group~2->proc~queue_pop proc~send_pie_term_payload send_pie_term_payload proc~handle_local_worker_requests_group~2->proc~send_pie_term_payload proc~send_pie_term_payload->isend

Called by

proc~~handle_local_worker_requests_group~2~~CalledByGraph proc~handle_local_worker_requests_group~2 handle_local_worker_requests_group proc~gmbe_group_global_coordinator gmbe_group_global_coordinator proc~gmbe_group_global_coordinator->proc~handle_local_worker_requests_group~2 proc~gmbe_pie_coordinator gmbe_pie_coordinator proc~gmbe_pie_coordinator->proc~handle_local_worker_requests_group~2 proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->proc~gmbe_group_global_coordinator proc~gmbe_run_distributed->proc~gmbe_pie_coordinator

Variables

Type Visibility Attributes Name Initial
logical, private :: has_item
logical, private :: has_pending
integer(kind=int32), private :: local_dummy
integer(kind=int64), private :: local_idx
type(MPI_Status), private :: local_status
type(request_t), private :: req
integer(kind=int64), private :: term_idx

Source Code

   subroutine handle_local_worker_requests_group(resources, term_queue, term_ids, atom_sets, &
                                                 worker_term_map, local_finished_workers)
      use mqc_resources, only: resources_t
      type(resources_t), intent(in) :: resources
      type(queue_t), intent(inout) :: term_queue
      integer(int64), intent(in) :: term_ids(:)
      integer, intent(in) :: atom_sets(:, :)
      integer(int64), intent(inout) :: worker_term_map(:)
      integer, intent(inout) :: local_finished_workers

      integer(int64) :: local_idx, term_idx
      integer(int32) :: local_dummy
      type(MPI_Status) :: local_status
      logical :: has_pending, has_item
      type(request_t) :: req

      call iprobe(resources%mpi_comms%node_comm, MPI_ANY_SOURCE, TAG_WORKER_REQUEST, has_pending, local_status)
      if (.not. has_pending) return

      if (worker_term_map(local_status%MPI_SOURCE) /= 0) return

      call irecv(resources%mpi_comms%node_comm, local_dummy, local_status%MPI_SOURCE, TAG_WORKER_REQUEST, req)
      call wait(req)

      call queue_pop(term_queue, local_idx, has_item)
      if (has_item) then
         term_idx = term_ids(local_idx)
         call send_pie_term_payload(resources%mpi_comms%node_comm, TAG_WORKER_FRAGMENT, term_idx, &
                                    atom_sets(:, local_idx), local_status%MPI_SOURCE)
         worker_term_map(local_status%MPI_SOURCE) = term_idx
      else
         call isend(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_group