ttricco / sarracen

A Python library for smoothed particle hydrodynamics (SPH) analysis and visualization.
https://sarracen.readthedocs.io
GNU General Public License v3.0
16 stars 18 forks source link

GPU accelerated backend for interpolation functions #20

Closed AndrewHarris709 closed 2 years ago

AndrewHarris709 commented 2 years ago

Includes a GPU accelerated backend for all the currently available interpolation functions. The GPU implementation uses CUDA kernels created with numba. Using this backend results in a noticeable performance boost in large datasets.

A CUDA compatible graphics card (with proper drivers) is required for the GPU backend to function properly.

The backend used by interpolation functions can be changed in two ways:

  1. The backend argument can be provided to any render/interpolation function, set this to gpu for the CUDA backend.
  2. The backend property of a SarracenDataFrame can be set. Any interpolation/render function used with this dataset will use the defined backend.

An example of performance differences between backends: 2D Rendering - Small dataset (2.62MB)

2D Rendering - Large dataset (1.31GB)

Testbench:

As well, the CPU backend has been modified to remove a critical race condition. CPU interpolation should now complete without noise.

AndrewHarris709 commented 2 years ago

Atomic operations have been reverted. With this change the unit test test_race_conditions() will fail, this is expected.

ttricco commented 2 years ago

@AndrewHarris709 Are you able to take a look at resolving the merge conflicts here?