core.resharding.nvshmem_copy_service.compat#

Compatibility layer for cuda-core version differences.

cuda-core >=0.5 removed the cuda.core.experimental._memory and cuda.core.experimental._stream private submodules, but nvshmem4py still imports from them. We register sys.modules shims so those imports resolve to the new cuda.core._memory / cuda.core._stream paths.

This module should be imported before any nvshmem.core usage.

Module Contents#

Functions#

_patch_cuda_core_experimental

Register cuda.core._memory / _stream as cuda.core.experimental._memory / _stream.

get_cuda_core_device_class

Return the Device class from whichever cuda-core location is available.

ensure_nvshmem_compat

Apply all compatibility patches. Safe to call multiple times.

API#

core.resharding.nvshmem_copy_service.compat._patch_cuda_core_experimental()#

Register cuda.core._memory / _stream as cuda.core.experimental._memory / _stream.

core.resharding.nvshmem_copy_service.compat.get_cuda_core_device_class()#

Return the Device class from whichever cuda-core location is available.

cuda-core <0.5: cuda.core.experimental.Device cuda-core >=0.5: cuda.core.Device

core.resharding.nvshmem_copy_service.compat.ensure_nvshmem_compat()#

Apply all compatibility patches. Safe to call multiple times.