Skip to content

Commit

Permalink
Free stable identifiers listed for deletion.
Browse files Browse the repository at this point in the history
Also adds some printf debbuging statements for memory usage.
  • Loading branch information
Luc Grosheintz committed Aug 9, 2023
1 parent 3703824 commit 26ef7dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions neurodamus/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
# Internal Plugins
from . import ngv as _ngv # NOQA

from neuron import h


class METypeEngine(EngineBase):
CellManagerCls = CellDistributor
Expand Down Expand Up @@ -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()

Expand Down
3 changes: 3 additions & 0 deletions neurodamus/utils/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 26ef7dc

Please sign in to comment.