{"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":"python","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,"search_vec":"'1.12.1':44 'acceler':32 'bug':51 'code':17 'compil':20 'cpu':25 'cuda':64 'current':41 'effici':24 'enabl':29 'featur':55 'fix':52 'framework':6 'frequent':47 'function':22 'gpu':27,31,56 'gpu-acceler':30 'graphic':16,68 'high':12 'high-perform':11 'hpc':57 'includ':49 'jax':66 'jit':19 'kernel':28 'learn':40,62 'machin':39,61 'machine-learn':60 'new':54 'nvidia':8,65 'perform':13 'physic':35,63 'python':5,21 'pytorch':67 'receiv':46 'robot':37,59 'simul':14,36,58 'updat':48 'version':43 'warp':1,2 'workload':33 'write':10","created_at":"2026-04-14T05:08:52.979278+00:00","updated_at":"2026-04-17T00:25:05.812349+00:00","problems":[{"fix":"pip install warp-lang","cause":"The `warp-lang` package, which is imported as `warp`, is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'warp'"},{"fix":"import warp as wp\nmy_python_list = [1.0, 2.0, 3.0]\nmy_wp_array = wp.array(my_python_list, dtype=wp.float32)\n# Pass my_wp_array to the Warp function","cause":"A standard Python list (or similar native Python object) was passed to a Warp function or kernel argument that expects a `wp.array` for GPU-managed memory.","error":"AttributeError: 'list' object has no attribute 'ptr'"},{"fix":"import warp as wp\nimport numpy as np\nmy_numpy_array = np.array([1.0, 2.0, 3.0], dtype=np.float32)\nmy_wp_array = wp.array(my_numpy_array, dtype=wp.float32)\n# Pass my_wp_array to the Warp function","cause":"A NumPy array was passed to a Warp function or kernel argument that explicitly expects a `wp.array`, as Warp does not implicitly convert NumPy arrays for device operations.","error":"TypeError: expected type 'wp.array(dtype=wp.float32)', got 'numpy.ndarray'"},{"fix":"Carefully inspect the `wp.kernel` function for type mismatches, invalid operations, unsupported Python features, or incorrect Warp API usage, ensuring all types are explicit and consistent.","cause":"There is a syntax error, type mismatch, unsupported operation, or invalid GPU code within a `wp.kernel` function, preventing successful compilation by the NVRTC compiler.","error":"wp.errors.KernelCompilationError: NVRTC_ERROR_COMPILATION"},{"fix":"Reduce the size of `wp.array` allocations, free up unused GPU memory (e.g., by deleting arrays no longer needed), or run on a GPU with more VRAM.","cause":"The GPU ran out of available memory, often due to allocating too many large `wp.array` objects or running computationally intensive kernels with large data sets.","error":"RuntimeError: CUDA error: out of memory"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.16.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.nvidia.com/warp-python","github":"https://github.com/NVIDIA/warp","docs":"https://nvidia.github.io/warp","changelog":"https://github.com/NVIDIA/warp/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/warp-lang/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-31","next_check":"2026-07-28","install_tag":null}}