From c22428502e120921e00f97d1aa0d6a2b67940169 Mon Sep 17 00:00:00 2001
From: Kenny Sharma <kenny.sharma@tum.de>
Date: Thu, 27 Jul 2017 13:32:32 +0200
Subject: [PATCH] [NRRPLT-5489] Resolve performance issues by using correct
 timestep.

This patch resolves the distributed simulation performance issues by
ensuring all brain simulation processes are using the correct simulation/
integration timestep. Previously, the main CLE process would advance with
the correct timestep (default 20ms), but each distributed process was
advancing with the simulator timestep (default 0.1ms) - causing significant
overhead and 200x the calls on each remote process.

This patch improves performance to nearly realtime (small overhead for
multiple processes) rather than the prior hundreds of times slower. Further
optimizations can be made in the CLE as we add larger scale brains.

Change-Id: Id3974b31efc24508b3c48b9e7d1e250f44db8be8
---
 .../hbp_nrp_music_interface/launch/MUSICBrainProcess.py      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hbp_nrp_music_interface/hbp_nrp_music_interface/launch/MUSICBrainProcess.py b/hbp_nrp_music_interface/hbp_nrp_music_interface/launch/MUSICBrainProcess.py
index 7603432..893bfc4 100644
--- a/hbp_nrp_music_interface/hbp_nrp_music_interface/launch/MUSICBrainProcess.py
+++ b/hbp_nrp_music_interface/hbp_nrp_music_interface/launch/MUSICBrainProcess.py
@@ -94,6 +94,9 @@ class MUSICBrainProcess(object):
 
         self._proxies = xml_factory.create_proxies(music_xml)
 
+        # extract the simulation timestep from the BIBI or default to 20 ms
+        self._timestep = float(self._bibi.timestep) if self._bibi.timestep is not None else 20.0
+
     def run(self):
         """
         Blocking run loop for this brain process. First accept any transfer function configuration
@@ -140,7 +143,7 @@ class MUSICBrainProcess(object):
 
         # run until forcefully terminated
         while True:
-            sim.run(sim.get_time_step())
+            self._brain_controller.run_step(self._timestep)
 
     def _connect_tf(self, params):
         """
-- 
GitLab