Configurator#
The Configurator is a tool that generates Fortran source based on an extended form of Rose metadata. The Fortran code reads namelist configuration files aligned with the metadata and stores the configuration choices in generated data structures and functions with meaningful names. Applications can use these structures and functions to access the configuration choices. To support parallel applications, the generated code manages the distribution of choices to all MPI ranks.
The Configurator provides several python scripts found in
infrastructure/build/tools. Each of these scripts generate
Fortran source code that is specific to an application’s metadata.
GenerateNamelistLoader
Takes a JSON file created by rose_picker from an applications
rose-meta.conf file. For each namelist described in the JSON file, a
Fortran module is generated. Each module has procedures to:
Read the specifc namelist from a configuration file.
Broadcast the namelist values across MPI ranks.
Return the current namelist values as a generic/extended
namelist_type.
Usage
- GenerateNamelistLoader
[-help][-version][-directory PATH] FILE
-help|-version:Returns script information, then exits.
-directory PATH:Location of generated source. Default: current working directory.
FILE:JSON file containing the application metadata.
GenerateConfigLoader
This generates the source module (config_loader_mod.f90) which controls
the loading of namelists from file and performs the broadcast of
configuration values to other MPI ranks. This module also retrieves the
namelist objects from the respective namelist configuration modules and
stores them in the applications configuration object (config_type).
Usage
- GenerateConfigLoader
[-help][-version][-verbose][-directory PATH][-duplicate LISTNAME] NAMELISTS…
-help|-version:Returns script information, then exits.
-directory PATH:Location of generated
config_loader_mod.f90source. Default: current working directory.-duplicate LISTNAME:Adds LISTNAME to the set of namelists which allow duplicate instances.
NAMELISTS...:Space-separated list of one or more namelist names that the
config_loader_modmodule will recognise for reading. Each namelist listed will require a corresponding module generated by the GenerateNamelistLoader script.
GenerateConfigType
Generates source code config_type_mod.f90 which defines the type storing
the namelists specific to a given application. The config_type provides
(mostly) direct access to an applications configuration values.
Usage
- GenerateConfigType
[-help][-version][-verbose][-directory PATH][-duplicate LISTNAME] NAMELISTS…
-help|-version:Returns script information, then exits.
-directory PATH:Location of generated
config_type_mod.f90. Defaul: current working directory.-duplicate LISTNAME:Optional argument to add LISTNAME to the set of namelists allowed to have duplicate instances.
NAMELISTS...:Space-separated list of one or more namelist names that the
config_typewill store.
GenerateExtendedNamelistType
Generates extended namelist type (<listname>_nml_type) specific to a
given namelist definition. One source module generated per defined namelist.
The resulting extended namelist type will allow direct access to the namelist
member values while remaining read-only.
Usage
- GenerateExtendedNamelistType
[-help][-version][-verbose][-directory PATH] FILE
-help|-version:Returns script information, then exits.
-directory PATH:Location of generated source. Default: current working directory.
FILE:JSON file containing the application metadata.
GenerateFeigns
Generates a module which provides procedures to directly configure the contents of a namelist. This module should not be used within a normal application. Instead, it is to allow test systems to feign the reading of a namelist so they can control the test environment:
Usage
- GenerateFeigns
[-help] [-version] [-output FILE1] FILE2
-help|-version:Caused the tool to tell you about itself, then exit.
-output FILE1:Generated source file is written FILE1, defaults to
feign_config_mod.f90in the current working directory,FILE2:JSON metadata file created by
rose-picker.
Ultimately, these scripts require an applications extended Rose metadata in the form of a JSON file.
For convienence, a separate tool, (rose_picker) is used to convert the extended Rose metadata file into a JSON file.