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 formatmul::compute_block_ranges proc~mat_mat_block_rel formatmul::mat_mat_block_rel proc~mat_mat_block_rel->proc~compute_block_ranges proc~mat_mat_coarray_rel formatmul::mat_mat_coarray_rel proc~mat_mat_coarray_rel->proc~compute_block_ranges proc~mat_vec_block_rel formatmul::mat_vec_block_rel proc~mat_vec_block_rel->proc~compute_block_ranges proc~mat_vec_coarray_rel formatmul::mat_vec_coarray_rel proc~mat_vec_coarray_rel->proc~compute_block_ranges interface~matmul formatmul::matmul interface~matmul->proc~mat_mat_block_rel interface~matmul->proc~mat_mat_coarray_rel interface~matmul->proc~mat_vec_block_rel interface~matmul->proc~mat_vec_coarray_rel

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