ingen_mod Module

Reads in namelists, checks for consistency of inputs, writes a report to runname.report, checks for requested variations, generates new input files, and exits.

Consistency checks/reports:



Contents


Variables

Type Visibility Attributes Name Initial
type(proc_layout_type), public, dimension(:), allocatable :: sweet_spots
type(diagnostics_type), private :: gnostics
logical, private, parameter :: debug = .false.
integer, private :: interactive_record
integer, private :: interactive_input
integer, private :: ncut
integer, private :: npmax
logical, private :: write_nml
logical, private :: scan
logical, private :: stdin
logical, private :: coll_on = .false.
logical, private :: initialized = .false.
type(ingen_config_type), private :: ingen_config

Derived Types

type, private ::  proc_layout_type

FIXME : Add documentation

Components

Type Visibility Attributes Name Initial
integer, public :: nproc
real, public :: percent_xxf_2_yxf
logical, public :: should_use_unbalanced_xxf
real, public :: percentage_xxf_unbalanced_amount
logical, public :: should_use_unbalanced_yxf
real, public :: percentage_yxf_unbalanced_amount

type, public, extends(abstract_config_type) ::  ingen_config_type

Used to represent the input configuration of ingen

Components

Type Visibility Attributes Name Initial
logical, public :: exist = .false.

Does the related namelist exist in the target input file?

integer, public :: index = 0

Used to hold the specific index of numbered namelists

logical, public :: skip_read = .false.

Do we want to skip the read step in init?

logical, public :: skip_broadcast = .false.

Do we want to skip the broadcast step in init?

logical, public :: skip_smart_defaults = .false.

Do we want to skip the smaart defaults in init?

integer, public :: ncut = 100000

This sets the minimum number of local elements for which processor recommendations will be given. In other words, if the total number of elements is nmesh = (2*ntgrid+1)*2*nlambda*negrid*ntheta0*naky*nspec, then the largest processor count that ingen will recommend would be nmesh/ncut.

integer, public :: npmax = 100000

Sets the maximum processor count considered when calculating sweetspots.

logical, public :: scan = .false.

If true then alongside standard ingen report allows the creation of various types of scans. This will involve user interaction if stdin is true.

logical, public :: stdin = .true.

If true (default) then ask for input from stdin when using ingen to produce parameters for scans (scan = .true.). If false then will look in file named .<run_name>.pythonin instead.

logical, public :: write_nml = .false.

If true then write out a subset of the namelists that have been read in. Original default was true but changed to false as utility of output less clear.

Type-Bound Procedures

procedure , public , :: is_initialised => is_initialised_generic Function
procedure , public , :: init => init_generic Subroutine
procedure , public , :: setup => setup_generic Subroutine
procedure , public , :: write_namelist_header Subroutine
procedure , public , :: get_name => get_name_generic Function
procedure , public , :: get_requires_index => get_requires_index_generic Function
procedure , public , :: set_smart_defaults => set_smart_defaults_null Subroutine
procedure , public , nopass :: write_namelist_footer Subroutine
generic, public , :: write_key_val => write_key_val_string, write_key_val_real, write_key_val_complex, write_key_val_integer, write_key_val_logical, write_key_val_real_array, write_key_val_complex_array, write_key_val_integer_array
procedure , public :: read => read_ingen_config Subroutine
procedure , public :: write => write_ingen_config Subroutine
procedure , public :: reset => reset_ingen_config Subroutine
procedure , public :: broadcast => broadcast_ingen_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_ingen_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_ingen_config Function

Functions

private function get_default_name_ingen_config()

Gets the default name for this namelist

Arguments

None

Return Value character(len=CONFIG_MAX_NAME_LEN)

Gets the default requires index for this namelist

Arguments

None

Return Value logical

public pure function get_ingen_config()

Get the module level config instance

Arguments

None

Return Value type(ingen_config_type)


Subroutines

public subroutine run_ingen(ingen_config_in, input_file)

Entry point: initialise needed modules, run checks, and write namelists

Arguments

Type IntentOptional Attributes Name
type(ingen_config_type), intent(in), optional :: ingen_config_in

Input options. Defaults to reading the 'ingen_knobs' namelist from the input file

character(len=*), intent(in), optional :: input_file

Filename of input file. Default is to read from the command line

public subroutine init_ingen(ingen_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(ingen_config_type), intent(in), optional :: ingen_config_in

public subroutine finish_ingen()

FIXME : Add documentation

Arguments

None

private subroutine interactive(header)

FIXME : Add documentation
!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! 1.0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! 1.1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! 1.1.1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! 1.1.2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Read more…

Arguments

Type IntentOptional Attributes Name
type(standard_header_type), intent(in), optional :: header

Header for files with build and run information

private subroutine get_namelists()

FIXME : Add documentation

Arguments

None

private subroutine write_namelists(jr, tag1, tag2, header)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: jr
character(len=*), intent(in), optional :: tag1
character(len=*), intent(in), optional :: tag2
type(standard_header_type), intent(in), optional :: header

Header for files with build and run information

private subroutine pfactors(n, div)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
integer, intent(out), dimension (:) :: div

public subroutine report(header)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(standard_header_type), intent(in), optional :: header

Header for files with build and run information

private subroutine write_separator(report_unit)

Writes a standard section separator

Arguments

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

private subroutine wsweetspots(sym, sdim, nfac, facs, npmax, LUN)

Writes out sweetspot core counts for a layout sym: character string label for each dimension sdim: size of each dimension nfac: #factors of each sdim facs(i,j): ith factor of jth dimension

Arguments

Type IntentOptional Attributes Name
character(len=3), intent(in), dimension(:) :: sym
integer, intent(in), dimension(:) :: sdim
integer, intent(in), dimension(:) :: nfac
integer, intent(in), dimension(:,:) :: facs
integer, intent(in) :: npmax
integer, intent(in), optional :: LUN

private subroutine nprocs_xxf(report_unit)

FIXME : Add documentation

Arguments

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

private subroutine nprocs_yxf(report_unit)

FIXME : Add documentation

Arguments

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

private subroutine nprocs_e(report_unit)

FIXME : Add documentation

Arguments

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

private subroutine nprocs_lz(report_unit)

FIXME : Add documentation

Arguments

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

private subroutine nprocs_le(report_unit)

FIXME : Add documentation

Arguments

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

private subroutine nprocs(nmesh, report_unit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nmesh
integer, intent(in) :: report_unit

private subroutine write_linear_sweet_spot(dim, report_unit, nfacs_dim, facs_dim, previous_dim_block, nmesh, ncut)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: dim
integer, intent(in) :: report_unit
integer, intent(in) :: nfacs_dim
integer, intent(in), dimension(:) :: facs_dim
integer, intent(in) :: previous_dim_block
integer, intent(in) :: nmesh
integer, intent(in) :: ncut

private subroutine write_nonlinear_sweet_spot(dim, report_unit, nfacs_dim, facs_dim, previous_dim_block, npmax)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: dim
integer, intent(in) :: report_unit
integer, intent(in) :: nfacs_dim
integer, intent(in), dimension(:) :: facs_dim
integer, intent(in) :: previous_dim_block
integer, intent(in) :: npmax

private subroutine write_nonlinear_glo_header(report_unit)

Arguments

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

private subroutine get_unbalanced_suggestions(npe, percentage_xxf_unbalanced_amount, percentage_yxf_unbalanced_amount, use_unbalanced_xxf, use_unbalanced_yxf)

This subroutine is used to return the unbalanced suggestions for a given process count (npe). The calculation is performed using the calculate_unbalanced_x and calculate_unbalanced_y subroutines from gs2_layouts. These return the unbalanced decomposition size (difference between the suggested small and large block size for the decomposition) and from this a logical is set to recommend whether the unbalanced decomposition should be used or not.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: npe
integer, intent(out) :: percentage_xxf_unbalanced_amount
integer, intent(out) :: percentage_yxf_unbalanced_amount
logical, intent(out) :: use_unbalanced_xxf
logical, intent(out) :: use_unbalanced_yxf

private subroutine get_idle_processes(npe, idle_percentage, use_unbalanced)

This subroutine is used to return the idle processes from the xxf and yxf layouts. Idle processes sometimes occur, dependent on the process count used, because the data domain does not evenly divide by the total number of processes available. These can cause high communications overheads for the non-linear calculations for large numbers of processes so it is useful to print this data out in ingen to let users know which process counts this can happen at for a given input file We currently use an arbitrary cutoff of 10% difference in idle processes to suggest that the unbalanced decomposition functionality should be used to mitigate the impact of this difference.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: npe
real, intent(out) :: idle_percentage
logical, intent(out) :: use_unbalanced

private subroutine report_idle_procs(npe, distchar, report_unit, onlyxoryfac)

This subroutine wraps up the output functionality for the code that creates the list of suggested process counts for the linear computation and checks whether those process counts work well for the non-linear calculations as well.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: npe
character(len=*), intent(in) :: distchar
integer, intent(in) :: report_unit
logical, intent(in), optional :: onlyxoryfac

private subroutine tell(a, b, c)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a
character(len=*), intent(in), optional :: b
character(len=*), intent(in), optional :: c

private subroutine text(a)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in), optional :: a

private subroutine run_number(sel, nbeta)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: sel
integer, intent(in) :: nbeta

private subroutine try_again()

FIXME : Add documentation

Arguments

None

private subroutine get_choice(in, out)

FIXME : Add documentation

Arguments

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

private subroutine beta_range_low(x, a, x0)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out) :: x
character(len=*), intent(in) :: a
real, intent(in) :: x0

private subroutine beta_range_high(x, a, x0)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out) :: x
character(len=*), intent(in) :: a
real, intent(in) :: x0

private subroutine beta_prime_range_low(x)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out) :: x

private subroutine beta_prime_range_high(x, x0)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out) :: x
real, intent(in) :: x0

private subroutine num_runs(n)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: n

private subroutine read_ingen_config(self)

Reads in the ingen_knobs namelist and populates the member variables

Arguments

Type IntentOptional Attributes Name
class(ingen_config_type), intent(inout) :: self

private subroutine write_ingen_config(self, unit)

Writes out a namelist representing the current state of the config object

Arguments

Type IntentOptional Attributes Name
class(ingen_config_type), intent(in) :: self
integer, intent(in), optional :: unit

private subroutine reset_ingen_config(self)

Resets the config object to the initial empty state

Arguments

Type IntentOptional Attributes Name
class(ingen_config_type), intent(inout) :: self

private subroutine broadcast_ingen_config(self)

Broadcasts all config parameters so object is populated identically on all processors

Arguments

Type IntentOptional Attributes Name
class(ingen_config_type), intent(inout) :: self

public subroutine set_ingen_config(ingen_config_in)

Set the module level config instance

Arguments

Type IntentOptional Attributes Name
type(ingen_config_type), intent(in), optional :: ingen_config_in