Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/DEM/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,12 @@ class DEMSolver {
/// applied to each body through atomic operations.
void UseCubForceCollection(bool flag = true) { use_cub_to_reduce_force = flag; }

/// Reduce contact forces to accelerations right after calculating them, in the same kernel. This may give some
/// performance boost if you have only polydisperse spheres, no clumps.
/// Reduce contact forces to accelerations right after calculating them, in the same kernel, instead of in a
/// separate pass over the contact array (the default). Measured on DEMdemo_PlateSinkage with 3-sphere clumps at
/// 150k to 600k grains: about +21% throughput on an NVIDIA Blackwell GPU and +96% to +204% on an AMD MI350X,
/// where the separate pass is the dominant cost and also slows the concurrent contact detection. Contact-force
/// recording and output are unaffected; the only capability given up is tracker force-pair queries, which throw
/// while this is on.
void SetCollectAccRightAfterForceCalc(bool flag = true) { collect_force_in_force_kernel = flag; }

/// Instruct the solver that there is no need to record the contact force (and contact point location etc.) in an
Expand Down
11 changes: 11 additions & 0 deletions src/demo/DEMdemo_PlateSinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ int main() {
auto max_z_finder = DEMSim.CreateInspector("clump_max_z");
auto total_mass_finder = DEMSim.CreateInspector("clump_mass");

// Accumulate contact forces onto owners inside the force kernel rather
// than in the default separate pass over the contact array. Measured on
// this demo at 150k to 600k grains: +21% throughput on a Blackwell GPU,
// +96% to +204% on an MI350X (see SetCollectAccRightAfterForceCalc).
// This demo reads the plate load through ContactAcc, which is unaffected;
// only tracker force-pair queries become unavailable.
DEMSim.SetCollectAccRightAfterForceCalc(true);

DEMSim.SetInitTimeStep(step_size);
DEMSim.SetGravitationalAcceleration(make_float3(0, 0, -9.81));
DEMSim.Initialize();
Expand Down Expand Up @@ -214,6 +222,9 @@ int main() {

auto max_z_finder = DEMSim.CreateInspector("clump_max_z");

// Same choice as stage 1, for the same reason.
DEMSim.SetCollectAccRightAfterForceCalc(true);

DEMSim.SetInitTimeStep(step_size);
DEMSim.SetGravitationalAcceleration(make_float3(0, 0, -9.81));
DEMSim.Initialize();
Expand Down
Loading