decompose_proc Subroutine

subroutine decompose_proc(num_procs, proc_sizes)

decompose_proc – Given the total number of available processors and the number of dimensions, determine the number of processors along each dimension.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: num_procs

number of processors

integer, intent(out) :: proc_sizes(2)

array for the num of procs in each dimension


Called by

proc~~decompose_proc~~CalledByGraph proc~decompose_proc decompose_proc proc~perform_domain_deposition perform_domain_deposition proc~perform_domain_deposition->proc~decompose_proc program~main~8 main program~main~8->proc~perform_domain_deposition

Source Code

   subroutine decompose_proc(num_procs, proc_sizes)
!
      integer, intent(in)  :: num_procs      !! number of processors
      integer, intent(out) :: proc_sizes(2)  !! array for the num of procs in each dimension
!------------------------------------------------------------------------------
      proc_sizes(1) = INT(FLOOR(SQRT(num_procs*1.0)))
      DO
         IF (MOD(num_procs, proc_sizes(1)) == 0) THEN
            proc_sizes(2) = INT(num_procs / proc_sizes(1))
            EXIT
         END IF
         proc_sizes(1) = proc_sizes(1) + 1
      END DO
   end subroutine decompose_proc