NVIDIA Warp Documentation¶
Warp is a Python framework for writing high-performance simulation and graphics code. Warp takes regular Python functions and JIT compiles them to efficient kernel code that can run on the CPU or GPU.
Warp is designed for spatial computing and comes with a rich set of primitives that make it easy to write programs for physics simulation, perception, robotics, and geometry processing. In addition, Warp kernels are differentiable and can be used as part of machine-learning pipelines with frameworks such as PyTorch, JAX and Paddle.
Below are some examples of simulations implemented using Warp:
Quickstart¶
The easiest way to install Warp is from PyPI:
$ pip install warp-lang
You can also use `pip install warp-lang[extras]`
to install additional dependencies for running examples
and USD-related features.
The binaries hosted on PyPI are currently built with the CUDA 12 runtime and therefore require a minimum version of the CUDA driver of 525.60.13 (Linux x86-64) or 528.33 (Windows x86-64).
If you require GPU support on a system with an older CUDA driver, you can build Warp from source or install wheels built with the CUDA 11.8 runtime as described in Installing from GitHub Releases.
Basic Example¶
An example first program that computes the lengths of random 3D vectors is given below:
import warp as wp
import numpy as np
num_points = 1024
@wp.kernel
def length(points: wp.array(dtype=wp.vec3),
lengths: wp.array(dtype=float)):
# thread index
tid = wp.tid()
# compute distance of each point from origin
lengths[tid] = wp.length(points[tid])
# allocate an array of 3d points
points = wp.array(np.random.rand(num_points, 3), dtype=wp.vec3)
lengths = wp.zeros(num_points, dtype=float)
# launch kernel
wp.launch(kernel=length,
dim=len(points),
inputs=[points, lengths])
print(lengths)
Additional Examples¶
The warp/examples directory in
the Github repository contains a number of scripts categorized under subdirectories
that show how to implement various simulation methods using the Warp API. Most examples
will generate USD files containing time-sampled animations in the current working directory.
Before running examples, users should ensure that the usd-core
, matplotlib
, and pyglet
packages are installed using:
pip install warp-lang[extras]
These dependencies can also be manually installed using:
pip install usd-core matplotlib pyglet
Examples can be run from the command-line as follows:
python -m warp.examples.<example_subdir>.<example>
Most examples can be run on either the CPU or a CUDA-capable device, but a handful require a CUDA-capable device. These are marked at the top of the example script.
USD files can be viewed or rendered inside NVIDIA Omniverse, Pixar’s UsdView, and Blender. Note that Preview in macOS is not recommended as it has limited support for time-sampled animations.
Built-in unit tests can be run from the command-line as follows:
python -m warp.tests
warp/examples/core¶
warp/examples/fem¶
warp/examples/optim¶
warp/examples/sim¶
Omniverse¶
Omniverse extensions for Warp are available in the extension registry inside
Omniverse Kit or USD Composer.
The omni.warp.core
extension installs Warp into the Omniverse Application’s
Python environment, which allows users to import the module in their scripts and nodes.
The omni.warp
extension provides a collection of OmniGraph nodes and sample
scenes demonstrating uses of Warp in OmniGraph.
Enabling the omni.warp
extension automatically enables the omni.warp.core
extension.
Please see the Omniverse Warp Documentation for more details on how to use Warp in Omniverse.
Learn More¶
Please see the following resources for additional background on Warp:
The underlying technology in Warp has been used in a number of research projects at NVIDIA including the following publications:
Accelerated Policy Learning with Parallel Differentiable Simulation - Xu, J., Makoviychuk, V., Narang, Y., Ramos, F., Matusik, W., Garg, A., & Macklin, M. (2022)
DiSECt: Differentiable Simulator for Robotic Cutting - Heiden, E., Macklin, M., Narang, Y., Fox, D., Garg, A., & Ramos, F (2021)
gradSim: Differentiable Simulation for System Identification and Visuomotor Control - Murthy, J. Krishna, Miles Macklin, Florian Golemo, Vikram Voleti, Linda Petrini, Martin Weiss, Breandan Considine et al. (2021)
Support¶
Problems, questions, and feature requests can be opened on GitHub Issues.
The Warp team also monitors the #warp forum on the public Omniverse Discord server, come chat with us!
Versioning¶
Versions take the format X.Y.Z, similar to Python itself:
Increments in X are reserved for major reworks of the project causing disruptive incompatibility (or reaching the 1.0 milestone).
Increments in Y are for regular releases with a new set of features.
Increments in Z are for bug fixes. In principle, there are no new features. Can be omitted if 0 or not relevant.
This is similar to Semantic Versioning minor versions if well-documented and gradually introduced.
Note that prior to 0.11.0, this schema was not strictly adhered to.
License¶
Warp is provided under the NVIDIA Software License, please see LICENSE.md for the full license text.
Contributing¶
Contributions and pull requests from the community are welcome and are taken under the terms described in the Feedback section of LICENSE.md. Please see the Contribution Guide for more information on contributing to the development of Warp.
Citing¶
If you use Warp in your research, please use the following citation:
@misc{warp2022,
title= {Warp: A High-performance Python Framework for GPU Simulation and Graphics},
author = {Miles Macklin},
month = {March},
year = {2022},
note= {NVIDIA GPU Technology Conference (GTC)},
howpublished = {\url{https://github.com/nvidia/warp}}
}
Full Table of Contents¶
- Installation
- Basics
- Devices
- Differentiability
- Generics
- Interoperability
- Configuration
- Debugging
- Limitations
- Contribution Guide
- FAQ
- How does Warp relate to other Python projects for GPU programming, e.g.: Numba, Taichi, cuPy, PyTorch, etc.?
- Does Warp support all of the Python language?
- When should I call
wp.synchronize()
? - What happens when you differentiate a function like
wp.abs(x)
? - Does Warp support multi-GPU programming?
- Should I switch to Warp over IsaacGym/PhysX?
- Why aren’t assignments to Warp arrays supported outside of kernels?
- Changelog
- 1.4.1 - 2024-10-15
- 1.4.0 - 2024-10-01
- 1.3.3 - 2024-09-04
- 1.3.2 - 2024-08-30
- 1.3.1 - 2024-07-27
- 1.3.0 - 2024-07-25
- 1.2.2 - 2024-07-04
- 1.2.1 - 2024-06-14
- 1.2.0 - 2024-06-06
- 1.1.1 - 2024-05-24
- 1.1.0 - 2024-05-09
- 1.0.3 - 2024-04-17
- 1.0.2 - 2024-03-22
- 1.0.1 - 2024-03-15
- 1.0.0 - 2024-03-07
- 0.15.1 - 2024-03-05
- 0.15.0 - 2024-03-04
- 0.14.0 - 2024-02-19
- 0.13.1 - 2024-02-22
- 0.13.0 - 2024-02-16
- 0.12.0 - 2024-02-05
- 0.11.0 - 2024-01-23
- 1.0.0-beta.7 - 2024-01-23
- 1.0.0-beta.6 - 2024-01-10
- 1.0.0-beta.5 - 2023-11-22
- 1.0.0-beta.4 - 2023-11-01
- 1.0.0-beta.3 - 2023-10-19
- 1.0.0-beta.2 - 2023-09-01
- 1.0.0-beta.1 - 2023-08-29
- 0.10.1 - 2023-07-25
- 0.10.0 - 2023-07-05
- 0.9.0 - 2023-06-01
- 0.8.2 - 2023-04-21
- 0.8.1 - 2023-04-13
- 0.8.0 - 2023-04-05
- 0.7.2 - 2023-02-15
- 0.7.1 - 2023-02-14
- 0.7.0 - 2023-02-13
- 0.6.3 - 2023-01-31
- 0.6.2 - 2023-01-19
- 0.6.1 - 2022-12-05
- 0.6.0 - 2022-11-28
- 0.5.1 - 2022-11-01
- 0.5.0 - 2022-10-31
- 0.4.3 - 2022-09-20
- 0.4.2 - 2022-09-07
- 0.4.1 - 2022-08-30
- 0.4.0 - 2022-08-09
- 0.3.2 - 2022-07-19
- 0.3.1 - 2022-07-12
- 0.3.0 - 2022-07-08
- 0.2.3 - 2022-06-13
- 0.2.2 - 2022-05-30
- 0.2.1 - 2022-05-11
- 0.2.0 - 2022-05-02
- 0.1.25 - 2022-03-20
- 0.1.24 - 2022-03-03
- 0.1.23 - 2022-02-17
- 0.1.22 - 2022-02-14
- 0.1.21 - 2022-01-19
- 0.1.20 - 2021-11-02
- 0.1.19 - 2021-10-15
- 0.1.18 - 2021-10-08
- 0.1.17 - 2021-09-30
- 0.1.16 - 2021-09-06
- 0.1.15 - 2021-09-03
- 0.1.14 - 2021-08-09
- 0.1.13 - 2021-07-29
- 0.1.12 - 2021-07-29
- 0.1.11 - 2021-07-28
- 0.1.10 - 2021-07-28
- 0.1.9 - 2021-07-21
- 0.1.8 - 2021-07-14
- 0.1.7 - 2021-07-05
- 0.1.6 - 2021-06-14
- 0.1.5 - 2021-06-14
- 0.1.4 - 2021-06-10
- 0.1.3 - 2021-06-09
- 0.1.2 - 2021-06-03
- 0.1.1 - 2021-05-18
- 0.1.0 - 2021-05-17