diff --git a/src/DEM/API.h b/src/DEM/API.h index b46c074c..8bacc623 100644 --- a/src/DEM/API.h +++ b/src/DEM/API.h @@ -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 diff --git a/src/demo/DEMdemo_PlateSinkage.cpp b/src/demo/DEMdemo_PlateSinkage.cpp index 2563d754..5b8ac15c 100644 --- a/src/demo/DEMdemo_PlateSinkage.cpp +++ b/src/demo/DEMdemo_PlateSinkage.cpp @@ -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(); @@ -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();