Library access to MD runner - Redmine #2605
gmxapi milestone 4 as described in #2585
Separate user interface from Mdrunner initialization. mdrun CLI program becomes an API client. Creation of an Mdrunner is concise and local. Clients do not handle an Mdrunner that is not initialized (ready to run). Clients can compose the runner with a builder that is independent of the form of user interface.
Relates to #2229
(from redmine: issue id 2605, created on 2018-08-09 by eirrgang, closed on 2019-01-07)
- Relations:
- relates #2229 (closed)
- blocks #2375 (closed)
- blocks #2587 (closed)
- parent #2585 (closed)
- Changesets:
- Revision 01ce0f82 by Eric Irrgang on 2018-09-14T12:38:10Z:
Rearrange mdrun/runner.h
Swap the public and private sections of Mdrunner. Improves readability
and reduces noise / conflicts for other changes under review. This
commit is only reorganization.
Refs #2605
Change-Id: Ibb9a24a588afd90c7199f77e80aa2a3f2d2e7339
- Revision f3ff9147 by Eric Irrgang on 2018-10-03T11:33:15Z:
Move mdrun mainFunction to client code.
supports gmxapi milestone 4, described at #2605
API clients need to be able to initialize and run MD simulations with
calls from separate code blocks or even translation units. Also, we
need clear distinctions between a pre-launch master Mdrunner and the
non-master Mdrunner threads.
In this change:
* Insert a Builder on which to develop the distinction between user
interface and implementation code. User interface is handled in
Director code, while the Builder and code further down the mdrun call
stack should be user interface agnostic (i.e. not CLI-centric).
* Introduces a Context object to hold some resources. (see milestone 5
and issue #2587)
* Prepare for more stateful Mdrunner objects, documenting resources in
need of clearer management, describing future use cases and possible
implementation details.
* Make Mdrunner non-copyable and not constructable by clients. Worker
threads can initialize a new Mdrunner from the master instance with
cloneOnSpawnedThread.
* Clarify parameter setting for spawned Mdrunner threads.
* Begin to encapsulate filename options available to client code from
the actual client code.
* Remove extraneous variables `nfile` and `fnm`.
Later changes will:
* Separate Mdrunner into Launcher and Worker at mdrunner() call so that
tMPI runner does not look reentrant.
* Hide data and clarify ownership / modernize memory management /
clarify the subjects of the Builder `add` operations.
* Clarify separation of user interface from API parameters.
* Flesh out SimulationContext and related classes.
Refs #2605
Change-Id: I1db1d34b07ec0f8ba5f246ab763c74ad9eafe8f3
- Revision 2cf2343a by Eric Irrgang on 2018-10-05T11:04:31Z:
Add gmxapi::System.
Allow a client to hold an abstract representation of a simulation system
described by a TPR input file. This is part of a series of changes to
allow MD simulations to be configured and launched through a high-level
API.
Supports gmxapi milestone 4
Refs #2605
Change-Id: I6a292a3fe91556d06b9c384b1480c891decffd3f
- Revision e39949c7 by Mark Abraham on 2019-10-01T05:24:02Z:
Removed dependency on commrec of mdrun setup
Changes no functionality.
Setup is now parameterized directly on MPI_COMM_WORLD, which we will
want later for letting library-based callers pass in an
MPI_Communicator. This permits commrec to be initialized later, once
the threads have been spawned for the thread-MPI ranks.
The initialization of multi-simulations moves from LegacyMdrunOptions
to SimulationContext, which is more appropriate for
ensemble-parallelism established directly by the user.
Before the decision about the duty of a rank, there is no difference
between MASTER(cr) and SIMMASTER(cr), so several calls to macros
taking a t_commrec pointer are replaced by booleans. Introduced
findIsSimulationMasterRank to compute that value. This eliminates
early use of t_commrec that has necessitated other hacks and
workarounds.
Removed redundant check for replica exchange when the number of multi
simulations is less than two, because gmx_multisim_t constructor
already prohibits that.
Resolves several TODO items and improves modularity, too.
Refs #2587, #2605, #3081
Change-Id: I48bd3b713bc181b5c1e4cbcd648706a9f00eab96