Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Print memory footprint of each mechanism #833

Merged
merged 10 commits into from
Jun 30, 2022
Merged

Conversation

iomaganaris
Copy link
Contributor

@iomaganaris iomaganaris commented Jun 23, 2022

Description

Report the size of the dynamically allocated memory for each mechanism based on the ml->data and ml->pdata structures.

How to test this?

Building CoreNEURON and running the following test:

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=./install -DNRN_ENABLE_CORENEURON=ON -DCORENRN_ENABLE_NMODL=OFF -DCORENRN_ENABLE_GPU=OFF -G Ninja
cmake --build . --parallel 8 --target install
bash tests/integration/ring/integration_test.sh

Has the following output:

================= MECHANISMS COUNT BY TYPE ===================
  Id                 Name      Count   Total memory size (KiB)
   0               (null)          0                      0.00
   1               (null)          0                      0.00
   2           morphology          0                      0.00
   3          capacitance        392                      7.88
   4                  pas        372                     16.20
   5        extracellular          0                      0.00
   6              fastpas          0                      0.00
   7               IClamp          0                      0.00
   8         AlphaSynapse          0                      0.00
   9               ExpSyn         40                      4.57
  10              Exp2Syn          0                      0.00
  11              SEClamp          0                      0.00
  12               VClamp          0                      0.00
  13               OClamp          0                      0.00
  14              APCount          0                      0.00
  15               na_ion         20                      1.16
  16                k_ion         20                      1.16
  17                   hh         20                      4.67
  18              NetStim          1                      0.20
  19             IntFire1          0                      0.00
  20             IntFire2          0                      0.00
  21             IntFire4          0                      0.00
  22     PointProcessMark          0                      0.00
  23          PatternStim          0                      0.00
  24              HalfGap          0                      0.00
==============================================================
Memory size information for all NrnThreads per rank
------------------------------------------------------------------
                 field          min          max          avg
                n_cell           10           10           10.00
         n_compartment          396          408          402.00
           n_mechanism            6            7            6.50
                _ndata         4472         4632         4552.00
               _nidata            0            0            0.00
               _nvdata           20           23           21.50
              n_presyn           10           11           10.50
      n_presyn (bytes)          640          704          672.00
        n_input_presyn           10           10           10.00
n_input_presyn (bytes)          240          240          240.00
             n_pntproc           20           21           20.50
     n_pntproc (bytes)          160          168          164.00
              n_netcon           10           11           10.50
      n_netcon (bytes)          400          440          420.00
              n_weight           10           11           10.50
     NrnThread (bytes)        43532        45184        44358.00
    model size (bytes)        43948        45608        44778.00
 Setup Done   : 0.00 seconds 
 Model size   : 87.46 kB

Only issue is that with NMODL the NetStim size of net_send is 128 instaed of 0.

Test System

  • OS: Ubuntu 20.04
  • Compiler: GCC 9.4.0
  • Version:master
  • Backend: CPU

@iomaganaris iomaganaris requested review from ohm314 and pramodk June 23, 2022 15:30
coreneuron/io/mech_report.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@ohm314 ohm314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@alexsavulescu alexsavulescu force-pushed the magkanar/print_mechanism_size branch from e8b7a97 to 648746d Compare June 27, 2022 13:46
@pramodk pramodk force-pushed the magkanar/print_mechanism_size branch from 648746d to ec4ab93 Compare June 30, 2022 04:55
@codecov-commenter
Copy link

Codecov Report

Merging #833 (ec4ab93) into master (6691e99) will increase coverage by 0.06%.
The diff coverage is 78.94%.

@@            Coverage Diff             @@
##           master     #833      +/-   ##
==========================================
+ Coverage   57.50%   57.56%   +0.06%     
==========================================
  Files         101      101              
  Lines        9158     9190      +32     
==========================================
+ Hits         5266     5290      +24     
- Misses       3892     3900       +8     
Impacted Files Coverage Δ
coreneuron/apps/corenrn_parameters.cpp 90.60% <ø> (ø)
coreneuron/apps/corenrn_parameters.hpp 100.00% <ø> (ø)
coreneuron/io/nrn_setup.hpp 84.61% <ø> (ø)
coreneuron/mechanism/mechanism.hpp 20.00% <54.54%> (+20.00%) ⬆️
coreneuron/io/nrn_setup.cpp 84.88% <76.92%> (-0.24%) ⬇️
coreneuron/io/mech_report.cpp 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6691e99...ec4ab93. Read the comment docs.

Copy link
Collaborator

@pramodk pramodk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pramodk pramodk merged commit 0574812 into master Jun 30, 2022
@pramodk pramodk deleted the magkanar/print_mechanism_size branch June 30, 2022 06:27
pramodk pushed a commit to neuronsimulator/nrn that referenced this pull request Nov 2, 2022
* Print each mechanism's size
* Fix compilation with -DDEBUG
* Improve the calculation of the total memory for each mechanism
* Improved calculation of NrnThreadMembList

Co-authored-by: Olli Lupton <oliver.lupton@epfl.ch>

CoreNEURON Repo SHA: BlueBrain/CoreNeuron@0574812
iomaganaris added a commit that referenced this pull request Nov 17, 2022
* Print each mechanism's size
* Fix compilation with -DDEBUG
* Improve the calculation of the total memory for each mechanism
* Improved calculation of NrnThreadMembList

Co-authored-by: Olli Lupton <oliver.lupton@epfl.ch>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants