CUDA graphs#
For fixed task sets and timesteps, DLSSolver can
capture a one-step solve_and_integrate graph to reduce launch overhead.
Requirements#
CUDA device
Fixed task list (same objects each frame)
Fixed
dtand damping between capturesNo host→device copies inside the captured region
Usage#
solver = mw.DLSSolver(cfg)
cfg.set_integration_dt(0.01) # written before capture
# Warm-up (allocates task buffers, compiles kernels)
solver.solve_and_integrate(tasks, dt=0.01, use_graph=True)
while running:
solver.solve_and_integrate(tasks, dt=0.01, use_graph=True)
If tasks or dt change, call invalidate_graph()
(or recreate the solver).
Implementation notes#
Integration uses out-of-place
qposwrites; in-place aliasing breaks graphs.dtis stored in a device buffer viaset_integration_dtbefore capture.LM / L-BFGS / constrained backends do not expose graph capture yet.