{"id":5826,"library":"warp-lang","title":"Warp","description":"Warp is a Python framework by NVIDIA for writing high-performance simulation and graphics code. It JIT compiles Python functions into efficient CPU or GPU kernels, enabling GPU-accelerated workloads for physics simulation, robotics, and machine learning. Currently at version 1.12.1, it receives frequent updates including both bug fixes and new features.","status":"active","version":"1.12.1","language":"en","source_language":"en","source_url":"https://github.com/NVIDIA/warp","tags":["gpu","hpc","simulation","robotics","machine-learning","physics","cuda","nvidia","jax","pytorch","graphics"],"install":[{"cmd":"pip install warp-lang","lang":"bash","label":"Base install"},{"cmd":"pip install warp-lang[examples]","lang":"bash","label":"Install with example dependencies (e.g., usd-core)"}],"dependencies":[{"reason":"Required for array handling and data initialization.","package":"numpy","optional":false},{"reason":"Optional dependency for running examples and features related to Universal Scene Description (USD). On Linux aarch64, usd-exchange is used instead.","package":"usd-core","optional":true},{"reason":"Required for GPU acceleration on NVIDIA GPUs (Windows/Linux). Minimum driver version varies by CUDA Toolkit version (e.g., ≥ 525 for CUDA 12.x, ≥ 580 for CUDA 13.x).","package":"CUDA Toolkit and Driver","optional":false}],"imports":[{"symbol":"wp","correct":"import warp as wp"}],"quickstart":{"code":"import warp as wp\nimport numpy as np\n\n# Initialize Warp (optional, but good practice)\nwp.init()\n\nnum_particles = 1_000_000\ndt = 0.01\n\n@wp.kernel\ndef gravity_step(pos: wp.array[wp.vec3], vel: wp.array[wp.vec3]):\n    i = wp.tid()\n\n    position = pos[i]\n    dist_sq = wp.length_sq(position) + 0.01 # softened distance\n    acc = -1000.0 / dist_sq * wp.normalize(position) # gravitational pull toward origin\n\n    vel[i] = vel[i] + acc * dt\n    pos[i] = pos[i] + vel[i] * dt\n\nrng = np.random.default_rng(42)\npositions = wp.array(rng.normal(size=(num_particles, 3)), dtype=wp.vec3, device='cuda')\nvelocities = wp.array(rng.normal(size=(num_particles, 3)), dtype=wp.vec3, device='cuda')\n\nfor _ in range(100):\n    wp.launch(kernel=gravity_step, dim=num_particles, inputs=[positions, velocities], device='cuda')\n\nprint(f\"Final position of first particle: {positions.numpy()[0]}\")","lang":"python","description":"This example simulates one million particles under gravitational attraction using a Warp kernel. It demonstrates kernel definition, array allocation on a specific device, and launching a kernel. Note that for GPU execution, a compatible NVIDIA GPU and driver are required, and arrays must be explicitly placed on a 'cuda' device."},"warnings":[{"fix":"Access 64-bit scalar results as Warp types (e.g., `result.value`) or set `wp.config.legacy_scalar_return_types = True` to restore previous behavior.","message":"Starting from Warp v1.12.0, built-in functions and vector/matrix indexing for non-native scalar types (e.g., `wp.float16`, `wp.float64`) now return Warp scalar types instead of Python native types. Native types like `wp.int32` still return Python `int`. This change optimizes performance by avoiding implicit Python object creation.","severity":"breaking","affected_versions":">=1.12.0"},{"fix":"Upgrade to Python 3.10 or newer before Warp 1.13.0. Explicitly construct composite types: `wp.vec3(x, y, z)` instead of just `(x, y, z)`.","message":"Python 3.9 support will be removed in Warp 1.13.0, making Python 3.10 the minimum supported version. A `DeprecationWarning` is currently emitted when using Python 3.9. Also, implicit conversion of scalar values to composite types (vectors, matrices) in kernel launches or struct field assignments is deprecated; explicit constructors (e.g., `wp.vec3(...)`) should be used.","severity":"deprecated","affected_versions":">=1.12.0 (for Python 3.9 deprecation warnings), >=1.11.0 (for implicit conversion deprecation)"},{"fix":"Ensure you have a compatible NVIDIA GPU and an up-to-date CUDA driver matching Warp's requirements. On macOS, be aware that only CPU execution is possible.","message":"GPU acceleration requires an NVIDIA GPU and a CUDA driver. If the installed driver is too old (e.g., < 525 for CUDA 12.x wheels), Warp will issue a `UserWarning` and fall back to CPU-only execution, significantly impacting performance. macOS platforms only support CPU execution; GPU acceleration is not available.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Define kernel arguments with type hints (e.g., `pos: wp.array[wp.vec3]`). Use Warp's built-in functions and structures within kernels. If complex logic is needed, consider offloading to helper `wp.func` functions (which also have typing and subset restrictions) or prepare data outside the kernel.","message":"Warp kernels (`@wp.kernel`) operate on a restricted subset of Python. All function arguments for kernels and `wp.func` functions must be explicitly typed, and kernels cannot return values. Control flow is limited, and arbitrary Python functions cannot be called inside kernels.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `device` arguments for `wp.array` allocation and `wp.launch` are consistent. You can query the default device using `wp.get_device()`.","message":"All Warp arrays used in a kernel launch must reside on the same device as specified for the kernel launch. Attempting to launch a kernel on a 'cpu' device with arrays allocated on 'cuda:0' (or vice-versa) will result in an error.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}