dpploy / cortix

Cortix is a Python library for network dynamics modeling and HPC simulation.
https://cortix.org
Other
11 stars 4 forks source link

Signal implementation for modules #201

Open ghost opened 5 years ago

ghost commented 5 years ago

Some modules like DataPlot simply listen for requests and serve them in a loop with no exit condition like in:

https://github.com/dpploy/cortix/blob/f65005fd1494f724aa7fb610af6b32e3f0ffee87/cortix/examples/dataplot.py#L67-L74

Such modules should ideally die whenever the rest of the modules in the network die. To implement this behavior, Cortix needs a way to cleanly terminate a module from the master process (rank) upon request.

dealmeidavf commented 5 years ago

This module is a bit of a special case since it starts as many threads within one process (MPI or not) as there are ports connected to it...maybe some other internal behavior needs to be developed. The idea of having threads running within a process has a limit. Recall the run case with 1000 droplets. This module had 1000 threads open on a single MPI process.

dealmeidavf commented 5 years ago

Signals sometimes can be part of model and they are implement with ports and part of the definition of a module. An example is in a facility modeling. Say module A models a process that breakdowns. If module A models the downstream process, a warning signal can be sent from A to B.

Following this idea, Cortix can initiate ports between modules in the background without the user knowledge. These ports can be used to track the progress of the modules by sending signals. This is a possible feature in the future.