decompose_dim
–
For a given number of grid points along a dimension and a number of
available processors for that diemsion,, !! determine the number of
grid points assigned to each processor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | dim_world |
total number of grid points |
||
integer, | intent(out) | :: | dim_array(0:num_procs-1) | |||
integer, | intent(in) | :: | num_procs |
number of processors |
subroutine decompose_dim(dim_world, dim_array, num_procs ) ! integer, intent(in) :: dim_world !! total number of grid points integer, intent(in) :: num_procs !! number of processors integer, intent(out) :: dim_array(0:num_procs-1) ! integer :: n, im, rm !------------------------------------------------------------------------------ im = dim_world/num_procs rm = dim_world-num_procs*im do n = 0, num_procs-1 dim_array(n) = im if( n.le.rm-1 ) dim_array(n) = im+1 enddo end subroutine decompose_dim