compute_block_ranges Subroutine

private pure subroutine compute_block_ranges(d, nimg, block_size, start_elem, end_elem)

Calculate block sizes and ranges. author: Seyed Ali Ghasemi

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: d
integer, intent(in) :: nimg
integer, intent(out) :: block_size(nimg)
integer, intent(out) :: start_elem(nimg)
integer, intent(out) :: end_elem(nimg)

Called by

proc~~compute_block_ranges~~CalledByGraph proc~compute_block_ranges fordot::compute_block_ranges proc~dot_r0r1r1_rel_block fordot::dot_R0R1R1_rel_block proc~dot_r0r1r1_rel_block->proc~compute_block_ranges proc~dot_r0r1r1_rel_coarray fordot::dot_R0R1R1_rel_coarray proc~dot_r0r1r1_rel_coarray->proc~compute_block_ranges interface~dot_product fordot::dot_product interface~dot_product->proc~dot_r0r1r1_rel_block interface~dot_product->proc~dot_r0r1r1_rel_coarray

Source Code

   pure subroutine compute_block_ranges(d, nimg, block_size, start_elem, end_elem)
      integer, intent(in)  :: d, nimg
      integer, intent(out) :: block_size(nimg), start_elem(nimg), end_elem(nimg)
      integer              :: i, remainder
      block_size = d / nimg
      remainder = mod(d, nimg)
      block_size(1:remainder) = block_size(1:remainder) + 1
      start_elem(1) = 1
      do i = 2, nimg
         start_elem(i) = start_elem(i - 1) + block_size(i - 1)
      end do
      end_elem(1) = block_size(1)
      end_elem(2:) = start_elem(2:) + block_size(2:) - 1
      ! Check if the block sizes are valid.
      if (minval(block_size) <= 0) error stop 'ForDot: reduce the number of images of coarray.'
   end subroutine compute_block_ranges