Registry / ai-ml / nvidia-cuda-nvrtc-cu11

nvidia-cuda-nvrtc-cu11

JSON →
library11.8.89pypypi✓ verified 23d ago

NVRTC (NVIDIA Runtime Compilation) is a runtime compilation library for CUDA C++ that enables just-in-time (JIT) compilation of CUDA kernels from source code into PTX (Parallel Thread Execution) code. This Python package (`nvidia-cuda-nvrtc-cu11`) provides the native shared libraries for NVRTC specifically for CUDA 11.x environments. It acts as a foundational component for higher-level Python bindings and frameworks that leverage dynamic CUDA kernel generation. The current version is 11.8.89, with its initial release on October 3, 2022, and subsequent wheel metadata updates on August 16, 2024.

pip install nvidia-cuda-nvrtc-cu11
INSTALL
IMPORT
SIG · NVIDIA-CUDA-NVRTC-
N
nvidia-cuda-nvrtc-cu11
ai-mlpythonv11.8.89
Install
2.2s avg
Import
Disk
75MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v11.8.89 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.2s · import 0.000s · 78MB
75MB installed
● package 75MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Program
from nvidia.cuda_nvrtc import Program
from nvidia.cuda_nvrtc import Program

This quickstart demonstrates how to compile CUDA C++ source code into PTX using the `pynvrtc` Python binding, which relies on the native NVRTC libraries provided by `nvidia-cuda-nvrtc-cu11`. The `Program` class handles the compilation process. The resulting PTX code can then be loaded and executed on an NVIDIA GPU using lower-level CUDA driver APIs.

import os from pynvrtc.compiler import Program, ProgramException # Example CUDA C++ kernel source code cuda_source_code = ''' extern "C" __global__ void add(int *a, int *b, int *c, int N) { int idx = blockIdx.x * blockDim.x + threadIdx.x; if (idx < N) { c[idx] = a[idx] + b[idx]; } } ''' try: # Compile the CUDA source code to PTX using the Program API # The nvidia-cuda-nvrtc-cu11 library is implicitly used by pynvrtc program = Program(cuda_source_code, 'add_kernel.cu') ptx_code = program.compile(['-arch=compute_60']) # Adjust arch for your GPU print("PTX code generated successfully. First 200 chars:\n", ptx_code[:200], '...') # In a real application, ptx_code would then be loaded and executed # using a CUDA driver API wrapper (e.g., from `cuda-python` or `pycuda`) # This part requires more setup (context, module, kernel launch) and is omitted for brevity. except ProgramException as e: print(f"Error during NVRTC compilation: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingNVRTC in CUDA 11.0 and later no longer implicitly adds `/usr/include` to the header file search path during compilation.
fix
If your CUDA C++ kernel code includes headers located in `/usr/include`, you must explicitly pass `-I /usr/include` (or the relevant path) to the `nvrtcCompileProgram()` API call or via the options argument in `pynvrtc`.
affects: 11.0.x and later
gotchaThis package (`nvidia-cuda-nvrtc-cu11`) provides only the native NVRTC shared libraries. It does not expose a direct Python API itself. Users must install a separate Python binding library, such as `pynvrtc` or `cuda-python`, to programmatically interact with NVRTC.
fix
Install a Python wrapper library (e.g., `pip install pynvrtc` or `pip install cuda-python`) to access NVRTC functionalities from Python. Attempting to `import nvidia_cuda_nvrtc_cu11` will result in an `ImportError`.
affects: All versions
gotchaMismatch between the installed `nvidia-cuda-nvrtc-cu11` version (or the CUDA version it implies) and the NVIDIA GPU driver or other CUDA-dependent libraries (like PyTorch or CuPy) can lead to `ImportError: libnvrtc.so.<VERSION> not found`.
fix
Ensure your NVIDIA GPU driver is up-to-date and compatible with CUDA 11.x (check `nvidia-smi` output). If using other CUDA-enabled Python libraries, verify their compatibility with CUDA 11.x. Ensure `LD_LIBRARY_PATH` (Linux) or `PATH` (Windows) correctly includes the directory containing `libnvrtc.so` or `nvrtc64_*.dll` if not found automatically.
affects: All versions
gotchaNVRTC requires a compatible NVIDIA GPU and an installed NVIDIA display driver to function. While the NVRTC library itself can run on a system without a GPU, its utility for generating PTX for execution implies a GPU target.
fix
Ensure you have a CUDA-capable NVIDIA GPU and the latest compatible NVIDIA display drivers installed on your system. Verify driver version compatibility with your desired CUDA Toolkit version (e.g., CUDA 11.x).
affects: All versions
Upgrade
Version history
11.8.89latest on PyPI · released Oct 3, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
nvidia-cuda-nvrtc-cu11 — pip install nvidia-cuda-nvrtc-cu11 · libregistry