Movatterモバイル変換


[0]ホーム

URL:


NVIDIACUDA Toolkit Documentation
Search In:
< Previous |Next >
CUDA Runtime API (PDF) - v13.0.2 (older) - Last updated October 9, 2025 -Send Feedback

6.14. Peer Device Memory Access

This section describes the peer device memory access functions of the CUDA runtime application programming interface.

Functions

__host__cudaError_t cudaDeviceCanAccessPeer ( int* canAccessPeer, int device, int peerDevice )
Queries if a device may directly access a peer device's memory.
__host__cudaError_t cudaDeviceDisablePeerAccess ( int peerDevice )
Disables direct access to memory allocations on a peer device.
__host__cudaError_t cudaDeviceEnablePeerAccess ( int peerDevice, unsigned int flags )
Enables direct access to memory allocations on a peer device.

Functions

__host__cudaError_t cudaDeviceCanAccessPeer ( int* canAccessPeer, int device, int peerDevice )
Queries if a device may directly access a peer device's memory.
Parameters
canAccessPeer
- Returned access capability
device
- Device from which allocations onpeerDevice are to be directly accessed.
peerDevice
- Device on which the allocations to be directly accessed bydevice reside.
Description

Returns in*canAccessPeer a value of 1 if devicedevice is capable of directly accessing memory frompeerDevice and 0 otherwise. If direct access ofpeerDevice fromdevice is possible, then access may be enabled by callingcudaDeviceEnablePeerAccess().

Note:

See also:

cudaDeviceEnablePeerAccess,cudaDeviceDisablePeerAccess,cuDeviceCanAccessPeer

__host__cudaError_t cudaDeviceDisablePeerAccess ( int peerDevice )
Disables direct access to memory allocations on a peer device.
Parameters
peerDevice
- Peer device to disable direct access to
Description

ReturnscudaErrorPeerAccessNotEnabled if direct access to memory onpeerDevice has not yet been enabled from the current device.

Note:

See also:

cudaDeviceCanAccessPeer,cudaDeviceEnablePeerAccess,cuCtxDisablePeerAccess

__host__cudaError_t cudaDeviceEnablePeerAccess ( int peerDevice, unsigned int flags )
Enables direct access to memory allocations on a peer device.
Parameters
peerDevice
- Peer device to enable direct access to from the current device
flags
- Reserved for future use and must be set to 0
Description

On success, all allocations frompeerDevice will immediately be accessible by the current device. They will remain accessible until access is explicitly disabled usingcudaDeviceDisablePeerAccess() or either device is reset usingcudaDeviceReset().

Note that access granted by this call is unidirectional and that in order to access memory on the current device frompeerDevice, a separate symmetric call tocudaDeviceEnablePeerAccess() is required.

Note that there are both device-wide and system-wide limitations per system configuration, as noted in the CUDA Programming Guide under the section "Peer-to-Peer Memory Access".

ReturnscudaErrorInvalidDevice ifcudaDeviceCanAccessPeer() indicates that the current device cannot directly access memory frompeerDevice.

ReturnscudaErrorPeerAccessAlreadyEnabled if direct access ofpeerDevice from the current device has already been enabled.

ReturnscudaErrorInvalidValue ifflags is not 0.

Note:

See also:

cudaDeviceCanAccessPeer,cudaDeviceDisablePeerAccess,cuCtxEnablePeerAccess



[8]ページ先頭

©2009-2025 Movatter.jp