Registry / database / nvshmem4py-cu12

nvshmem4py-cu12

JSON →
library0.3.1pypypiunverified

Python bindings for NVSHMEM (NVIDIA's implementation of OpenSHMEM for GPUs). Version 0.3.0 requires Python >=3.9 and CUDA 12.x. This package enables peer-to-peer GPU communication across NVLink and InfiniBand. Under active development with frequent breaking changes.

pip install nvshmem4py-cu12
INSTALL
IMPORT
SIG · NVSHMEM4PY-CU12
N
nvshmem4py-cu12
databasepythonv0.3.1
Install
11.9s avg
Import
Disk
552MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.1 · 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 11.9s · import 0.000s · 527MB
552MB installed
● package 552MB
Code
Verified usage

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

init
from nvshmem import init
from nvshmem import init

Initialize NVSHMEM, allocate symmetric GPU memory, perform put/get, and barrier.

import os import cupy as cp from nvshmem import init, barrier, my_pe_n, n_pes # Initialize NVSHMEM (must be called after MPI_Init or similar) init() rank = my_pe_n() nranks = n_pes() # Allocate symmetric memory on GPU buf = cp.empty(1024, dtype=cp.float32) # Barrier to synchronize barrier() print(f"Rank {rank}/{nranks} ready.", flush=True) # Example: send data from rank 0 to rank 1 (if nranks > 1) if nranks > 1: if rank == 0: buf[:] = 1.0 nvshmem.putmem(buf.data.ptr, 1, 0, 1024 * 4) # put to rank 1 elif rank == 1: nvshmem.getmem(buf.data.ptr, 0, 0, 1024 * 4) # get from rank 0 barrier() print(f"Rank {rank} finished.", flush=True)
Debug
Known issues
breakingNVSHMEM must be initialized after MPI_Init or equivalent. Calling init() before MPI will cause undefined behavior.
fix
Ensure MPI_Init is called before nvshmem.init() in the same process.
affects: all
breakingThe library name changed from nvshmem4py to nvshmem (or nvshmem4py-cu12 for the CUDA 12 variant). Importing 'nvshmem4py' directly will fail.
fix
Use 'from nvshmem import ...' instead of 'from nvshmem4py import ...'.
affects: >=0.3.0
deprecatedThe function nvshmem.sync_all() is deprecated. Use barrier() for synchronizing all PEs.
fix
Replace sync_all() calls with barrier().
affects: <=0.2.x
gotchaSymmetric memory must be allocated via CuPy or other supported allocator that respects NVSHMEM's memory pool. Using raw cudaMalloc may lead to errors.
fix
Use cp.empty() or cp.zeros() to allocate device arrays for NVSHMEM operations.
affects: all
gotchaNVSHMEM operations require all processes to participate. Missing a barrier between collective operations can cause deadlocks.
fix
Always synchronize with barrier() after each phase of communication.
affects: all
Upgrade
Version history
0.3.1latest on PyPI · released Jun 11, 2026
Audit
Dependencies
cupy-cuda12xrequiredRequired for GPU array operations and device memory management.
mpi4pyoptionalRequired for parallel process initialization (e.g., MPI.COMM_WORLD).
Agent activity
4 hits · last 30 days
node
4
Resources
nvshmem4py-cu12 — pip install nvshmem4py-cu12 · libregistry