Skip to content

GPU acceleration #3

Open
Open

Description

@seb-0-0

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

Activity

  1. biochem-fan commented on Jul 25, 2023

    @biochem-fan

    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.

  2. ronandrevon commented on Jul 26, 2023

    @ronandrevon
    Contributor

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

  3. deleted a comment from seb-0-0 on Aug 1, 2023
  4. changed the title [-]Summer Internship[/-] [+]GPU acceleration[/+] on Mar 18, 2024
  5. deleted a comment from seb-0-0 on Mar 18, 2024
  6. deleted a comment from seb-0-0 on Mar 18, 2024
  7. deleted a comment from seb-0-0 on Mar 18, 2024
  8. deleted a comment from seb-0-0 on Mar 18, 2024
  9. deleted a comment from seb-0-0 on Mar 18, 2024
  10. deleted a comment from seb-0-0 on Mar 18, 2024
  11. deleted a comment from seb-0-0 on Mar 18, 2024
  12. deleted a comment from seb-0-0 on Mar 18, 2024
  13. ronandrevon commented on Mar 18, 2024

    @ronandrevon
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions