Skip to content

Commit 07ea610

Browse files
authored
Update user_documentation.rst - section 6
1 parent 1565b6e commit 07ea610

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

doc/source/user_documentation.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,25 +2959,25 @@ Both the initialization of the ``cfg`` object with ``specs.SimConfig()`` and the
29592959
29602960
updating the ``cfg`` object with the supplied dictionary will occur before updating it with parameters specified by the batch search
29612961
2962-
5. Communicating results to the search algorithm through the ``sim.send`` function
2963-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2962+
5. Communicating results to the search algorithm via sockets using the ``sim.send`` function
2963+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29642964
2965-
Prior batch simulations relied on ``.pkl`` files to communicate data. In order to facilitate collation, specific data values can be sent directly via runtime memory at the end of the simulation via:
2965+
Prior batch simulations relied on ``.pkl`` files to communicate data. In order to facilitate collation, specific data values can be sent directly via sockets at the end of the simulation via:
29662966
29672967
* **sim.send(<data>)**: sends ``<data>`` to the batch ``dispatcher``
29682968
29692969
For ``search`` jobs, it is important to match the data sent with the metric specified in the search function. For instance, if the search call specifies a metric "loss", then ``sim.send`` should specify a key: value pair: ``{'loss': <value>}``.
29702970
29712971
6. Specifying a batch job
29722972
^^^^^^^^^^^^^^^^^^^^^^^^^
2973-
Batch job handling is implemented from ``netpyne.batchtools.search``. Below is a selection of relevant arguments for the ``search`` function, the full list of arguments can be referenced by calling:
2973+
Batch job handling is implemented from ``netpyne.batchtools.search``. Below is a selection of relevant arguments for the ``search`` function, the full list of arguments is available by calling:
29742974
29752975
.. code-block:: python
29762976
29772977
from netpyne.batchtools import search
29782978
help(search)
29792979
2980-
**search (truncated API)**
2980+
**Search API (truncated):**
29812981
29822982
.. code-block:: python
29832983
@@ -2987,21 +2987,22 @@ Batch job handling is implemented from ``netpyne.batchtools.search``. Below is a
29872987
run_config: Optional[dict] = None, # batch configuration, (keyword: string pairs to customize the submit template)
29882988
params: Optional[dict] = None, # search space (dictionary of parameter keys: tune search spaces)
29892989
algorithm: Optional[str] = "variant_generator", # search algorithm to use, see SEARCH_ALG_IMPORT for available options
2990-
label: Optional[str] = 'search', # label for the search, any files generated will be prefixed with this string
2990+
label: Optional[str] = "search", # label for the search, any files generated will be prefixed with this string
29912991
output_path: Optional[str] = './batch', # directory for storing generated files, either relative to the current working directory if starting with '.' or an absolute path if starting with '/'
29922992
checkpoint_path: Optional[str] = './checkpoint', # directory for storing checkpoint files, either relative to the current working directory if starting with '.' or an absolute path if starting with '/'
29932993
max_concurrent: Optional[int] = 1, # number of concurrent trials to run at one time
2994-
num_samples: Optional[int] = 1, # number of trials to run, for parameter grids, a value of 1 means that the search will sample the parameter space of each value in the grid
2995-
metric: Optional[str] = None, # metric to optimize (this should match some key: value pair in the returned data
2996-
mode: Optional[str] = "min", # either 'min' or 'max' (whether to minimize or maximize the metric
2994+
num_samples: Optional[int] = 1, # number of trials to run; for parameter grids, a value of 1 means that the search will sample the parameter space of each value in the grid
2995+
metric: Optional[str] = None, # metric to optimize (this should match some key: value pair in the returned data)
2996+
mode: Optional[str] = "min", # either 'min' or 'max' (whether to minimize or maximize the metric)
29972997
sample_interval: Optional[int] = 15, # interval to poll for new results (in seconds)
29982998
attempt_restore: Optional[bool] = True, # whether to attempt to restore from a checkpoint
29992999
) -> study: # results of the search
30003000
3001-
The basic search implemented with the ``search`` function uses ``ray.tune`` as the search algorithm backend, creates a `.csv` storing the results, and returning a ``study`` object containing. It takes the following parameters;
3001+
The default parameter search implemented with the ``search`` function uses ``ray.tune`` as the search algorithm backend, creates a `.csv` storing the results, and returns a ``study`` object containing the output. It takes the following two parameters:
30023002
3003-
* **job_type**: "``sge``", "``sh``", "``ssh_slurm``", "``ssh_sge``" specifies how the job should be submitted, "``sge``" will submit batch jobs through the Sun Grid Engine. "``sh``" will submit bach jobs through the shell on a local machine, "``ssh_slurm``" or "``ssh_sge``" will submit batch jobs through Slurm workload manager or Sun Grid Engine through an SSH connection.
3004-
* **comm_type**: either "``socket``" (INET socket), "``sfs``" (shared file system), "``sftp``" (secure file transfer protocol for jobs run through SSH) or ``None``, specifying how the job should communicate with the dispatcher. If the ``comm_type`` is specified as ``None``, the search will not await or receive any data from the simulation before executing the next job submission. This is only applicable to searches that are executed in `"grid"`, `"variant_generator"` or `"random"` algorithms where results are not used to infer subsequent search suggestions...
3003+
* **job_type**: specifies how the job should be submitted; **"sge"** will submit batch jobs through the Sun Grid Engine; **"sh"** will submit bach jobs through the shell on a local machine; **"ssh_slurm"** or "ssh_sge" will submit batch jobs through Slurm workload manager or Sun Grid Engine through an SSH connection.
3004+
3005+
* **comm_type**: specifies how the job should communicate with the dispatcher either; **"socket"** (INET socket), **"sfs"** (shared file system), **"sftp"** (secure file transfer protocol for jobs run through SSH) or **"None"**. If the ``comm_type`` is specified as "None", the search will not await or receive any data from the simulation before executing the next job submission. This is only applicable to searches that are executed in "grid", "variant_generator" or "random" algorithms, where results are not used to infer subsequent search suggestions.
30053006
30063007
Currently, the following argument pairs are acceptable for ``job_type`` and ``comm_type``::
30073008
@@ -3019,7 +3020,7 @@ Currently, the following argument pairs are acceptable for ``job_type`` and ``co
30193020
'sh' , 'sfs' -> job run directly on local shell, communication via shared file system
30203021
'sh' , None -> job run directly on local shell, no communication (only grid or random searches)
30213022
3022-
* **run_config**: a dictionary of keyword: string pairs to customize the submit template, the expected keyword: string pairs are dependent on the job_type
3023+
* **run_config**: a dictionary of keyword: string pairs to customize the submit template, the expected keyword: string pairs are dependent on the job_type:
30233024
30243025
.. code-block::
30253026
@@ -3077,9 +3078,9 @@ Currently, the following argument pairs are acceptable for ``job_type`` and ``co
30773078
30783079
30793080
3080-
* **params**: a dictionary of config values to perform the search over. The keys of the dictionary should match the keys of the config object to be updated. Lists or numpy generators >2 values will enforce a grid or choice search over the values; otherwise, a list of two values will create a uniform distribution sample space except when the search algorithm is explicitly set to `"grid"`
3081+
* **params**: a dictionary of config values to perform the search over. The keys of the dictionary should match the keys of the config object to be updated. Lists or numpy generators > 2 values will enforce a grid or choice search over the values; otherwise, a list of two values will create a uniform distribution sample space except when the search algorithm is explicitly set to `"grid"`
30813082
3082-
**usage 1**: updating a constant value specified in the ``SimConfig`` object
3083+
**Usage 1**: updating a constant value specified in the ``SimConfig`` object:
30833084
30843085
.. code-block:: python
30853086
@@ -3100,7 +3101,7 @@ Currently, the following argument pairs are acceptable for ``job_type`` and ``co
31003101
'foo': range(10)
31013102
}
31023103
3103-
**usage 2**: updating a nested object in the ``SimConfig`` object
3104+
**Usage 2**: updating a nested object in the ``SimConfig`` object:
31043105
31053106
.. code-block:: python
31063107
@@ -3127,7 +3128,7 @@ Currently, the following argument pairs are acceptable for ``job_type`` and ``co
31273128
# cfg.foo = {'bar': {'baz': 0}}
31283129
# params = {'foo.bar.baz': range(10)}
31293130
3130-
**usage 3**: updating a list object in the ``SimConfig`` object
3131+
**Usage 3**: updating a list object in the ``SimConfig`` object:
31313132
31323133
.. code-block:: python
31333134
@@ -3160,21 +3161,20 @@ Currently, the following argument pairs are acceptable for ``job_type`` and ``co
31603161
* "grid": forces grid based search over the parameter space, but otherwise functions similar to "variant generator"
31613162
* "variant_generator": grid and random based search of the parameter space (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
31623163
* "random": grid and random based search of the parameter space (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3163-
* "axe": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3164-
* "bayesopt": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3165-
* "hyperopt": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3166-
* "bohb": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3167-
* "nevergrad": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3168-
* "optuna": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3169-
* "hebo": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3170-
* "sigopt": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3171-
* "zoopt": optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3164+
* "axe": Ax optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3165+
* "bayesopt": Bayesian optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3166+
* "hyperopt": Hyper optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3167+
* "bohb": Bayesian Optimization HyperBand algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3168+
* "nevergrad": Nevergrad optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3169+
* "optuna": Optuna hyperparameter optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3170+
* "hebo": Heteroscedastic Evolutionary Bayesian Optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
3171+
* "zoopt": Derivateive-free optimization algorithm (see: https://docs.ray.io/en/latest/tune/api/suggestion.html)
31723172
31733173
* **label**: a label for the search, used for output file naming
31743174
31753175
* **output_path**: the directory for storing generated files, can be a relative or absolute path
31763176
3177-
* **checkpoint_path**: the directory for storing internal ray checkpoint files (maintained by ``ray.tune``)in case the search needs to be restored, can be a relative or absolute path. This checkpoint path maintains search state and allows for restoring searches. On successful completion of a search, the default behavior of the search is to delete the checkpoint directory.
3177+
* **checkpoint_path**: the directory for storing internal ray checkpoint files (maintained by ``ray.tune``) in case the search needs to be restored; can be a relative or absolute path. This checkpoint path maintains search state and allows for restoring searches. On successful completion of a search, the default behavior of the search is to delete the checkpoint directory.
31783178
31793179
* **max_concurrent**: the number of concurrent trials to run at one time
31803180

0 commit comments

Comments
 (0)