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 LFPyKit support #1857

Open
llandsmeer opened this issue Mar 2, 2022 · 1 comment
Open

Better LFPyKit support #1857

llandsmeer opened this issue Mar 2, 2022 · 1 comment
Labels
enhancement Feature Request gpu Anything to do with GPU-specific code, or building for GPU targets. help wanted lfpy LFPY neuroscience Project: Arborio python

Comments

@llandsmeer
Copy link
Contributor

As seen in this notebook, LFP calculation in arbor works great: https://github.com/llandsmeer/iopublic/blob/main/Local%20field%20potential%20v2.ipynb

Now, in implementing this I had two problems:

  • Separate sampling & reducing. We need transmembrane & stimulus currents for every (~200000) CV, which is a lot. On my 24GB RTX6000, that means I can take 600 samples at most (while I want at least 10000).
  • Impossible to retrieve cell geometries from the recipe without editing the recipe. While not a big problem, this means it's impossible to write a general (recipe,sim) -> LFPy measurements function

The first problem is the largest one. Currently, two buffers gets filled up on the GPU with 600 samples for each CV, then copied back to host and multiplied with a large matrix. Much more efficient would be performing this matrix multiplication each or every timesteps on the GPU itself. This would allow for longer measurement times, as the end result on the matrix multiplication in my example is just a small vector for each scheduled timestep. Of course, restarting the simulation every 600 samples is also a solution, but will become very annoying for network sizes + GPU memory sizes that allow for just 1 or 2 samples at a time. Then the enormous copy back of CV current just to reduce it to a few values is also pretty inefficient.

Proposed solutions

  • Allow transmemrane+external currents for each CV to be reduced via matrix multiplication on the GPU, via the python api
  • Allow for retrieval of cable cell geometries from the recipe (arbor.get_cell_geometry(recipe, gid))
@llandsmeer llandsmeer added enhancement help wanted python gpu Anything to do with GPU-specific code, or building for GPU targets. lfpy LFPY Feature Request neuroscience Project: Arborio labels Mar 2, 2022
@thorstenhater
Copy link
Contributor

Partially duplicating #1385, reproducing here, closing the other.

In #1115 a number of options were floated for local field potential calculations. While Option 1 has been implemented using the generic sampling infrastructure available in the C++ and Python interfaces, @espenhgn has pointed out that the memory usage could become prohibitive in long simulations, and that the second option, viz. a specialized sampler callback for LFP calculations, would be more robust.

This would comprise a specialized callback that takes transmembrane current samples from one or more cells, initialized with a linear response matrix computed by the client code for summing the corresponding field contributions at electrode sites. The sampler would record the electrode contributions either in sum, or individually from each cell (for reproducibility), to some in-memory data store for global reduction and analysis at simulation end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature Request gpu Anything to do with GPU-specific code, or building for GPU targets. help wanted lfpy LFPY neuroscience Project: Arborio python
Projects
None yet
Development

No branches or pull requests

2 participants