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

GPU acceleration #3

Open
3 tasks
seb-0-0 opened this issue Jul 25, 2023 · 3 comments
Open
3 tasks

GPU acceleration #3

seb-0-0 opened this issue Jul 25, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@seb-0-0
Copy link

seb-0-0 commented Jul 25, 2023

gpu acceleration

Implement functionalities to Speed up the calculation

Task1 : matrix diagonalization

Accelerate the matrix diagonlization and have a single test file that :

  • runs successfully with the numpy library
  • runs successfully with the cupy library
  • runs for a case for which the gpu demonstrates acceleration
@ronandrevon ronandrevon added the enhancement New feature or request label Jul 25, 2023
@biochem-fan
Copy link

I emailed this in January but to share it more widely:

If we want to calculate only at a single thickness, matrix diagonalization is less efficient and not necessary. We can directly calculate matrix exponentials.

Ultramicroscopy "Stacked-Bloch-wave electron diffraction simulations using GPU acceleration"
https://doi.org/10.1016/j.ultramic.2014.03.003

This calculates the matrix exponential directly, without diagonalization. The paper claims this approach is faster and more suitable for GPU. This is very interesting. Although the paper does not mention derivative calculation, it should also be possible.

The matrix exponential is available in SciPy as scipy.linalg.expm and its derivative as scipy.linalg.expm_frechet. PyTorch and JAX also have theirs with GPU support.

@ronandrevon
Copy link
Contributor

That sounds super interesting thank you for sharing this. We ll have a look at implementing it.

@ccp4 ccp4 deleted a comment from seb-0-0 Aug 1, 2023
@ronandrevon ronandrevon changed the title Summer Internship GPU acceleration Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ccp4 ccp4 deleted a comment from seb-0-0 Mar 18, 2024
@ronandrevon
Copy link
Contributor

I have tested matrix diagonalization on a remote gpu and it appears that I was starting to get acceleration for 2000x2000 matrix diagonalization. So to get the blochwave code to run larger matrices like that you have 2 options :

  • increase the excitation error threshold Smax so more beams in the vicinity of the ewald sphere are included in the matrix
  • increase the index Nmax so larger beams may also be included in the eigen matrix.

misc

You can make regular commits but ideally the new commits should leave the code in a working state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants