Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better memory management #13

Open
rykerfish opened this issue Nov 27, 2024 · 0 comments
Open

Better memory management #13

rykerfish opened this issue Nov 27, 2024 · 0 comments

Comments

@rykerfish
Copy link
Collaborator

rykerfish commented Nov 27, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant