TrixiParticles.jl icon indicating copy to clipboard operation
TrixiParticles.jl copied to clipboard

Minimally invasive GPU implementation with KernelAbstractions.jl without neighborhood search

Open efaulhaber opened this issue 1 year ago • 2 comments

See #484. Based on #532 and #533.

This PR is working only with KernelAbstractions.jl, without even using CUDA.jl in TrixiParticles or in an extension module. All you have to do to run the dam_break_2d.jl example on an NVidia GPU is the following:

  1. Change the semidiscretize call in the file to ode = semidiscretize(semi, tspan, data_type=nothing). This doesn't do anything, as data_type=nothing is the default, but it allows us to overwrite it with trixi_include. Note that I didn't add this to the file because this feature is experimental and not (yet) documented.
  2. Change the Semidiscretization call in the file to semi = Semidiscretization(fluid_system, boundary_system, neighborhood_search=nothing), since neighborhood search is not yet supported.
  3. Run
    julia> using TrixiParticles, CUDA
    
    julia> trixi_include("examples/fluid/dam_break_2d.jl", tspan=(0.0, 0.1), data_type=CuArray, saving_callback=nothing, saving_paper=nothing);
    
    • We're passing data_type=CuArray to run this on the GPU with CUDA.jl. We can also pass data_type=nothing (the default), which runs the usual code with Polyester.jl. And we can pass data_type=Array to run the GPU kernels compiled by KernelAbstractions.jl on the CPU. We could also pass data_type=ROCArray to run a simulation on an AMD GPU.
    • We need to disable the two saving callbacks, as I haven't made them GPU-compatible yet.

efaulhaber avatar Apr 03 '24 13:04 efaulhaber

Codecov Report

Attention: Patch coverage is 36.00000% with 80 lines in your changes are missing coverage. Please review.

Project coverage is 68.40%. Comparing base (3e14679) to head (0eebdaf).

Files Patch % Lines
src/general/semidiscretization.jl 38.46% 32 Missing :warning:
...chemes/boundary/dummy_particles/dummy_particles.jl 0.00% 15 Missing :warning:
src/general/corrections.jl 43.75% 9 Missing :warning:
src/general/neighborhood_search.jl 0.00% 8 Missing :warning:
...rc/schemes/fluid/weakly_compressible_sph/system.jl 12.50% 7 Missing :warning:
src/schemes/boundary/system.jl 54.54% 5 Missing :warning:
src/general/gpu.jl 0.00% 1 Missing :warning:
src/general/system.jl 0.00% 1 Missing :warning:
src/schemes/fluid/viscosity.jl 50.00% 1 Missing :warning:
src/schemes/solid/total_lagrangian_sph/system.jl 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
- Coverage   69.42%   68.40%   -1.03%     
==========================================
  Files          69       69              
  Lines        3967     4038      +71     
==========================================
+ Hits         2754     2762       +8     
- Misses       1213     1276      +63     
Flag Coverage Δ
unit 68.40% <36.00%> (-1.03%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 02 '24 16:05 codecov[bot]

Fix doc strings.

svchb avatar May 03 '24 13:05 svchb

Superseded by #534.

efaulhaber avatar Jun 12 '24 09:06 efaulhaber