send_fragment_to_node Subroutine

subroutine send_fragment_to_node(world_comm, fragment_idx, polymers, dest_rank)

Send fragment data to remote node coordinator Uses int64 for fragment_idx to handle large fragment indices that overflow int32.

Arguments

Type IntentOptional Attributes Name
type(comm_t), intent(in) :: world_comm
integer(kind=int64), intent(in) :: fragment_idx
integer, intent(in) :: polymers(:,:)
integer, intent(in) :: dest_rank

Calls

proc~~send_fragment_to_node~~CallsGraph proc~send_fragment_to_node send_fragment_to_node isend isend proc~send_fragment_to_node->isend

Called by

proc~~send_fragment_to_node~~CalledByGraph proc~send_fragment_to_node send_fragment_to_node proc~global_coordinator global_coordinator proc~global_coordinator->proc~send_fragment_to_node interface~global_coordinator global_coordinator interface~global_coordinator->proc~global_coordinator proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->interface~global_coordinator

Variables

Type Visibility Attributes Name Initial
integer(kind=int64), private :: fragment_idx_int64
integer, private, allocatable :: fragment_indices(:)
integer, private :: fragment_size
integer(kind=int32), private :: fragment_type
type(request_t), private :: req(4)

Source Code

   subroutine send_fragment_to_node(world_comm, fragment_idx, polymers, dest_rank)
      !! Send fragment data to remote node coordinator
      !! Uses int64 for fragment_idx to handle large fragment indices that overflow int32.
      type(comm_t), intent(in) :: world_comm
      integer(int64), intent(in) :: fragment_idx
      integer, intent(in) :: dest_rank
      integer, intent(in) :: polymers(:, :)
      integer :: fragment_size
      integer(int32) :: fragment_type
      integer, allocatable :: fragment_indices(:)
      type(request_t) :: req(4)
      integer(int64) :: fragment_idx_int64

      fragment_size = count(polymers(fragment_idx, :) > 0)
      allocate (fragment_indices(fragment_size))
      fragment_indices = polymers(fragment_idx, 1:fragment_size)

      ! Standard MBE always uses monomer indices
      fragment_type = FRAGMENT_TYPE_MONOMERS

      ! TODO: serialize the data for better performance
      fragment_idx_int64 = int(fragment_idx, kind=int64)
      call isend(world_comm, fragment_idx_int64, dest_rank, TAG_NODE_FRAGMENT, req(1))
      call isend(world_comm, fragment_type, dest_rank, TAG_NODE_FRAGMENT, req(2))
      call isend(world_comm, fragment_size, dest_rank, TAG_NODE_FRAGMENT, req(3))
      call isend(world_comm, fragment_indices, dest_rank, TAG_NODE_FRAGMENT, req(4))

      ! Wait for all sends to complete
      call wait(req(1))
      call wait(req(2))
      call wait(req(3))
      call wait(req(4))

      deallocate (fragment_indices)
   end subroutine send_fragment_to_node