-
Notifications
You must be signed in to change notification settings - Fork 16
Make DEM run on GPUs and with Float32
#979
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
Conversation
|
/run-gpu-tests |
|
/run-gpu-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enables the Discrete Element Method (DEM) to run on GPUs with Float32 precision support, primarily for Apple Metal GPUs but compatible with NVIDIA and AMD as well. The changes focus on making the code GPU-compatible through Adapt.jl integration and ensuring proper Float32 handling throughout the DEM implementation.
Key changes:
- Refactored DEM and boundary system constructors to work with Adapt.jl for GPU compatibility
- Replaced hardcoded floating-point literals with type-safe conversions to support Float32
- Added GPU test coverage for the DEM rectangular tank example
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/examples/gpu.jl | Added comprehensive GPU test for DEM rectangular tank example with Float32 precision |
| src/schemes/structure/discrete_element_method/system.jl | Refactored constructor for Adapt.jl compatibility and fixed Float32 support in radius calculations |
| src/schemes/structure/discrete_element_method/rhs.jl | Replaced hardcoded doubles with type-safe conversions and updated comments |
| src/schemes/structure/discrete_element_method/contact_models.jl | Reordered arithmetic to avoid hardcoded division |
| src/schemes/boundary/dem_boundary/system.jl | Refactored constructor for Adapt.jl compatibility with proper Float32 handling |
| src/general/gpu.jl | Registered DEMSystem and BoundaryDEMSystem with Adapt.jl |
| examples/dem/rectangular_tank_2d.jl | Updated perturbation logic and added default parallelization backend |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/run-gpu-tests |
|
/run-gpu-tests |
|
/run-gpu-tests |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #979 +/- ##
===========================================
+ Coverage 64.87% 89.63% +24.76%
===========================================
Files 120 120
Lines 8560 8587 +27
===========================================
+ Hits 5553 7697 +2144
+ Misses 3007 890 -2117
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The rectangular tank example now runs on Apple GPUs (and should therefore also run on Nvidia and AMD):