env_module Module

Definitions and routines to help deployment in the environment of the hosting system.

Todo

Should generate MPI infos during the build phase in waf.


Uses

  • module~~env_module~~UsesGraph module~env_module env_module aotus_module aotus_module module~env_module->aotus_module flu_binding flu_binding module~env_module->flu_binding iso_fortran_env iso_fortran_env module~env_module->iso_fortran_env mpi mpi module~env_module->mpi

Used by


Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: minLength = 1

Minimal number of entries in growing/dynamic array

integer, public, parameter :: zeroLength = 0
integer, public, parameter :: single_prec = 6

Number of digits for single precision numbers

integer, public, parameter :: double_prec = 15

Number of digits for double precision numbers

integer, public, parameter :: xdble_prec = 18

Number of digits for extended double precision numbers

integer, public, parameter :: quad_prec = 33

Number of digits for quadruple precision numbers

integer, public, parameter :: long_prec = 15

Number of digits for long integer numbers

integer, public, parameter :: int_prec = 6

Number of digits for normal long integer numbers

integer, public, parameter :: rk_prec = double_prec

If the default precision of reals is to be changed, use this parameter. The real kind (rk will then be selected accordingly). For your convenience there are two predefined parameters available, to select single or double precision: double_prec and single_prec.

integer, public, parameter :: rk = selected_real_kind(rk_prec)

The kind to select for default reals

integer, public, parameter :: quad_k = selected_real_kind(quad_prec)

The kind to select for reals using quadruple-precision

integer, public, parameter :: double_k = selected_real_kind(double_prec)

The kind to select for reals using double-precision

integer, public, parameter :: single_k = selected_real_kind(single_prec)

The kind to select for reals using single-precision

integer, public, parameter :: long_k = selected_int_kind(long_prec)

The kind to select for default long integers

integer, public, parameter :: int_k = selected_int_kind(int_prec)

The kind to select for default normal length integers

real(kind=rk), public, parameter :: eps = epsilon(1._rk)

machine error for selected real kind, rk

real(kind=rk), public, parameter :: zero_rk = 1024*tiny(1._rk)

close value to 0, rk

real(kind=rk), public, parameter :: eps_single_k = epsilon(1.0_single_k)

machine error for selected real kind, single_k

integer, public, parameter :: LabelLen = 80

Length for labels describing selectable options, like names of boundary or initial conditions.

integer, public, parameter :: PathLen = 800

Length for strings describing file system paths.

integer, public, parameter :: OutLen = 1024

Length for data strings dumped to file in output routines e.g. ASCII output (1kb).

integer, public, parameter :: SolSpecLen = 7198

Length for strings describing the solver specific character (64kb).

integer, public, parameter :: ErrorLen = 100

Length for MPI I/O errors.

integer, public, parameter :: stdOutUnit = output_unit

The default output unit, inherited from the iso_fortran_env module

Todo

if the iso_fortran_env module is not available, this should be set to the usual 6 during compilation.

integer, public, parameter :: globalMaxLevels = 20

Maximal level of refinements in the Octree

logical, public :: isLittleEndian

Endianness of the system, is going to be determined at runtime in init_env.

character(len=1), public, parameter :: pathSep = '/'

path seperator of the system

character(len=pathLen), public :: null_device = '/dev/null'

Name of the null device to use for output to be discarded.

integer, public :: rk_mpi

MPI Datatype for the used real kind, set in init_env.

integer, public :: long_k_mpi

MPI Datatype for the used long kind, set in init_env.

integer, public, save :: io_buffer_size = 1048576

Size of Buffer for IO in 8 Byte words. (Use a sane default of 8 MB)

logical, public, save :: printRuntimeInfo = .true.

Should the information on the runtime obtained from /proc/self/status be printed during finalize?

If this Linux pseudo file is not accessible on the current system, a reporting message will be printed instead. The data will only be printed by the first process and thus only shows its state in parallel runs.

integer, public, parameter :: tem_err_fatal = 0

Some parameters for the error handling.

They indicate the bits to set in case of the corresponding error, to allow appropiate reactions of the calling application.

integer, public, parameter :: tem_err_warning = 1

Functions

public function newunit() result(nu)

Helper function to provide new unit, as long as F2008 newunit argument in open statement is not commonly available. To be used right in front of the open statement like this: myUnit = newunit() open(myUnit, ...)

Arguments

None

Return Value integer

public function Sys_is_Little_Endian() result(endian)

Determine if the system is little or big endian

Arguments

None

Return Value logical

public function tem_create_EndianSuffix() result(suffix)

This function returns the string in the line which starts with the specified key string in the text returned from print_self_status. The key string itself is excluded from the returned string. If the specified key is not found in the text an empty string will be returned.

Arguments

None

Return Value character(len=4)

public function my_status_string(key, info) result(val)

This function returns the string in the line which starts with the specified key string in the text returned from print_self_status. The key string itself is excluded from the returned string. If the specified key is not found in the text an empty string will be returned.

Read more…

Arguments

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

Return Value character(len=80)

public function my_status_string_vec(key, info) result(val)

This function returns the strings in the first line which starts with the specified key strings in the text returned from print_self_status.

Read more…

Arguments

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

Return Value character(len=80), (size(key))

public function my_status_int(key, info, def) result(val)

Read out the first integer in the line matched by the specified key in the text provided by print_self_status. The key should include all text in front of the integer. For example the peak memory consumption up to now could be extracted with: peakval = my_status_int('VmPeak:') If the key is not found 0 or the optionally defined value in def will be returned.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key
character(len=*), intent(in), optional :: info
integer, intent(in), optional :: def

Return Value integer

public function my_status_int_vec(key, info, def) result(val)

Reads out the first integer in the line matched by the specified key in the text provided by print_self_status. The key should include all text in front of the integer. For example the peak memory consumption up to now could be extracted with: peakval = my_status_int('VmPeak:') If the key is not found 0 or the optionally defined value in def will be returned.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key(:)
character(len=*), intent(in), optional :: info
integer, intent(in), optional :: def(:)

Return Value integer, (size(key))


Subroutines

public subroutine init_env()

Initialize the environment, should be the very first call in the program and includes the call of MPI_Init.

Arguments

None

public subroutine init_random_seed(idx)

Initialized random seed with idx

Arguments

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

public subroutine fin_env()

Finalize the environment, should be the very last call in the program, and includes the call of MPI_Finalize.

Arguments

None

public subroutine tem_load_env_params(conf)

Load globally configurable environment parameters from the config script

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: conf

lua state to load information from

public subroutine print_self_status(unit, info, text)

This subroutine reads out the status of the process if it is available in /proc/self/status, which is provided by the Linux operating system.

Arguments

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

A preconnected unit, to write the content of /proc/self/status to.

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

optional filename prefix

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

optional header text to be dumped to file

public subroutine tem_connect_toNull(null_unit)

Arguments

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