Uploaded image for project: 'The Virtual Brain'
  1. The Virtual Brain
  2. TVB-2204

Better control memory use during simulation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Quite optimizations could be made if we had better control over memory use in the simulation: (1) preallocate all memory and reuse (2) float32 is sufficient for all but large summation operations and (3) use a SIMD friendly stride 1 dimension (e.g. state shape becomes (..., nnode/4, nsvar, nmode, 4)).

      Components could request buffers during configure step and then compute with only those buffers issued. Numpy has some facility to track allocations (https://github.com/numpy/numpy/blob/master/tools/allocation_tracking/track_allocations.py) which may be useful. Computations done with numba functions compiled with the nopython mode would also guarantee (iiuc) that no allocations are performed.

      This is also a large step towards using native/compiled code in TVB. Such code would be far easier to write if all data structures are already allocated.

      A principle choice and challenge is if we keep API (including array shapes) the same, and if so, there's quite some work to make sure it's done correctly. If not, user code needs to change.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              marmaduke.woodman Marmaduke Woodman
              Reporter:
              marmaduke.woodman Marmaduke Woodman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 week
                  1w
                  Remaining:
                  Remaining Estimate - 1 week
                  1w
                  Logged:
                  Time Spent - Not Specified
                  Not Specified