Warp compiles numerical Python kernels to code that runs in parallel on CPUs or CUDA GPUs. It supplies arrays, geometric operations and automatic differentiation that simulation projects can use to implement their own computations.
How does Python move thousands of particles on a GPU?
- InputPrepare arrays
particle positions + velocitiesStore one position and velocity per particle.
- ProcessLaunch GPU kernels
spatial grid → contacts → integrationFind nearby particles and compute the next state.
- OutputMeasure and draw
full arrays + sampled viewportThe viewer draws a subset and the script reports all-particle statistics.
Dispatch a kernel from Python
Python prepares the arrays and dispatches work. A Warp kernel performs per-particle work in parallel on the GPU. The DEM example searches a spatial grid for neighbors, computes contact forces, and advances position and velocity.
Read the full array and the viewer sample
The recorded GPU run computes 65536 particles and displays 16384. The complete position array has shape [65536, 3], and the viewer selects one of every four rows with points[::4]. Keep that distinction when interpreting simulation counts and viewport performance. Official Warp DEM code · Particle lab
Warp 1.19
Warp 1.19.0 adds reusable sparse-matrix assembly, new sparse preconditioners, Surface Nets mesh extraction, and experimental gradients for texture sampling. Reusable assembly helps when a finite-element solve repeatedly changes coefficients while keeping the same sparsity pattern. Isaac Lab 3.0 and Isaac Sim 6.2 target Warp 1.17.0. Warp 1.19.0 release · Isaac Lab 3.0 release · Isaac Sim 6.2 release notes
Architecture
| Component | Responsibility and data boundary |
|---|---|
@wp.kernel / wp.launch |
A kernel defines work for a logical thread. The launch sets the iteration dimensions and passes typed arrays and parameters. |
| Compilation and cache | Warp lowers a Python module’s kernels and functions to native code for the selected target. Its module cache avoids repeating the same compilation. |
wp.array / interop |
Host code allocates the arrays and chooses placement. The Warp/PyTorch bridge can share compatible memory, so device placement and synchronization matter when one framework hands off a buffer. |
wp.Tape |
Tape records differentiable kernel launches and references to arrays. Backward launches use the required forward values and accumulate gradients in gradient buffers. |
Guide diagram based on the official references below.
flowchart LR
p["Typed Python kernels"]
c["Module compilation and cache"]
a["Device arrays"]
k["Parallel forward launches"]
loss["Scalar loss"]
t["Tape and adjoint kernels"]
g["Input gradients"]
p --> c
c --> k
a --> k
k --> loss
k --> t
loss --> t
t --> g
Official figures and examples
Warp’s compiler pipeline shows how kernel declarations become device code. The Python application controls allocation and launch. Original figure and context
The Tape diagram distinguishes forward kernel launches and the reverse pass used to propagate gradients. Original figure and context
Walkthrough
- For a spring parameter fit, allocate arrays for initial positions, velocities, and stiffness. Write one kernel to advance the state and another to compare the predicted endpoint with an observed endpoint.
- Run the launch sequence inside a
wp.Tape, keep the state values required by backward launches, and callbackwardon the loss. Feed the stiffness gradient to the optimizer. - Benchmark steady-state execution after a warmup that includes first-use compilation. For repeated launch graphs, evaluate the graph capture and replay API once data flow and device placement are stable.
Validation
- Tape references arrays rather than storing every value they held. Keep separate states or use checkpointing when an iterative kernel overwrites values needed for backward computation.
- On a small problem, compare the computed gradient with finite differences before increasing rollout length or using a GPU graph.
License and scope
Warp uses Apache-2.0. Runtime and GPU requirements depend on the release. Warp 1.19 LICENSE