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

Minimally invasive GPU implementation with KernelAbstractions.jl without neighborhood search #493

Closed
wants to merge 17 commits into from

Conversation

efaulhaber
Copy link
Member

@efaulhaber efaulhaber commented Apr 3, 2024

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.

Copy link

codecov bot commented May 2, 2024

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 ⚠️
...chemes/boundary/dummy_particles/dummy_particles.jl 0.00% 15 Missing ⚠️
src/general/corrections.jl 43.75% 9 Missing ⚠️
src/general/neighborhood_search.jl 0.00% 8 Missing ⚠️
...rc/schemes/fluid/weakly_compressible_sph/system.jl 12.50% 7 Missing ⚠️
src/schemes/boundary/system.jl 54.54% 5 Missing ⚠️
src/general/gpu.jl 0.00% 1 Missing ⚠️
src/general/system.jl 0.00% 1 Missing ⚠️
src/schemes/fluid/viscosity.jl 50.00% 1 Missing ⚠️
src/schemes/solid/total_lagrangian_sph/system.jl 0.00% 1 Missing ⚠️
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%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@svchb
Copy link
Collaborator

svchb commented May 3, 2024

Fix doc strings.

@efaulhaber efaulhaber force-pushed the gpu3 branch 4 times, most recently from fb8d6ab to 12ef155 Compare May 22, 2024 13:55
@efaulhaber
Copy link
Member Author

Superseded by #534.

@efaulhaber efaulhaber closed this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants