Gromacs
2020-beta1
|
#include <gromacs/mdrun/runner.h>
Build a gmx::Mdrunner.
Client code (such as gmx mdrun
) uses this builder to get an initialized Mdrunner.
A builder allows the library to ensure that client code cannot obtain an uninitialized or partially initialized runner by refusing to build() if the client has not provided sufficient or self-consistent direction. Director code can be implemented for different user interfaces, encapsulating any run-time functionality that does not belong in the library MD code, such as command-line option processing or interfacing to external libraries.
Public Member Functions | |
MdrunnerBuilder (std::unique_ptr< MDModules > mdModules) | |
Constructor requires a handle to a SimulationContext to share. More... | |
Mdrunner | build () |
Get ownership of an initialized gmx::Mdrunner. More... | |
MdrunnerBuilder & | addNonBonded (const char *nbpu_opt) |
Set up non-bonded short-range force calculations. More... | |
MdrunnerBuilder & | addElectrostatics (const char *pme_opt, const char *pme_fft_opt) |
Set up long-range electrostatics calculations. More... | |
MdrunnerBuilder & | addBondedTaskAssignment (const char *bonded_opt) |
Assign responsibility for tasks for bonded interactions. More... | |
MdrunnerBuilder & | addUpdateTaskAssignment (const char *update_opt) |
Assign responsibility for tasks for update and constrain calculation. More... | |
MdrunnerBuilder & | addMultiSim (gmx_multisim_t *multisim) |
Provide access to the multisim communicator to use. More... | |
MdrunnerBuilder & | addCommunicationRecord (t_commrec *cr) |
Provide a commrec for mdrun to use. More... | |
MdrunnerBuilder & | addSimulationMethod (const MdrunOptions &options, real forceWarningThreshold, StartingBehavior startingBehavior) |
Set MD options not owned by some other module. More... | |
MdrunnerBuilder & | addDomainDecomposition (const DomdecOptions &options) |
Set the domain decomposition module. More... | |
MdrunnerBuilder & | addNeighborList (int rebuildInterval) |
Set Verlet list manager. More... | |
MdrunnerBuilder & | addReplicaExchange (const ReplicaExchangeParameters ¶ms) |
Set replica exchange manager. More... | |
MdrunnerBuilder & | addHardwareOptions (const gmx_hw_opt_t &hardwareOptions) |
Specify parameters determining hardware resource allocation. More... | |
MdrunnerBuilder & | addFilenames (ArrayRef< const t_filenm > filenames) |
Provide the filenames options structure with option values chosen. More... | |
MdrunnerBuilder & | addOutputEnvironment (gmx_output_env_t *outputEnvironment) |
Provide parameters for setting up output environment. More... | |
MdrunnerBuilder & | addLogFile (t_fileio *logFileHandle) |
Provide the filehandle pointer to be used for the MD log. More... | |
MdrunnerBuilder & | addStopHandlerBuilder (std::unique_ptr< StopHandlerBuilder > builder) |
Provide a StopHandlerBuilder for the MD stop signal handling. More... | |
MdrunnerBuilder (MdrunnerBuilder &&builder) noexcept | |
Allow transfer of ownership with move semantics. More... | |
MdrunnerBuilder & | operator= (MdrunnerBuilder &&builder) noexcept |
|
explicit |
Constructor requires a handle to a SimulationContext to share.
mdModules | The handle to the set of modules active in mdrun |
The calling code must guarantee that the pointer remains valid for the lifetime of the builder, and that the resources retrieved from the context remain valid for the lifetime of the runner produced.
|
defaultnoexcept |
Allow transfer of ownership with move semantics.
builder | source object to transfer. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addBondedTaskAssignment | ( | const char * | bonded_opt | ) |
Assign responsibility for tasks for bonded interactions.
Required. Director code should provide valid options for bonded interaction task assignment, whether or not such interactions are present. The builder does not apply any defaults, so client code should be prepared to provide (e.g.) "auto" in the event no user input or logic provides an alternative argument.
bonded_opt | Target bonded interactions for "cpu", "gpu", or "auto". |
Calling must guarantee that the pointed-to C strings are valid through simulation launch.
MdrunnerBuilder & gmx::MdrunnerBuilder::addCommunicationRecord | ( | t_commrec * | cr | ) |
Provide a commrec for mdrun to use.
This will come from the simulation context, but differently for command-line gmx and a gmxapi Context.
MdrunnerBuilder & gmx::MdrunnerBuilder::addDomainDecomposition | ( | const DomdecOptions & | options | ) |
Set the domain decomposition module.
Optional. Overrides default constructed DomdecOptions if provided.
options | options with which to construct domain decomposition. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addElectrostatics | ( | const char * | pme_opt, |
const char * | pme_fft_opt | ||
) |
Set up long-range electrostatics calculations.
Required. Director code should provide valid options for PME electrostatics, whether or not PME electrostatics are used. The builder does not apply any defaults, so client code should be prepared to provide (e.g.) "auto" in the event no user input or logic provides an alternative argument.
pme_opt | Target long-range interactions for "cpu", "gpu", or "auto". |
pme_fft_opt | Target long-range interactions FFT/solve stages for "cpu", "gpu", or "auto". |
Calling must guarantee that the pointed-to C strings are valid through simulation launch.
MdrunnerBuilder & gmx::MdrunnerBuilder::addFilenames | ( | ArrayRef< const t_filenm > | filenames | ) |
Provide the filenames options structure with option values chosen.
Required. The object is assumed to have been updated by parse_common_args or equivalent.
filenames | Filenames and properties from command-line argument values or defaults. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addHardwareOptions | ( | const gmx_hw_opt_t & | hardwareOptions | ) |
Specify parameters determining hardware resource allocation.
Optional. If not provided, default-constructed gmx_hw_opt_t will be used.
hardwareOptions | Parallelism-related user options. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addLogFile | ( | t_fileio * | logFileHandle | ) |
Provide the filehandle pointer to be used for the MD log.
Required. Either nullptr if no log should be written, or valid and open reading for writing.
logFileHandle | Non-owning handle to file used for logging. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addMultiSim | ( | gmx_multisim_t * | multisim | ) |
Provide access to the multisim communicator to use.
multisim | borrowed handle to multisim record. |
Required. Client should create a gmx_multisim_t
and pass its address. Client is responsible for calling done_multisim() on the handle after simulation.
MdrunnerBuilder & gmx::MdrunnerBuilder::addNeighborList | ( | int | rebuildInterval | ) |
Set Verlet list manager.
Optional. Neighbor list existence, type, and parameters are mostly determined by the simulation parameters loaded elsewhere. This is just an override.
rebuildInterval | override for the duration of a neighbor list with the Verlet scheme. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addNonBonded | ( | const char * | nbpu_opt | ) |
Set up non-bonded short-range force calculations.
Required. Director code must provide valid options for the non-bonded interaction code. The builder does not apply any defaults.
nbpu_opt | Target short-range interactions for "cpu", "gpu", or "auto". |
Calling must guarantee that the pointed-to C string is valid through simulation launch.
MdrunnerBuilder & gmx::MdrunnerBuilder::addOutputEnvironment | ( | gmx_output_env_t * | outputEnvironment | ) |
Provide parameters for setting up output environment.
Required. Handle is assumed to have been produced by output_env_init as in parse_common_args.
outputEnvironment | Output context for writing text files. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addReplicaExchange | ( | const ReplicaExchangeParameters & | params | ) |
Set replica exchange manager.
Optional. For guidance on preparing a valid ReplicaExchangeParameters value, refer to the details in mdrun.cpp, the t_pargs pa[]
defined there, and the action of parse_common_args() with regards to that structure. If not provided by client, a default constructed ReplicaExchangeParameters is used.
params | parameters with which to set up replica exchange. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addSimulationMethod | ( | const MdrunOptions & | options, |
real | forceWarningThreshold, | ||
StartingBehavior | startingBehavior | ||
) |
Set MD options not owned by some other module.
Optional. Override simulation parameters
options | structure to copy |
forceWarningThreshold | Print a warning if any force is larger than this (in kJ/mol nm) (default -1) |
startingBehavior | Whether the simulation will start afresh, or restart with/without appending. |
MdrunnerBuilder & gmx::MdrunnerBuilder::addStopHandlerBuilder | ( | std::unique_ptr< StopHandlerBuilder > | builder | ) |
Provide a StopHandlerBuilder for the MD stop signal handling.
Optional. Defaults to empty.
Client may provide additional (non-default) issuers of simulation stop signals by preconfiguring the StopHandlerBuilder used later when the simulation runs.
builder |
MdrunnerBuilder & gmx::MdrunnerBuilder::addUpdateTaskAssignment | ( | const char * | update_opt | ) |
Assign responsibility for tasks for update and constrain calculation.
Required. Director code should provide valid options for update and constraint task assignment. The builder does not apply any defaults, so client code should be prepared to provide (e.g.) "auto" in the event no user input or logic provides an alternative argument.
[in] | update_opt | Target update calculation for "cpu", "gpu", or "auto". |
Calling must guarantee that the pointed-to C strings are valid through simulation launch.
Mdrunner gmx::MdrunnerBuilder::build | ( | ) |
Get ownership of an initialized gmx::Mdrunner.
After build() is called, the Builder object should not be used again. It is an error to call build without first calling all builder methods described as "required."