You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/user_documentation.rst
+15-19Lines changed: 15 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2866,29 +2866,29 @@ Though the relevant methods can be called without raising an exception, they onl
2866
2866
^^^^^^^^^^^
2867
2867
Examples of NetPyNE batchtools usage can be found in the ``examples`` directory `on the NetPyNE github <https://github.com/suny-downstate-medical-center/netpyne/tree/batch/netpyne/batchtools/examples>`_.
2868
2868
2869
-
Examples of the underlying batchtk package can be in the ``examples`` directory `on the batchtk github <https://github.com/jchen6727/batchtk/tree/release/examples>`_.
2869
+
Examples of the underlying batchtk package can be in the ``examples`` directory `on the batchtk github <https://github.com/suny-downstate-medical-center/batchtk/tree/release/examples>`_.
2870
2870
2871
2871
3. Retrieving batch configuration values through the ``specs``object
Each simulation is able to retrieve relevant configurations through the ``specs``object, and communicate with
2874
-
the dispatcher through the ``send`` function within ``netpyne.sim``.
2873
+
Each simulation is able to retrieve relevant batch configurations through the ``specs``object, and communicate with
2874
+
the batch dispatcher through the ``send`` function within ``netpyne.sim``.
2875
2875
2876
-
importing the relevant objects
2876
+
First, importthe relevant objects:
2877
2877
2878
2878
.. code-block:: python
2879
2879
2880
2880
from netpyne import specs, sim
2881
2881
cfg = specs.SimConfig() # create a SimConfig object, can be provided with a dictionary on initial call to set initial values
2882
2882
netParams = specs.NetParams() # create a netParams object
2883
2883
2884
-
if the ``batchtk`` module is properly installed, then it automatically replaces the original ``specs.SimConfig``objectwith the developmental ``batchtools`` version which can be queried through ``help()``or``type()``:
2884
+
If the ``batchtk`` module is properly installed, then it automatically replaces the original ``specs.SimConfig``objectwith the developmental ``batchtools`` version which can be queried through ``help()``or``type()``:
2885
2885
2886
2886
.. code-block:: python
2887
2887
2888
2888
cfg = specs.SimConfig()
2889
2889
help(cfg)
2890
2890
2891
-
Truncated output of the above code block...:
2891
+
Truncated output of the above code block:
2892
2892
2893
2893
.. code-block:: python
2894
2894
@@ -2897,19 +2897,17 @@ Truncated output of the above code block...:
2897
2897
2898
2898
class Runner_SimConfig(batchtk.runtk.runners.Runner, netpyne.specs.simConfig.SimConfig)
2899
2899
2900
-
*This updated ``cfg`` instance automatically captures relevant configuration mappings created upon initialization
2900
+
This updated ``cfg`` instance automatically captures relevant configuration mappings created upon initializationfor this particular batch job. These mappings can be retrieved via ``cfg.get_mappings()``.
2901
2901
2902
-
* these mappings can be retrieved via ``cfg.get_mappings()``
2903
-
2904
-
* then, upon calling ``cfg.update()``, it will update its values with the relevant mappings through the ``update()`` method.
2902
+
The next step is to update the cfg values with the relevant mappings for this batch job by calling ``cfg.update()``:
2905
2903
2906
2904
.. code-block:: python
2907
2905
2908
2906
from netpyne import specs # import the custom batch specs
2909
2907
cfg = specs.SimConfig() # create a SimConfig object
2910
2908
cfg.update() # update the cfg object with any relevant mappings for this particular batch job
2911
2909
2912
-
The ``update`` method will update the ``SimConfig``object``first``with values supplied in the argument call, and``then``with the configuration mappings (i.e. retrieved by ``cfg.get_mappings()``)
2910
+
The ``update`` method will update the ``SimConfig``object*first*with values supplied in the argument call, and*then*with the configuration mappings for the batch job (i.e. retrieved by ``cfg.get_mappings()``), as illustrated below:
2913
2911
2914
2912
.. code-block:: python
2915
2913
@@ -2923,12 +2921,12 @@ The ``update`` method will update the ``SimConfig`` object ``first`` with values
2923
2921
assert cfg.bar ==1# cfg.bar remains unchanged
2924
2922
assert cfg.baz ==2# cfg.baz remains unchanged
2925
2923
2926
-
This REPLACES the previous NetPyNE code idiom for updating the SimConfig objectwith mappings from the batched job submission
2924
+
This REPLACES the previous NetPyNE code for updating the SimConfig objectwith mappings from the batch job submission.
2927
2925
2928
2926
4. Additional functionality within the simConfig object
``cfg.update()`` also supports the optional argument ``force_match``, which forces values in the update dictionary to match existing attributes within the ``SimConfig``object. This setting is recommended to be set to ``True`` during debugging to check for accidental creation of new attributes within the ``SimConfig``object at runtime...
2929
+
The method ``cfg.update()`` also supports the optional argument ``force_match``, which forces values in the update dictionary to match existing attributes within the ``SimConfig``object. This setting is recommended to be set to ``True`` during debugging to check for accidental creation of new attributes within the ``SimConfig``object at runtime:
2932
2930
2933
2931
.. code-block:: python
2934
2932
@@ -2943,7 +2941,7 @@ This REPLACES the previous NetPyNE code idiom for updating the SimConfig object
2943
2941
assert cfg.type ==0# cfg.type remains unchanged due to a typo in the attribute name 'type' -> 'typo'
2944
2942
assert cfg.typo ==1# instead, cfg.typo is created and set to the value 1
2945
2943
2946
-
Both the initialization of the ``cfg``objectwith``specs.SimConfig()``and the subsequent call to ``cfg.update()`` handle both dot notation and nested containers...
2944
+
Both the initialization of the ``cfg``objectwith``specs.SimConfig()``and the subsequent call to ``cfg.update()`` handle both dot notation and nested containers:
2947
2945
2948
2946
.. code-block:: python
2949
2947
@@ -2964,13 +2962,11 @@ updating the ``cfg`` object with the supplied dictionary will occur before updat
2964
2962
5. Communicating results to the search algorithm through the ``sim.send`` function
Prior batched simulations relied on ``.pkl`` files to communicate data. In order to facilitate collation, specific data values can be sent at the end of the simulation via: ``netpyne.sim.send(...)``
2968
-
2969
-
In terms of the simulation, the following functions are available to the user:
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:
2970
2966
2971
-
***sim.send(<data>)**: sends ``<data>`` to the batch ``dispatcher``, esp.
2967
+
***sim.send(<data>)**: sends ``<data>`` to the batch ``dispatcher``
2972
2968
2973
-
*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>}``
2969
+
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>}``.
0 commit comments