3
3
Experiments
4
4
***********
5
5
6
- The Experiment acts as both a factory class for constructing the
7
- stages of an experiment (``Model ``, ``Ensemble ``, ``Orchestrator ``, etc.)
8
- as well as an interface to interact with the entities created by the experiment.
6
+ The Experiment acts as both a factory class for constructing the stages of an
7
+ experiment (``Model ``, ``Ensemble ``, ``Orchestrator ``, etc.) as well as an
8
+ interface to interact with the entities created by the experiment.
9
9
10
- Users can initialize an :ref: `Experiment <experiment_api >` at the beginning of a Jupyter notebook,
11
- interactive python session, or Python file and use the `` Experiment `` to
12
- iteratively create, configure and launch computational kernels on the
13
- system through the specified launcher.
10
+ Users can initialize an :ref: `Experiment <experiment_api >` at the beginning of a
11
+ Jupyter notebook, interactive python session, or Python file and use the
12
+ `` Experiment `` to iteratively create, configure and launch computational kernels
13
+ on the system through the specified launcher.
14
14
15
15
.. |SmartSim Architecture | image :: images/ss-arch-overview.png
16
16
:width: 700
@@ -19,21 +19,21 @@ system through the specified launcher.
19
19
|SmartSim Architecture |
20
20
21
21
22
- The interface was designed to be simple, with as little complexity
23
- as possible, and agnostic to the backend launching mechanism (local,
24
- Slurm, PBSPro, etc.).
22
+ The interface was designed to be simple, with as little complexity as possible,
23
+ and agnostic to the backend launching mechanism (local, Slurm, PBSPro, etc.).
25
24
26
25
Model
27
26
=====
28
27
29
28
``Model(s) `` are subclasses of ``SmartSimEntity(s) `` and are created through the
30
- Experiment API. Models represent any computational kernel. Models are flexible enough
31
- to support many different applications, however, to be used with our clients
32
- (SmartRedis) the application will have to be written in Python, C, C++, or Fortran.
29
+ Experiment API. Models represent any computational kernel. Models are flexible
30
+ enough to support many different applications, however, to be used with our
31
+ clients (SmartRedis) the application will have to be written in Python, C, C++,
32
+ or Fortran.
33
33
34
- Models are given :ref: `RunSettings <rs-api >` objects that specify how a kernel should
35
- be executed with regard to the workload manager (e.g. Slurm) and the available
36
- compute resources on the system.
34
+ Models are given :ref: `RunSettings <rs-api >` objects that specify how a kernel
35
+ should be executed with regard to the workload manager (e.g. Slurm) and the
36
+ available compute resources on the system.
37
37
38
38
Each launcher supports specific types of ``RunSettings ``.
39
39
@@ -45,7 +45,8 @@ Each launcher supports specific types of ``RunSettings``.
45
45
These settings can be manually specified by the user, or auto-detected by the
46
46
SmartSim Experiment through the ``Experiment.create_run_settings `` method.
47
47
48
- A simple example of using the Experiment API to create a model and run it locally:
48
+ A simple example of using the Experiment API to create a model and run it
49
+ locally:
49
50
50
51
.. code-block :: Python
51
52
@@ -83,9 +84,9 @@ For example with Slurm
83
84
84
85
print (exp.get_status(model))
85
86
86
- The above will run ``srun -n 32 -N 1 echo Hello World! ``, monitor it's execution,
87
- and inform the user when it is completed. This driver script can be executed in
88
- an interactive allocation, or placed into a batch script as follows:
87
+ The above will run ``srun -n 32 -N 1 echo Hello World! ``, monitor its
88
+ execution, and inform the user when it is completed. This driver script can be
89
+ executed in an interactive allocation, or placed into a batch script as follows:
89
90
90
91
.. code-block :: bash
91
92
@@ -108,18 +109,18 @@ An ``Ensemble`` can be constructed in three ways:
108
109
2. Replica creation (by specifying ``replicas `` argument)
109
110
3. Manually (by adding created ``Model `` objects) if launching as a batch job
110
111
111
- Ensembles can be given parameters and permutation strategies that
112
- define how the ``Ensemble `` will create the underlying model objects.
112
+ Ensembles can be given parameters and permutation strategies that define how the
113
+ ``Ensemble `` will create the underlying model objects.
113
114
114
115
Three strategies are built in:
115
116
1. ``all_perm ``: for generating all permutations of model parameters
116
117
2. ``step ``: for creating one set of parameters for each element in `n ` arrays
117
118
3. ``random ``: for random selection from predefined parameter spaces
118
119
119
120
Here is an example that uses the ``random `` strategy to intialize four models
120
- with random parameters within a set range. We use the ``params_as_args ``
121
- field to specify that the randomly selected learning rate parameter should
122
- be passed to the created models as a executable argument.
121
+ with random parameters within a set range. We use the ``params_as_args `` field
122
+ to specify that the randomly selected learning rate parameter should be passed
123
+ to the created models as a executable argument.
123
124
124
125
.. code-block :: bash
125
126
@@ -145,11 +146,11 @@ be passed to the created models as a executable argument.
145
146
exp.start(ensemble, summary=True)
146
147
147
148
148
- A callable function can also be supplied for custom permutation strategies.
149
- The function should take two arguments: a list of parameter names, and a list of lists
150
- of potential parameter values. The function should return a list of dictionaries that
151
- will be supplied as model parameters. The length of the list returned will determine
152
- how many ``Model `` instances are created.
149
+ A callable function can also be supplied for custom permutation strategies. The
150
+ function should take two arguments: a list of parameter names, and a list of
151
+ lists of potential parameter values. The function should return a list of
152
+ dictionaries that will be supplied as model parameters. The length of the list
153
+ returned will determine how many ``Model `` instances are created.
153
154
154
155
For example, the following is the built-in strategy ``all_perm ``:
155
156
0 commit comments