receive_group_assignment_matrix Subroutine

public subroutine receive_group_assignment_matrix(world_comm, ids, matrix)

Receive shard-assignment ids and polymer matrix from rank 0.

Arguments

Type IntentOptional Attributes Name
type(comm_t), intent(in) :: world_comm
integer(kind=int64), intent(out), allocatable :: ids(:)
integer, intent(out), allocatable :: matrix(:,:)

Calls

proc~~receive_group_assignment_matrix~~CallsGraph proc~receive_group_assignment_matrix receive_group_assignment_matrix irecv irecv proc~receive_group_assignment_matrix->irecv recv recv proc~receive_group_assignment_matrix->recv

Called by

proc~~receive_group_assignment_matrix~~CalledByGraph proc~receive_group_assignment_matrix receive_group_assignment_matrix proc~gmbe_group_global_coordinator gmbe_group_global_coordinator proc~gmbe_group_global_coordinator->proc~receive_group_assignment_matrix proc~group_global_coordinator_impl group_global_coordinator_impl proc~group_global_coordinator_impl->proc~receive_group_assignment_matrix proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->proc~gmbe_group_global_coordinator interface~node_coordinator node_coordinator proc~gmbe_run_distributed->interface~node_coordinator proc~node_coordinator_impl node_coordinator_impl proc~node_coordinator_impl->proc~group_global_coordinator_impl proc~node_coordinator node_coordinator proc~node_coordinator->proc~node_coordinator_impl interface~node_coordinator->proc~node_coordinator proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->interface~node_coordinator

Variables

Type Visibility Attributes Name Initial
integer, private, allocatable :: buf(:)
integer(kind=int32), private :: n_cols
integer(kind=int64), private :: n_rows
type(request_t), private :: req
type(MPI_Status), private :: status

Source Code

   subroutine receive_group_assignment_matrix(world_comm, ids, matrix)
      !! Receive shard-assignment ids and polymer matrix from rank 0.
      type(comm_t), intent(in) :: world_comm
      integer(int64), allocatable, intent(out) :: ids(:)
      integer, allocatable, intent(out) :: matrix(:, :)

      integer(int64) :: n_rows
      integer(int32) :: n_cols
      integer, allocatable :: buf(:)
      type(MPI_Status) :: status
      type(request_t) :: req

      call irecv(world_comm, n_rows, 0, TAG_GROUP_ASSIGN, req)
      call wait(req)
      allocate (ids(n_rows))
      call recv(world_comm, ids, 0, TAG_GROUP_ASSIGN, status)

      call irecv(world_comm, n_cols, 0, TAG_GROUP_POLYMERS, req)
      call wait(req)
      allocate (matrix(int(n_rows), n_cols))

      if (n_rows > 0_int64 .and. n_cols > 0) then
         allocate (buf(n_rows*n_cols))
         call recv(world_comm, buf, 0, TAG_GROUP_POLYMERS, status)
         matrix = reshape(buf, [int(n_rows), n_cols])
         deallocate (buf)
      else
         allocate (buf(0))
         call recv(world_comm, buf, 0, TAG_GROUP_POLYMERS, status)
         deallocate (buf)
      end if
   end subroutine receive_group_assignment_matrix