Skip to content

Better memory management #13

Description

@rykerfish

The current implementation is unnecessarily memory-hungry, especially the grid mode. There are two main ways I've thought of to fix this.

Notation: $\Delta_t$ = sim_dt, $\Delta_o$ = output_dt, $\tau$ = simulation duration.

  1. Instead of allocating an array the size of $N_{grid} \cdot \frac{\Delta_t}{\tau}$ and downsampling the timeseries at the end, a smaller array of size $N_{grid} \cdot \frac{\Delta_o}{\Delta_t}$ could be allocated. During the simulation, the results in this array would be averaged into the final output array and then the transient array could be reused. This would require some work to figure out how to handle puffs that overlap two or more averaging windows.
  2. Since many timesteps are zero, the results could be built using sparse arrays. The threshold for this to save memory is for at least 66% of the array to be zero, which I think is the case but should be verified. This is more straightforward then option 1 but seemingly with a smaller memory savings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions