From 26ef7dccb3f0493bef8495c90c27ccc55e9ebb03 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Wed, 9 Aug 2023 11:49:16 +0200 Subject: [PATCH] Free stable identifiers listed for deletion. Also adds some printf debbuging statements for memory usage. --- neurodamus/node.py | 6 ++++++ neurodamus/utils/memory.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/neurodamus/node.py b/neurodamus/node.py index 9c38d5c9..e05c8408 100644 --- a/neurodamus/node.py +++ b/neurodamus/node.py @@ -37,6 +37,8 @@ # Internal Plugins from . import ngv as _ngv # NOQA +from neuron import h + class METypeEngine(EngineBase): CellManagerCls = CellDistributor @@ -1469,6 +1471,10 @@ def clear_model(self, avoid_creating_objs=False, avoid_clearing_queues=True): # Clear BBSaveState self._bbss.ignore() + # There should be no more datahandles to the old model. Hence, + # the stable identifiers can be deleted now. + h.clear_deferred_deletion_vectors() + # Shrink ArrayPools holding mechanism's data in NEURON pool_shrink() diff --git a/neurodamus/utils/memory.py b/neurodamus/utils/memory.py index d502f78d..54ba6075 100644 --- a/neurodamus/utils/memory.py +++ b/neurodamus/utils/memory.py @@ -73,6 +73,9 @@ def print_mem_usage(): """ Print memory usage information across all ranks. """ + + MPI.pc.print_memory_stats() + usage_mb = get_mem_usage() min_usage_mb = MPI.pc.allreduce(usage_mb, MPI.MIN)