TrixiParticles.jl
TrixiParticles.jl copied to clipboard
Minimally invasive GPU implementation with KernelAbstractions.jl without neighborhood search
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:
- Change the
semidiscretizecall in the file toode = semidiscretize(semi, tspan, data_type=nothing). This doesn't do anything, asdata_type=nothingis the default, but it allows us to overwrite it withtrixi_include. Note that I didn't add this to the file because this feature is experimental and not (yet) documented. - Change the
Semidiscretizationcall in the file tosemi = Semidiscretization(fluid_system, boundary_system, neighborhood_search=nothing), since neighborhood search is not yet supported. - 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=CuArrayto run this on the GPU with CUDA.jl. We can also passdata_type=nothing(the default), which runs the usual code with Polyester.jl. And we can passdata_type=Arrayto run the GPU kernels compiled by KernelAbstractions.jl on the CPU. We could also passdata_type=ROCArrayto run a simulation on an AMD GPU. - We need to disable the two saving callbacks, as I haven't made them GPU-compatible yet.
- We're passing
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).
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.
Fix doc strings.
Superseded by #534.