cadCAD-org/cadCAD

option for single mode for runs greater than one

DrCatman opened this issue · 2 comments

when runs are greater than one, the execution mode defaults to multi-threaded execution when local mode is selected.

when single mode is specified, simulation execution should be single- threaded

The execution mode needs to be clear

  • when using jupyter notebook, it should be multi-proccessing (related #242)
  • data pipelines for digital twins, should be multi-threading

note:
jupyter has control of the threads and uses tornado for multi-threading
@rogervs

With following:

exec_context = ExecutionContext()

system_params = {
    'a': [1.0],
    'b': [1.0],
    'c': [0],
    'dt': [0.1]
}

the params variable inside a policy function looks like this:
{'a': 1.0, 'b': 1.0, 'c': 0, 'dt': 0.1}
This is what is expected.

However, by setting the following:
exec_context = ExecutionContext(context=ExecutionMode.single_mode)

the params variable inside a policy function becomes a list with a dictionary inside it:
[{'a': 1.0, 'b': 1.0, 'c': 0, 'dt': 0.1}]
Which breaks the simulation.

If however, we add a parameter sweep (whilst maintaining single_mode):

system_params = {
    'a': [1.0, 2.0],
    'b': [1.0],
    'c': [0],
    'dt': [0.1]
}

the params variable inside a policy function drops the enclosing list and is once again just a dictionary:
{'a': 1.0, 'b': 1.0, 'c': 0, 'dt': 0.1}
for first run.

{'a': 2.0, 'b': 1.0, 'c': 0, 'dt': 0.1}
for second run.

@JEJodesty I think this relates to what we discussed in the last Core-Tech meeting.
Probably related to:
#254
#251
#248
#242

Related to cadCAD-org/demos@1813045 , fix implemented in cadCAD-org/demos@2f0dbd5 merely by removing requirement for multi_proc