Documentation
Supports initialization of MPQC. Provides initialization of various runtime components (MADNESS, TiledArray, etc.), parsing command-line options, and miscellaneous execution environment-related functionality.
Classes | |
class | mpqc::MPQCInit |
This helper singleton class simplifies initialization of MPQC. More... | |
class | mpqc::ExEnv |
Describes the execution environment of the program. More... | |
class | mpqc::GetLongOpt |
Parse command line options. More... | |
Namespaces | |
mpqc::utility | |
Functions | |
void | mpqc::initialize (int &argc, char **argv, madness::World &top_world, std::shared_ptr< GetLongOpt > opt=std::shared_ptr< GetLongOpt >()) |
Static MPQC initializer. Must be called from the main thread of every process in the default MADWorld World before doing any MPQC-specific computation (e.g. before creating mpqc::MPQC objects). More... | |
void | mpqc::initialize (int &argc, char **argv, std::shared_ptr< GetLongOpt > opt=std::shared_ptr< GetLongOpt >()) |
The version of initialize that initializes MADNESS and TiledArray and uses MPI_COMM_WORLD as the context. More... | |
void | mpqc::finalize () |
Finalize MPQC. More... | |
void | mpqc::initialize_fpe () |
Initializes the floating point exceptions. More... | |
std::tuple< std::shared_ptr< mpqc::KeyVal >, KeyVal::InputFormat > | mpqc::make_keyval (madness::World &world, const std::string &filename) |
Constructs a KeyVal object on every rank of world by reading file filename on rank 0. More... | |
std::string | mpqc::to_string (MPQCInit::InputFormat f) |
std::shared_ptr< GetLongOpt > | mpqc::make_options () |
Creates a default options parser object for an MPQC executable. More... | |
std::tuple< std::string, std::optional< std::string > > | mpqc::process_options (madness::World &world, const std::shared_ptr< GetLongOpt > &options) |
Processes command-line options parsed by the options parser. More... | |
Function Documentation
◆ finalize()
void mpqc::finalize | ( | ) |
Finalize MPQC.
◆ initialize() [1/2]
void mpqc::initialize | ( | int & | argc, |
char ** | argv, | ||
madness::World & | top_world, | ||
std::shared_ptr< GetLongOpt > | opt = std::shared_ptr< GetLongOpt >() |
||
) |
Static MPQC initializer. Must be called from the main thread of every process in the default MADWorld World before doing any MPQC-specific computation (e.g. before creating mpqc::MPQC objects).
TA::initialize() must have been called before this.
- Exceptions
-
mpqc::ProgrammingError if the MADWorld runtime is not initialized. mpqc::ProgrammingError if already been called and mpqc::finalize() has not been called since the previous call to mpqc::initialize()
- Note
- The initialize()/finalize() sequence can occur more than once.
- Parameters
-
[in/out] argc the argument count [in/out] argv the sequence of argument strings [in] world the top World object in which MPQC will execute (MPQCTask objects will live in subworlds of this) [in/out] opt command-line options parser, if non-null additional MPQC-specific options will be enrolled
◆ initialize() [2/2]
void mpqc::initialize | ( | int & | argc, |
char ** | argv, | ||
std::shared_ptr< GetLongOpt > | opt = std::shared_ptr< GetLongOpt >() |
||
) |
The version of initialize that initializes MADNESS and TiledArray and uses MPI_COMM_WORLD as the context.
TA::initialize() must not have been called before this.
- Note
- The initialize()/finalize() sequence can only occur once.
- Parameters
-
[in/out] argc the argument count [in/out] argv the sequence of argument strings [in/out] opt command-line options parser, if non-null additional MPQC-specific options will be enrolled
◆ initialize_fpe()
void mpqc::initialize_fpe | ( | ) |
Initializes the floating point exceptions.
Enables (if available) FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW; FE_UNDERFLOW and FE_INEXACT are disabled (if available).
- Warning
- This should be called from the main thread before any threads have been created (i.e. before madness::initialize()), so that all threads inherit the same floating point environment.
◆ make_keyval()
std::tuple< std::shared_ptr< mpqc::KeyVal >, KeyVal::InputFormat > mpqc::make_keyval | ( | madness::World & | world, |
const std::string & | filename | ||
) |
Constructs a KeyVal object on every rank of world
by reading file filename
on rank 0.
Will try every known file format from which KeyVal can be constructed (see KeyVal::InputFormat ).
- Note
- This is a collective operation.
- Parameters
-
[in] world the World object [in] filename the file name
- Returns
- a tuple consisting of a pointer to the KeyVal object and the input format identifier
◆ make_options()
std::shared_ptr< GetLongOpt > mpqc::make_options | ( | ) |
Creates a default options parser object for an MPQC executable.
Creates a new options parser object and enrolls standard MPQC options:
option | accept value? | description |
---|---|---|
-i | mandatory | The name of the input file. MPQC will attempt to parse the given input file using the JSON, XML, and INFO formats (in that order). If -i is not given, and no options with omitted optional values are used (e.g., -D ), the last command-line argument that does not specify an option will be assumed to give the input file name. |
-o | mandatory | The name of the output file. The default is to send output to the console. |
-p | mandatory | The prefix for all relative file paths in the input file |
-W | mandatory | the working directory in which to compute |
-D | optional | unless "debugger" keyword is given in input KeyVal, create a debugger at start, with the optional argument as its JSON KeyVal input |
-v | no | print the version number and exit |
-w | no | print the warranty and exit |
-L | no | print the license and exit |
-k | no | print all registered (KeyVal-constructible) DescribedClass classes |
-h | no | print the usage info and exit |
-d | no | start the program and attach a debugger |
-t | no | throw if a deprecated keyword is read |
-meminfo | no | enable MADWorld's print_meminfo memory profiler |
- Returns
- a smart pointer to the newly created options parser object (see mpqc::GetLongOpt )
◆ process_options()
std::tuple< std::string, std::optional< std::string > > mpqc::process_options | ( | madness::World & | world, |
const std::shared_ptr< GetLongOpt > & | options | ||
) |
Processes command-line options parsed by the options parser.
- Parameters
-
world the World object [in] options the options parser object whose parse
method has already been called.
- Returns
- the {input,output} file name tuple. If output is not given, the output was not specified. The output file name will be empty if this rank is not to produce any output.
- Exceptions
-
utility::no_input_given if any of these options are given: -h
,-v
,-w
,-L
, or-k
std::invalid_argument if input file name is not given
◆ to_string()
|
inline |