decomp_init_from_config Subroutine

public subroutine decomp_init_from_config(d, cfg, nprocs, rank)

Initialise decomposition from config, with optional auto-factoring

If cfg%px and cfg%py are both 1 but nprocs > 1, automatically computes an optimal process grid. Updates cfg%px and cfg%py with the chosen values.

Arguments

Type IntentOptional Attributes Name
type(decomp_t), intent(out) :: d

Decomposition descriptor to populate

type(config_t), intent(inout) :: cfg

Configuration (px, py may be updated)

integer, intent(in) :: nprocs

Total number of MPI ranks

integer, intent(in) :: rank

This MPI rank (0-based)


Calls

proc~~decomp_init_from_config~~CallsGraph proc~decomp_init_from_config decomp_init_from_config proc~decomp_auto_factor decomp_auto_factor proc~decomp_init_from_config->proc~decomp_auto_factor proc~decomp_init decomp_init proc~decomp_init_from_config->proc~decomp_init

Called by

proc~~decomp_init_from_config~~CalledByGraph proc~decomp_init_from_config decomp_init_from_config proc~engine_setup engine_setup proc~engine_setup->proc~decomp_init_from_config proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   subroutine decomp_init_from_config(d, cfg, nprocs, rank)
      !! Initialise decomposition from config, with optional auto-factoring
      !!
      !! If cfg%px and cfg%py are both 1 but nprocs > 1, automatically
      !! computes an optimal process grid. Updates cfg%px and cfg%py
      !! with the chosen values.
      type(decomp_t), intent(out) :: d
         !! Decomposition descriptor to populate
      type(config_t), intent(inout) :: cfg
         !! Configuration (px, py may be updated)
      integer, intent(in) :: nprocs
         !! Total number of MPI ranks
      integer, intent(in) :: rank
         !! This MPI rank (0-based)

      ! Auto-compute process grid if user didn't specify one
      if (nprocs > 1 .and. cfg%px == 1 .and. cfg%py == 1) then
         call decomp_auto_factor(nprocs, cfg%nx, cfg%ny, cfg%px, cfg%py)
      end if

      call decomp_init(d, cfg%nx, cfg%ny, cfg%px, cfg%py, rank)

   end subroutine decomp_init_from_config