|
|
Modules
Description
Disconnect CUDA as a producer to EGLStreamKHR.
See also:
cudaEGLStreamProducerConnect, cudaEGLStreamProducerPresentFrame,
cudaEGLStreamProducerReturnFrame, cuEGLStreamProducerDisconnect
__host__cudaError_t
cudaEGLStreamProducerPresentFrame
(cudaEglStreamConnection *conn, cudaEglFrame
eglframe, cudaStream_t *pStream)
Present a CUDA eglFrame to the EGLStream with CUDA as a producer.
Parameters
conn
- Connection on which to present the CUDA array
eglframe
- CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream.
pStream
- CUDA stream on which to present the frame.
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown
Description
The cudaEglFrame is defined as:
typedef struct cudaEglFrame_st {
union {
cudaArray_t
pArray[CUDA_EGL_MAX_PLANES];
struct cudaPitchedPtr
pPitch[CUDA_EGL_MAX_PLANES];
} frame;
cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
unsigned int planeCount;
cudaEglFrameType frameType;
cudaEglColorFormat eglColorFormat;
} cudaEglFrame;
For cudaEglFrame of type cudaEglFrameTypePitch, the application may present sub-region of a
memory allocation. In that case, cudaPitchedPtr::ptr will specify the start address of the sub-region in
the allocation and cudaEglPlaneDesc will specify the dimensions of the sub-region.
See also:
|
268
Modules
cudaEGLStreamProducerConnect, cudaEGLStreamProducerDisconnect,
cudaEGLStreamProducerReturnFrame, cuEGLStreamProducerPresentFrame
__host__cudaError_t
cudaEGLStreamProducerReturnFrame
(cudaEglStreamConnection *conn, cudaEglFrame
*eglframe, cudaStream_t *pStream)
Return the CUDA eglFrame to the EGLStream last released by the consumer.
Parameters
conn
- Connection on which to present the CUDA array
eglframe
- CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream.
pStream
- CUDA stream on which to return the frame.
Returns
cudaSuccess, cudaErrorLaunchTimeout, cudaErrorInvalidValue, cudaErrorUnknown
Description
This API can potentially return cudaErrorLaunchTimeout if the consumer has not returned a frame to
EGL stream. If timeout is returned the application can retry.
See also:
cudaEGLStreamProducerConnect, cudaEGLStreamProducerDisconnect,
cudaEGLStreamProducerPresentFrame, cuEGLStreamProducerReturnFrame
__host__cudaError_t cudaEventCreateFromEGLSync
(cudaEvent_t *phEvent, EGLSyncKHR eglSync, unsigned
int flags)
Creates an event from EGLSync object.
Parameters
phEvent
- Returns newly created event
|
269
Modules
eglSync
- Opaque handle to EGLSync object
flags
- Event creation flags
Returns
cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorLaunchFailure,
cudaErrorMemoryAllocation
Description
Creates an event *phEvent from an EGLSyncKHR eglSync with the flages specified via flags. Valid
flags include:
‣ cudaEventDefault: Default event creation flag.
‣ cudaEventBlockingSync: Specifies that the created event should use blocking synchronization. A
CPU thread that uses cudaEventSynchronize() to wait on an event created with this flag will block
until the event has actually been completed.
cudaEventRecord and TimingData are not supported for events created from EGLSync.
The EGLSyncKHR is an opaque handle to an EGL sync object. typedef void* EGLSyncKHR
See also:
cudaEventQuery, cudaEventSynchronize, cudaEventDestroy
__host__cudaError_t cudaGraphicsEGLRegisterImage
(cudaGraphicsResource **pCudaResource,
EGLImageKHR image, unsigned int flags)
Registers an EGL image.
Parameters
pCudaResource
- Pointer to the returned object handle
image
- An EGLImageKHR image which can be used to create target resource.
flags
- Map flags
Returns
cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorInvalidValue, cudaErrorUnknown
|
270
Modules
Description
Registers the EGLImageKHR specified by image for access by CUDA. A handle to the registered
object is returned as pCudaResource. Additional Mapping/Unmapping is not required for the
registered resource and cudaGraphicsResourceGetMappedEglFrame can be directly called on the
pCudaResource.
The application will be responsible for synchronizing access to shared objects. The application must
ensure that any pending operation which access the objects have completed before passing control to
CUDA. This may be accomplished by issuing and waiting for glFinish command on all GLcontexts
(for OpenGL and likewise for other APIs). The application will be also responsible for ensuring that
any pending operation on the registered CUDA resource has completed prior to executing subsequent
commands in other APIs accesing the same memory objects. This can be accomplished by calling
cuCtxSynchronize or cuEventSynchronize (preferably).
The surface's intended usage is specified using flags, as follows:
‣ cudaGraphicsRegisterFlagsNone: Specifies no hints about how this resource will be used. It is
therefore assumed that this resource will be read from and written to by CUDA. This is the default
value.
‣ cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA will not write to this resource.
‣ cudaGraphicsRegisterFlagsWriteDiscard: Specifies that CUDA will not read from this resource
and will write over the entire contents of the resource, so none of the data previously stored in the
resource will be preserved.
The EGLImageKHR is an object which can be used to create EGLImage target resource. It is defined
as a void pointer. typedef void* EGLImageKHR
See also:
cudaGraphicsUnregisterResource, cudaGraphicsResourceGetMappedEglFrame,
cuGraphicsEGLRegisterImage
__host__cudaError_t
cudaGraphicsResourceGetMappedEglFrame
(cudaEglFrame *eglFrame, cudaGraphicsResource_t
resource, unsigned int index, unsigned int mipLevel)
Get an eglFrame through which to access a registered EGL graphics resource.
Parameters
eglFrame
- Returned eglFrame.
|
271
Modules
resource
- Registered resource to access.
index
- Index for cubemap surfaces.
mipLevel
- Mipmap level for the subresource to access.
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorUnknown
Description
Returns in *eglFrame an eglFrame pointer through which the registered graphics resource
resource may be accessed. This API can only be called for EGL graphics resources.
The cudaEglFrame is defined as
typedef struct cudaEglFrame_st {
union {
cudaArray_t
pArray[CUDA_EGL_MAX_PLANES];
struct cudaPitchedPtr
pPitch[CUDA_EGL_MAX_PLANES];
} frame;
cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
unsigned int planeCount;
cudaEglFrameType frameType;
cudaEglColorFormat eglColorFormat;
} cudaEglFrame;
Note:
Note that in case of multiplanar *eglFrame, pitch of only first plane (unsigned int
cudaEglPlaneDesc::pitch) is to be considered by the application.
See also:
cudaGraphicsSubResourceGetMappedArray, cudaGraphicsResourceGetMappedPointer,
cuGraphicsResourceGetMappedEglFrame
6.26. Graphics Interoperability
This section describes the graphics interoperability functions of the CUDA runtime application
programming interface.
|
272
Modules
__host__cudaError_t cudaGraphicsMapResources (int
count, cudaGraphicsResource_t *resources, cudaStream_t
stream)
Map graphics resources for access by CUDA.
Parameters
count
- Number of resources to map
resources
- Resources to map for CUDA
stream
- Stream for synchronization
Returns
cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Maps the count graphics resources in resources for access by CUDA.
The resources in resources may be accessed by CUDA until they are unmapped. The graphics API
from which resources were registered should not access any resources while they are mapped by
CUDA. If an application does so, the results are undefined.
This function provides the synchronization guarantee that any graphics calls issued before
cudaGraphicsMapResources() will complete before any subsequent CUDA work issued in stream
begins.
If resources contains any duplicate entries then cudaErrorInvalidResourceHandle is returned. If any
of resources are presently mapped for access by CUDA then cudaErrorUnknown is returned.
Note:
‣ This function uses standard default stream semantics.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
|
273
Modules
cudaGraphicsResourceGetMappedPointer, cudaGraphicsSubResourceGetMappedArray,
cudaGraphicsUnmapResources, cuGraphicsMapResources
__host__cudaError_t
cudaGraphicsResourceGetMappedMipmappedArray
(cudaMipmappedArray_t *mipmappedArray,
cudaGraphicsResource_t resource)
Get a mipmapped array through which to access a mapped graphics resource.
Parameters
mipmappedArray
- Returned mipmapped array through which resource may be accessed
resource
- Mapped resource to access
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Returns in *mipmappedArray a mipmapped array through which the mapped graphics resource
resource may be accessed. The value set in mipmappedArray may change every time that
resource is mapped.
If resource is not a texture then it cannot be accessed via an array and cudaErrorUnknown is
returned. If resource is not mapped then cudaErrorUnknown is returned.
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsResourceGetMappedPointer, cuGraphicsResourceGetMappedMipmappedArray
|
274
Modules
__host__cudaError_t
cudaGraphicsResourceGetMappedPointer (void **devPtr,
size_t *size, cudaGraphicsResource_t resource)
Get an device pointer through which to access a mapped graphics resource.
Parameters
devPtr
- Returned pointer through which resource may be accessed
size
- Returned size of the buffer accessible starting at *devPtr
resource
- Mapped resource to access
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Returns in *devPtr a pointer through which the mapped graphics resource resource may be
accessed. Returns in *size the size of the memory in bytes which may be accessed from that pointer.
The value set in devPtr may change every time that resource is mapped.
If resource is not a buffer then it cannot be accessed via a pointer and cudaErrorUnknown is
returned. If resource is not mapped then cudaErrorUnknown is returned. *
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsMapResources, cudaGraphicsSubResourceGetMappedArray,
cuGraphicsResourceGetMappedPointer
|
275
Modules
__host__cudaError_t cudaGraphicsResourceSetMapFlags
(cudaGraphicsResource_t resource, unsigned int flags)
Set usage flags for mapping a graphics resource.
Parameters
resource
- Registered resource to set flags for
flags
- Parameters for resource mapping
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown,
Description
Set flags for mapping the graphics resource resource.
Changes to flags will take effect the next time resource is mapped. The flags argument may be
any of the following:
‣ cudaGraphicsMapFlagsNone: Specifies no hints about how resource will be used. It is therefore
assumed that CUDA may read from or write to resource.
‣ cudaGraphicsMapFlagsReadOnly: Specifies that CUDA will not write to resource.
‣ cudaGraphicsMapFlagsWriteDiscard: Specifies CUDA will not read from resource and will
write over the entire contents of resource, so none of the data previously stored in resource
will be preserved.
If resource is presently mapped for access by CUDA then cudaErrorUnknown is returned. If
flags is not one of the above values then cudaErrorInvalidValue is returned.
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsMapResources, cuGraphicsResourceSetMapFlags
|
276
Modules
__host__cudaError_t
cudaGraphicsSubResourceGetMappedArray (cudaArray_t
*array, cudaGraphicsResource_t resource, unsigned int
arrayIndex, unsigned int mipLevel)
Get an array through which to access a subresource of a mapped graphics resource.
Parameters
array
- Returned array through which a subresource of resource may be accessed
resource
- Mapped resource to access
arrayIndex
- Array index for array textures or cubemap face index as defined by cudaGraphicsCubeFace for
cubemap textures for the subresource to access
mipLevel
- Mipmap level for the subresource to access
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Returns in *array an array through which the subresource of the mapped graphics resource
resource which corresponds to array index arrayIndex and mipmap level mipLevel may be
accessed. The value set in array may change every time that resource is mapped.
If resource is not a texture then it cannot be accessed via an array and cudaErrorUnknown is
returned. If arrayIndex is not a valid array index for resource then cudaErrorInvalidValue is
returned. If mipLevel is not a valid mipmap level for resource then cudaErrorInvalidValue is
returned. If resource is not mapped then cudaErrorUnknown is returned.
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
|
277
Modules
cudaGraphicsResourceGetMappedPointer, cuGraphicsSubResourceGetMappedArray
__host__cudaError_t cudaGraphicsUnmapResources (int
count, cudaGraphicsResource_t *resources, cudaStream_t
stream)
Unmap graphics resources.
Parameters
count
- Number of resources to unmap
resources
- Resources to unmap
stream
- Stream for synchronization
Returns
cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Unmaps the count graphics resources in resources.
Once unmapped, the resources in resources may not be accessed by CUDA until they are mapped
again.
This function provides the synchronization guarantee that any CUDA work issued in stream before
cudaGraphicsUnmapResources() will complete before any subsequently issued graphics work begins.
If resources contains any duplicate entries then cudaErrorInvalidResourceHandle is returned. If any
of resources are not presently mapped for access by CUDA then cudaErrorUnknown is returned.
Note:
‣ This function uses standard default stream semantics.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphicsMapResources, cuGraphicsUnmapResources
|
278
Modules
__host__cudaError_t cudaGraphicsUnregisterResource
(cudaGraphicsResource_t resource)
Unregisters a graphics resource for access by CUDA.
Parameters
resource
- Resource to unregister
Returns
cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown
Description
Unregisters the graphics resource resource so it is not accessible by CUDA unless registered again.
If resource is invalid then cudaErrorInvalidResourceHandle is returned.
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaGraphicsD3D9RegisterResource, cudaGraphicsD3D10RegisterResource,
cudaGraphicsD3D11RegisterResource, cudaGraphicsGLRegisterBuffer,
cudaGraphicsGLRegisterImage, cuGraphicsUnregisterResource
6.27. Texture Object Management
This section describes the low level texture object management functions of the CUDA runtime
application programming interface. The texture object API is only supported on devices of compute
capability 3.0 or higher.
|
279
Modules
__host__cudaCreateChannelDesc (int x, int y, int z, int w,
cudaChannelFormatKind f)
Returns a channel descriptor using the specified format.
Parameters
x
- X component
y
- Y component
z
- Z component
w
- W component
f
- Channel format
Returns
Channel descriptor with format f
Description
Returns a channel descriptor with format f and number of bits of each component x, y, z, and w. The
cudaChannelFormatDesc is defined as:
struct cudaChannelFormatDesc {
int x, y, z, w;
enum cudaChannelFormatKind
f;
};
where cudaChannelFormatKind is one of cudaChannelFormatKindSigned,
cudaChannelFormatKindUnsigned, or cudaChannelFormatKindFloat.
See also:
cudaCreateChannelDesc ( C++ API), cudaGetChannelDesc, cudaCreateTextureObject,
cudaCreateSurfaceObject
|
280
Modules
__host__cudaError_t cudaCreateTextureObject
(cudaTextureObject_t *pTexObject, const
cudaResourceDesc *pResDesc, const cudaTextureDesc
*pTexDesc, const cudaResourceViewDesc
*pResViewDesc)
Creates a texture object.
Parameters
pTexObject
- Texture object to create
pResDesc
- Resource descriptor
pTexDesc
- Texture descriptor
pResViewDesc
- Resource view descriptor
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a texture object and returns it in pTexObject. pResDesc describes the data to texture from.
pTexDesc describes how the data should be sampled. pResViewDesc is an optional argument that
specifies an alternate format for the data described by pResDesc, and also describes the subresource
region to restrict access to when texturing. pResViewDesc can only be specified if the type of
resource is a CUDA array or a CUDA mipmapped array not in a block compressed format.
Texture objects are only supported on devices of compute capability 3.0 or higher. Additionally, a
texture object is an opaque value, and, as such, should only be accessed through CUDA API calls.
The cudaResourceDesc structure is defined as:
struct cudaResourceDesc {
enum cudaResourceType
resType;
union {
struct {
cudaArray_t
array;
} array;
struct {
cudaMipmappedArray_t
mipmap;
} mipmap;
struct {
|
281
Modules
void *devPtr;
struct cudaChannelFormatDesc
desc;
size_t sizeInBytes;
} linear;
struct {
void *devPtr;
struct cudaChannelFormatDesc
desc;
size_t width;
size_t height;
size_t pitchInBytes;
} pitch2D;
} res;
};
where:
‣ cudaResourceDesc::resType specifies the type of resource to texture from. CUresourceType is
defined as:
enum cudaResourceType {
cudaResourceTypeArray
= 0x00,
cudaResourceTypeMipmappedArray = 0x01,
cudaResourceTypeLinear
= 0x02,
cudaResourceTypePitch2D
= 0x03
};
If cudaResourceDesc::resType is set to cudaResourceTypeArray, cudaResourceDesc::res::array::array
must be set to a valid CUDA array handle.
If cudaResourceDesc::resType is set to cudaResourceTypeMipmappedArray,
cudaResourceDesc::res::mipmap::mipmap must be set to a valid CUDA mipmapped array handle and
cudaTextureDesc::normalizedCoords must be set to true.
If cudaResourceDesc::resType is set to cudaResourceTypeLinear,
cudaResourceDesc::res::linear::devPtr must be set to a valid device pointer, that is aligned to
cudaDeviceProp::textureAlignment. cudaResourceDesc::res::linear::desc describes the format and
the number of components per array element. cudaResourceDesc::res::linear::sizeInBytes specifies
the size of the array in bytes. The total number of elements in the linear address range cannot exceed
cudaDeviceProp::maxTexture1DLinear. The number of elements is computed as (sizeInBytes /
sizeof(desc)).
If cudaResourceDesc::resType is set to cudaResourceTypePitch2D,
cudaResourceDesc::res::pitch2D::devPtr must be set to a valid device pointer, that is
aligned to cudaDeviceProp::textureAlignment. cudaResourceDesc::res::pitch2D::desc
describes the format and the number of components per array element.
cudaResourceDesc::res::pitch2D::width and cudaResourceDesc::res::pitch2D::height
specify the width and height of the array in elements, and cannot exceed
cudaDeviceProp::maxTexture2DLinear[0] and cudaDeviceProp::maxTexture2DLinear[1]
respectively. cudaResourceDesc::res::pitch2D::pitchInBytes specifies the pitch between two rows
in bytes and has to be aligned to cudaDeviceProp::texturePitchAlignment. Pitch cannot exceed
cudaDeviceProp::maxTexture2DLinear[2].
|
282
Modules
The cudaTextureDesc struct is defined as
struct cudaTextureDesc {
enum cudaTextureAddressMode
addressMode[3];
enum cudaTextureFilterMode
filterMode;
enum cudaTextureReadMode
readMode;
int
sRGB;
float
borderColor[4];
int
normalizedCoords;
unsigned int
maxAnisotropy;
enum cudaTextureFilterMode
mipmapFilterMode;
float
mipmapLevelBias;
float
minMipmapLevelClamp;
float
maxMipmapLevelClamp;
int
disableTrilinearOptimization;
int
seamlessCubemap;
};
where
‣
cudaTextureDesc::addressMode specifies the addressing mode for each dimension of the texture
data. cudaTextureAddressMode is defined as:
enum cudaTextureAddressMode {
cudaAddressModeWrap
= 0,
cudaAddressModeClamp
= 1,
cudaAddressModeMirror = 2,
cudaAddressModeBorder = 3
};
This is ignored if cudaResourceDesc::resType is cudaResourceTypeLinear. Also,
if cudaTextureDesc::normalizedCoords is set to zero, cudaAddressModeWrap and
cudaAddressModeMirror won't be supported and will be switched to cudaAddressModeClamp.
‣
cudaTextureDesc::filterMode specifies the filtering mode to be used when fetching from the
texture. cudaTextureFilterMode is defined as:
enum cudaTextureFilterMode {
cudaFilterModePoint
= 0,
cudaFilterModeLinear = 1
};
This is ignored if cudaResourceDesc::resType is cudaResourceTypeLinear.
‣
cudaTextureDesc::readMode specifies whether integer data should be converted to floating point or
not. cudaTextureReadMode is defined as:
enum cudaTextureReadMode {
cudaReadModeElementType
= 0,
cudaReadModeNormalizedFloat = 1
};
Note that this applies only to 8-bit and 16-bit integer formats. 32-bit integer format would
not be promoted, regardless of whether or not this cudaTextureDesc::readMode is set
cudaReadModeNormalizedFloat is specified.
‣
cudaTextureDesc::sRGB specifies whether sRGB to linear conversion should be performed during
texture fetch.
‣
cudaTextureDesc::borderColor specifies the float values of color. where:
cudaTextureDesc::borderColor[0] contains value of 'R', cudaTextureDesc::borderColor[1]
|
283
Modules
contains value of 'G', cudaTextureDesc::borderColor[2] contains value of 'B',
cudaTextureDesc::borderColor[3] contains value of 'A' Note that application using integer border
color values will need to <reinterpret_cast> these values to float. The values are set only when the
addressing mode specified by cudaTextureDesc::addressMode is cudaAddressModeBorder.
‣ cudaTextureDesc::normalizedCoords specifies whether the texture coordinates will be normalized
or not.
‣ cudaTextureDesc::maxAnisotropy specifies the maximum anistropy ratio to be used when doing
anisotropic filtering. This value will be clamped to the range [1,16].
‣ cudaTextureDesc::mipmapFilterMode specifies the filter mode when the calculated mipmap level
lies between two defined mipmap levels.
‣ cudaTextureDesc::mipmapLevelBias specifies the offset to be applied to the calculated mipmap
level.
‣ cudaTextureDesc::minMipmapLevelClamp specifies the lower end of the mipmap level range to
clamp access to.
‣ cudaTextureDesc::maxMipmapLevelClamp specifies the upper end of the mipmap level range to
clamp access to.
‣ cudaTextureDesc::disableTrilinearOptimization specifies whether the trilinear filtering
optimizations will be disabled.
‣ cudaTextureDesc::seamlessCubemap specifies whether seamless cube map filtering is enabled.
This flag can only be specified if the underlying resource is a CUDA array or a CUDA mipmapped
array that was created with the flag cudaArrayCubemap. When seamless cube map filtering
is enabled, texture address modes specified by cudaTextureDesc::addressMode are ignored.
Instead, if the cudaTextureDesc::filterMode is set to cudaFilterModePoint the address mode
cudaAddressModeClamp will be applied for all dimensions. If the cudaTextureDesc::filterMode is
set to cudaFilterModeLinear seamless cube map filtering will be performed when sampling along
the cube face borders.
The cudaResourceViewDesc struct is defined as
struct cudaResourceViewDesc {
enum cudaResourceViewFormat
format;
size_t
width;
size_t
height;
size_t
depth;
unsigned int
firstMipmapLevel;
unsigned int
lastMipmapLevel;
unsigned int
firstLayer;
unsigned int
lastLayer;
};
where:
‣ cudaResourceViewDesc::format specifies how the data contained in the CUDA array or CUDA
mipmapped array should be interpreted. Note that this can incur a change in size of the texture
data. If the resource view format is a block compressed format, then the underlying CUDA array
|
284
Modules
or CUDA mipmapped array has to have a 32-bit unsigned integer format with 2 or 4 channels,
depending on the block compressed format. For ex., BC1 and BC4 require the underlying CUDA
array to have a 32-bit unsigned int with 2 channels. The other BC formats require the underlying
resource to have the same 32-bit unsigned int format but with 4 channels.
‣ cudaResourceViewDesc::width specifies the new width of the texture data. If the resource view
format is a block compressed format, this value has to be 4 times the original width of the resource.
For non block compressed formats, this value has to be equal to that of the original resource.
‣ cudaResourceViewDesc::height specifies the new height of the texture data. If the resource
view format is a block compressed format, this value has to be 4 times the original height of the
resource. For non block compressed formats, this value has to be equal to that of the original
resource.
‣ cudaResourceViewDesc::depth specifies the new depth of the texture data. This value has to be
equal to that of the original resource.
‣ cudaResourceViewDesc::firstMipmapLevel specifies the most detailed mipmap level. This
will be the new mipmap level zero. For non-mipmapped resources, this value has to be
zero.cudaTextureDesc::minMipmapLevelClamp and cudaTextureDesc::maxMipmapLevelClamp
will be relative to this value. For ex., if the firstMipmapLevel is set to 2, and a
minMipmapLevelClamp of 1.2 is specified, then the actual minimum mipmap level clamp will be
3.2.
‣ cudaResourceViewDesc::lastMipmapLevel specifies the least detailed mipmap level. For non-
mipmapped resources, this value has to be zero.
‣ cudaResourceViewDesc::firstLayer specifies the first layer index for layered textures. This will be
the new layer zero. For non-layered resources, this value has to be zero.
‣ cudaResourceViewDesc::lastLayer specifies the last layer index for layered textures. For non-
layered resources, this value has to be zero.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaDestroyTextureObject, cuTexObjectCreate
|
285
Modules
__host__cudaError_t cudaDestroyTextureObject
(cudaTextureObject_t texObject)
Destroys a texture object.
Parameters
texObject
- Texture object to destroy
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Destroys the texture object specified by texObject.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaCreateTextureObject, cuTexObjectDestroy
__host__cudaError_t cudaGetChannelDesc
(cudaChannelFormatDesc *desc, cudaArray_const_t array)
Get the channel descriptor of an array.
Parameters
desc
- Channel format
array
- Memory array on device
Returns
cudaSuccess, cudaErrorInvalidValue
|
286
Modules
Description
Returns in *desc the channel descriptor of the CUDA array array.
Note:
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaCreateChannelDesc ( C API), cudaCreateTextureObject, cudaCreateSurfaceObject
__host__cudaError_t cudaGetTextureObjectResourceDesc
(cudaResourceDesc *pResDesc, cudaTextureObject_t
texObject)
Returns a texture object's resource descriptor.
Parameters
pResDesc
- Resource descriptor
texObject
- Texture object
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the resource descriptor for the texture object specified by texObject.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
|
287
Modules
See also:
cudaCreateTextureObject, cuTexObjectGetResourceDesc
__host__cudaError_t
cudaGetTextureObjectResourceViewDesc
(cudaResourceViewDesc *pResViewDesc,
cudaTextureObject_t texObject)
Returns a texture object's resource view descriptor.
Parameters
pResViewDesc
- Resource view descriptor
texObject
- Texture object
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the resource view descriptor for the texture object specified by texObject. If no resource
view was specified, cudaErrorInvalidValue is returned.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaCreateTextureObject, cuTexObjectGetResourceViewDesc
|
288
Modules
__host__cudaError_t cudaGetTextureObjectTextureDesc
(cudaTextureDesc *pTexDesc, cudaTextureObject_t
texObject)
Returns a texture object's texture descriptor.
Parameters
pTexDesc
- Texture descriptor
texObject
- Texture object
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the texture descriptor for the texture object specified by texObject.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaCreateTextureObject, cuTexObjectGetTextureDesc
6.28. Surface Object Management
This section describes the low level texture object management functions of the CUDA runtime
application programming interface. The surface object API is only supported on devices of compute
capability 3.0 or higher.
|
289
Modules
__host__cudaError_t cudaCreateSurfaceObject
(cudaSurfaceObject_t *pSurfObject, const
cudaResourceDesc *pResDesc)
Creates a surface object.
Parameters
pSurfObject
- Surface object to create
pResDesc
- Resource descriptor
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidChannelDescriptor,
cudaErrorInvalidResourceHandle
Description
Creates a surface object and returns it in pSurfObject. pResDesc describes the data to
perform surface load/stores on. cudaResourceDesc::resType must be cudaResourceTypeArray and
cudaResourceDesc::res::array::array must be set to a valid CUDA array handle.
Surface objects are only supported on devices of compute capability 3.0 or higher. Additionally, a
surface object is an opaque value, and, as such, should only be accessed through CUDA API calls.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaDestroySurfaceObject, cuSurfObjectCreate
|
290
Modules
__host__cudaError_t cudaDestroySurfaceObject
(cudaSurfaceObject_t surfObject)
Destroys a surface object.
Parameters
surfObject
- Surface object to destroy
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Destroys the surface object specified by surfObject.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaCreateSurfaceObject, cuSurfObjectDestroy
__host__cudaError_t cudaGetSurfaceObjectResourceDesc
(cudaResourceDesc *pResDesc, cudaSurfaceObject_t
surfObject)
Returns a surface object's resource descriptor Returns the resource descriptor for the surface object
specified by surfObject.
Parameters
pResDesc
- Resource descriptor
surfObject
- Surface object
|
291
Modules
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaCreateSurfaceObject, cuSurfObjectGetResourceDesc
6.29. Version Management
__host__cudaError_t cudaDriverGetVersion (int
*driverVersion)
Returns the latest version of CUDA supported by the driver.
Parameters
driverVersion
- Returns the CUDA driver version.
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns in *driverVersion the latest version of CUDA supported by the driver. The version is
returned as (1000 major + 10 minor). For example, CUDA 9.2 would be represented by 9020. If no
driver is installed, then 0 is returned as the driver version.
This function automatically returns cudaErrorInvalidValue if driverVersion is NULL.
Note:
|
292
Modules
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaRuntimeGetVersion, cuDriverGetVersion
__host____
device__cudaError_t cudaRuntimeGetVersion
(int *runtimeVersion)
Returns the CUDA Runtime version.
Parameters
runtimeVersion
- Returns the CUDA Runtime version.
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns in *runtimeVersion the version number of the current CUDA Runtime instance. The
version is returned as (1000 major + 10 minor). For example, CUDA 9.2 would be represented by
9020.
As of CUDA 12.0, this function no longer initializes CUDA. The purpose of this API is solely to return
a compile-time constant stating the CUDA Toolkit version in the above format.
This function automatically returns cudaErrorInvalidValue if the runtimeVersion argument is
NULL.
Note:
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaDriverGetVersion, cuDriverGetVersion
|
293
Modules
6.30. Graph Management
This section describes the graph management functions of CUDA runtime application programming
interface.
__host__cudaError_t cudaDeviceGetGraphMemAttribute
(int device, cudaGraphMemAttributeType attr, void *value)
Query asynchronous allocation attributes related to graphs.
Parameters
device
- Specifies the scope of the query
attr
- attribute to get
value
- retrieved value
Returns
cudaSuccess, cudaErrorInvalidDevice
Description
Valid attributes are:
‣ cudaGraphMemAttrUsedMemCurrent: Amount of memory, in bytes, currently associated with
graphs
‣ cudaGraphMemAttrUsedMemHigh: High watermark of memory, in bytes, associated with graphs
since the last time it was reset. High watermark can only be reset to zero.
‣ cudaGraphMemAttrReservedMemCurrent: Amount of memory, in bytes, currently allocated for
use by the CUDA graphs asynchronous allocator.
‣ cudaGraphMemAttrReservedMemHigh: High watermark of memory, in bytes, currently allocated
for use by the CUDA graphs asynchronous allocator.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
294
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaDeviceSetGraphMemAttribute, cudaGraphAddMemAllocNode, cudaGraphAddMemFreeNode,
cudaDeviceGraphMemTrim, cudaMallocAsync, cudaFreeAsync
__host__cudaError_t cudaDeviceGraphMemTrim (int
device)
Free unused memory that was cached on the specified device for use with graphs back to the OS.
Parameters
device
- The device for which cached memory should be freed.
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Blocks which are not in use by a graph that is either currently executing or scheduled to execute are
freed back to the operating system.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddMemAllocNode, cudaGraphAddMemFreeNode, cudaDeviceGetGraphMemAttribute,
cudaDeviceSetGraphMemAttribute, cudaMallocAsync, cudaFreeAsync
|
295
Modules
__host__cudaError_t cudaDeviceSetGraphMemAttribute
(int device, cudaGraphMemAttributeType attr, void *value)
Set asynchronous allocation attributes related to graphs.
Parameters
device
- Specifies the scope of the query
attr
- attribute to get
value
- pointer to value to set
Returns
cudaSuccess, cudaErrorInvalidDevice
Description
Valid attributes are:
‣ cudaGraphMemAttrUsedMemHigh: High watermark of memory, in bytes, associated with graphs
since the last time it was reset. High watermark can only be reset to zero.
‣ cudaGraphMemAttrReservedMemHigh: High watermark of memory, in bytes, currently allocated
for use by the CUDA graphs asynchronous allocator.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaDeviceGetGraphMemAttribute, cudaGraphAddMemAllocNode, cudaGraphAddMemFreeNode,
cudaDeviceGraphMemTrim, cudaMallocAsync, cudaFreeAsync
|
296
Modules
__device__cudaGraphExec_t cudaGetCurrentGraphExec
(void)
Get the currently running device graph id.
Returns
Returns the current device graph id, 0 if the call is outside of a device graph.
Description
Get the currently running device graph id.
See also:
cudaGraphLaunch
__host__cudaError_t cudaGraphAddChildGraphNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, cudaGraph_t childGraph)
Creates a child graph node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
childGraph
- The graph to clone into this node
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new node which executes an embedded graph, and adds it to graph with
numDependencies dependencies specified via pDependencies. It is possible for
|
297
Modules
numDependencies to be 0, in which case the node will be placed at the root of the graph.
pDependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
If childGraph contains allocation nodes, free nodes, or conditional nodes, this call will return an
error.
The node executes an embedded child graph. The child graph is cloned in this call.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaGraphChildGraphNodeGetGraph, cudaGraphCreate,
cudaGraphDestroyNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddHostNode, cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode,
cudaGraphClone
__host__cudaError_t cudaGraphAddDependencies
(cudaGraph_t graph, const cudaGraphNode_t *from, const
cudaGraphNode_t *to, size_t numDependencies)
Adds dependency edges to a graph.
Parameters
graph
- Graph to which dependencies are added
from
- Array of nodes that provide the dependencies
to
- Array of dependent nodes
numDependencies
- Number of dependencies to be added
Returns
cudaSuccess, cudaErrorInvalidValue
|
298
Modules
Description
The number of dependencies to be added is defined by numDependencies Elements in pFrom
and pTo at corresponding indices define a dependency. Each node in pFrom and pTo must belong to
graph.
If numDependencies is 0, elements in pFrom and pTo will be ignored. Specifying an existing
dependency will return an error.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphRemoveDependencies, cudaGraphGetEdges, cudaGraphNodeGetDependencies,
cudaGraphNodeGetDependentNodes
__host__cudaError_t cudaGraphAddDependencies_v2
(cudaGraph_t graph, const cudaGraphNode_t *from,
const cudaGraphNode_t *to, const cudaGraphEdgeData
*edgeData, size_t numDependencies)
Adds dependency edges to a graph. (12.3+).
Parameters
graph
- Graph to which dependencies are added
from
- Array of nodes that provide the dependencies
to
- Array of dependent nodes
edgeData
- Optional array of edge data. If NULL, default (zeroed) edge data is assumed.
numDependencies
- Number of dependencies to be added
|
299
Modules
Returns
cudaSuccess, cudaErrorInvalidValue
Description
The number of dependencies to be added is defined by numDependencies Elements in pFrom
and pTo at corresponding indices define a dependency. Each node in pFrom and pTo must belong to
graph.
If numDependencies is 0, elements in pFrom and pTo will be ignored. Specifying an existing
dependency will return an error.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphRemoveDependencies, cudaGraphGetEdges, cudaGraphNodeGetDependencies,
cudaGraphNodeGetDependentNodes
__host__cudaError_t cudaGraphAddEmptyNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies)
Creates an empty node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
|
300
Modules
numDependencies
- Number of dependencies
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new node which performs no operation, and adds it to graph with numDependencies
dependencies specified via pDependencies. It is possible for numDependencies to be 0, in
which case the node will be placed at the root of the graph. pDependencies may not have any
duplicate entries. A handle to the new node will be returned in pGraphNode.
An empty node performs no operation during execution, but can be used for transitive ordering. For
example, a phased execution graph with 2 groups of n nodes with a barrier between them can be
represented using an empty node and 2*n dependency edges, rather than no empty node and n^2
dependency edges.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaGraphCreate, cudaGraphDestroyNode, cudaGraphAddChildGraphNode,
cudaGraphAddKernelNode, cudaGraphAddHostNode, cudaGraphAddMemcpyNode,
cudaGraphAddMemsetNode
|
301
Modules
__host__cudaError_t cudaGraphAddEventRecordNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, cudaEvent_t event)
Creates an event record node and adds it to a graph.
Parameters
pGraphNode
graph
pDependencies
numDependencies
- Number of dependencies
event
- Event for the node
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new event record node and adds it to hGraph with numDependencies dependencies
specified via dependencies and event specified in event. It is possible for numDependencies
to be 0, in which case the node will be placed at the root of the graph. dependencies may not have
any duplicate entries. A handle to the new node will be returned in phGraphNode.
Each launch of the graph will record event to capture execution of the node's dependencies.
These nodes may not be used in loops or conditionals.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
|
302
Modules
cudaGraphAddNode, cudaGraphAddEventWaitNode, cudaEventRecordWithFlags,
cudaStreamWaitEvent, cudaGraphCreate, cudaGraphDestroyNode, cudaGraphAddChildGraphNode,
cudaGraphAddEmptyNode, cudaGraphAddKernelNode, cudaGraphAddMemcpyNode,
cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddEventWaitNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, cudaEvent_t event)
Creates an event wait node and adds it to a graph.
Parameters
pGraphNode
graph
pDependencies
numDependencies
- Number of dependencies
event
- Event for the node
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new event wait node and adds it to hGraph with numDependencies dependencies
specified via dependencies and event specified in event. It is possible for numDependencies
to be 0, in which case the node will be placed at the root of the graph. dependencies may not have
any duplicate entries. A handle to the new node will be returned in phGraphNode.
The graph node will wait for all work captured in event. See cuEventRecord() for details on what is
captured by an event. The synchronization will be performed efficiently on the device when applicable.
event may be from a different context or device than the launch stream.
These nodes may not be used in loops or conditionals.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
|
303
Modules
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaGraphAddEventRecordNode, cudaEventRecordWithFlags,
cudaStreamWaitEvent, cudaGraphCreate, cudaGraphDestroyNode, cudaGraphAddChildGraphNode,
cudaGraphAddEmptyNode, cudaGraphAddKernelNode, cudaGraphAddMemcpyNode,
cudaGraphAddMemsetNode
__host__cudaError_t
cudaGraphAddExternalSemaphoresSignalNode
(cudaGraphNode_t *pGraphNode,
cudaGraph_t graph, const cudaGraphNode_t
*pDependencies, size_t numDependencies, const
cudaExternalSemaphoreSignalNodeParams *nodeParams)
Creates an external semaphore signal node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
nodeParams
- Parameters for the node
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new external semaphore signal node and adds it to graph with numDependencies
dependencies specified via dependencies and arguments specified in nodeParams. It is possible
for numDependencies to be 0, in which case the node will be placed at the root of the graph.
|
304
Modules
dependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
Performs a signal operation on a set of externally allocated semaphore objects when the node is
launched. The operation(s) will occur after all of the node's dependencies have completed.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaGraphExternalSemaphoresSignalNodeGetParams,
cudaGraphExternalSemaphoresSignalNodeSetParams,
cudaGraphExecExternalSemaphoresSignalNodeSetParams,
cudaGraphAddExternalSemaphoresWaitNode, cudaImportExternalSemaphore,
cudaSignalExternalSemaphoresAsync, cudaWaitExternalSemaphoresAsync, cudaGraphCreate,
cudaGraphDestroyNode, cudaGraphAddEventRecordNode, cudaGraphAddEventWaitNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
__host__cudaError_t
cudaGraphAddExternalSemaphoresWaitNode
(cudaGraphNode_t *pGraphNode,
cudaGraph_t graph, const cudaGraphNode_t
*pDependencies, size_t numDependencies, const
cudaExternalSemaphoreWaitNodeParams *nodeParams)
Creates an external semaphore wait node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
|
305
Modules
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
nodeParams
- Parameters for the node
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new external semaphore wait node and adds it to graph with numDependencies
dependencies specified via dependencies and arguments specified in nodeParams. It is possible
for numDependencies to be 0, in which case the node will be placed at the root of the graph.
dependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
Performs a wait operation on a set of externally allocated semaphore objects when the node is
launched. The node's dependencies will not be launched until the wait operation has completed.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaGraphExternalSemaphoresWaitNodeGetParams,
cudaGraphExternalSemaphoresWaitNodeSetParams,
cudaGraphExecExternalSemaphoresWaitNodeSetParams,
cudaGraphAddExternalSemaphoresSignalNode, cudaImportExternalSemaphore,
cudaSignalExternalSemaphoresAsync, cudaWaitExternalSemaphoresAsync, cudaGraphCreate,
cudaGraphDestroyNode, cudaGraphAddEventRecordNode, cudaGraphAddEventWaitNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
|
306
Modules
__host__cudaError_t cudaGraphAddHostNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t
graph, const cudaGraphNode_t *pDependencies,
size_t numDependencies, const cudaHostNodeParams
*pNodeParams)
Creates a host execution node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
pNodeParams
- Parameters for the host node
Returns
cudaSuccess, cudaErrorNotSupported, cudaErrorInvalidValue
Description
Creates a new CPU execution node and adds it to graph with numDependencies dependencies
specified via pDependencies and arguments specified in pNodeParams. It is possible for
numDependencies to be 0, in which case the node will be placed at the root of the graph.
pDependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
When the graph is launched, the node will invoke the specified CPU function. Host nodes are not
supported under MPS with pre-Volta GPUs.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
307
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaLaunchHostFunc, cudaGraphHostNodeGetParams,
cudaGraphHostNodeSetParams, cudaGraphCreate, cudaGraphDestroyNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddKernelNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, const cudaKernelNodeParams
*pNodeParams)
Creates a kernel execution node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
pNodeParams
- Parameters for the GPU execution node
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDeviceFunction
Description
Creates a new kernel execution node and adds it to graph with numDependencies dependencies
specified via pDependencies and arguments specified in pNodeParams. It is possible for
numDependencies to be 0, in which case the node will be placed at the root of the graph.
pDependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
The cudaKernelNodeParams structure is defined as:
struct cudaKernelNodeParams
|
308
Modules
{
void* func;
dim3 gridDim;
dim3 blockDim;
unsigned int sharedMemBytes;
void **kernelParams;
void **extra;
};
When the graph is launched, the node will invoke kernel func on a (gridDim.x x gridDim.y x
gridDim.z) grid of blocks. Each block contains (blockDim.x x blockDim.y x blockDim.z)
threads.
sharedMem sets the amount of dynamic shared memory that will be available to each thread block.
Kernel parameters to func can be specified in one of two ways:
1) Kernel parameters can be specified via kernelParams. If the kernel has N parameters, then
kernelParams needs to be an array of N pointers. Each pointer, from kernelParams[0] to
kernelParams[N-1], points to the region of memory from which the actual parameter will be
copied. The number of kernel parameters and their offsets and sizes do not need to be specified as that
information is retrieved directly from the kernel's image.
2) Kernel parameters can also be packaged by the application into a single buffer that is passed in
via extra. This places the burden on the application of knowing each kernel parameter's size and
alignment/padding within the buffer. The extra parameter exists to allow this function to take
additional less commonly used arguments. extra specifies a list of names of extra settings and their
corresponding values. Each extra setting name is immediately followed by the corresponding value.
The list must be terminated with either NULL or CU_LAUNCH_PARAM_END.
‣ CU_LAUNCH_PARAM_END, which indicates the end of the extra array;
‣ CU_LAUNCH_PARAM_BUFFER_POINTER, which specifies that the next value in extra will
be a pointer to a buffer containing all the kernel parameters for launching kernel func;
‣ CU_LAUNCH_PARAM_BUFFER_SIZE, which specifies that the next value in
extra will be a pointer to a size_t containing the size of the buffer specified with
CU_LAUNCH_PARAM_BUFFER_POINTER;
The error cudaErrorInvalidValue will be returned if kernel parameters are specified with both
kernelParams and extra (i.e. both kernelParams and extra are non-NULL).
The kernelParams or extra array, as well as the argument values it points to, are copied during
this call.
Note:
Kernels launched using graphs must not use texture and surface references. Reading or writing through
any texture or surface reference is undefined behavior. This restriction does not apply to texture and
surface objects.
|
309
Modules
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ The API can also be used with a kernel cudaKernel_t by querying the handle using
cudaLibraryGetKernel() or cudaGetKernel and then passing it to the API by casting to void*. The
symbol entryFuncAddr passed to cudaGetKernel should be a symbol that is registered with the
same CUDA Runtime instance.
‣ Passing a symbol that belongs that belongs to a different runtime instance will result in undefined
behavior. The only type that can be reliably passed to a different runtime instance is cudaKernel_t
See also:
cudaGraphAddNode, cudaLaunchKernel, cudaGraphKernelNodeGetParams,
cudaGraphKernelNodeSetParams, cudaGraphCreate, cudaGraphDestroyNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddHostNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddMemAllocNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t
graph, const cudaGraphNode_t *pDependencies,
size_t numDependencies, cudaMemAllocNodeParams
*nodeParams)
Creates an allocation node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
|
310
Modules
nodeParams
- Parameters for the node
Returns
cudaSuccess, cudaErrorCudartUnloading, cudaErrorInitializationError, cudaErrorNotSupported,
cudaErrorInvalidValue, cudaErrorOutOfMemory
Description
Creates a new allocation node and adds it to graph with numDependencies dependencies
specified via pDependencies and arguments specified in nodeParams. It is possible for
numDependencies to be 0, in which case the node will be placed at the root of the graph.
pDependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
When cudaGraphAddMemAllocNode creates an allocation node, it returns the address of the allocation
in nodeParams.dptr. The allocation's address remains fixed across instantiations and launches.
If the allocation is freed in the same graph, by creating a free node using
cudaGraphAddMemFreeNode, the allocation can be accessed by nodes ordered after the allocation
node but before the free node. These allocations cannot be freed outside the owning graph, and they
can only be freed once in the owning graph.
If the allocation is not freed in the same graph, then it can be accessed not only by nodes in the graph
which are ordered after the allocation node, but also by stream operations ordered after the graph's
execution but before the allocation is freed.
Allocations which are not freed in the same graph can be freed by:
‣ passing the allocation to cudaMemFreeAsync or cudaMemFree;
‣ launching a graph with a free node for that allocation; or
‣ specifying cudaGraphInstantiateFlagAutoFreeOnLaunch during instantiation, which makes each
launch behave as though it called cudaMemFreeAsync for every unfreed allocation.
It is not possible to free an allocation in both the owning graph and another graph. If the allocation
is freed in the same graph, a free node cannot be added to another graph. If the allocation is freed in
another graph, a free node can no longer be added to the owning graph.
The following restrictions apply to graphs which contain allocation and/or memory free nodes:
‣ Nodes and edges of the graph cannot be deleted.
‣ The graph can only be used in a child node if the ownership is moved to the parent.
‣ Only one instantiation of the graph may exist at any point in time.
‣ The graph cannot be cloned.
Note:
|
311
Modules
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaGraphAddNode, cudaGraphAddMemFreeNode, cudaGraphMemAllocNodeGetParams,
cudaDeviceGraphMemTrim, cudaDeviceGetGraphMemAttribute, cudaDeviceSetGraphMemAttribute,
cudaMallocAsync, cudaFreeAsync, cudaGraphCreate, cudaGraphDestroyNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddEventRecordNode,
cudaGraphAddEventWaitNode, cudaGraphAddExternalSemaphoresSignalNode,
cudaGraphAddExternalSemaphoresWaitNode, cudaGraphAddKernelNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddMemcpyNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, const cudaMemcpy3DParms
*pCopyParams)
Creates a memcpy node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
pCopyParams
- Parameters for the memory copy
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new memcpy node and adds it to graph with numDependencies dependencies specified
via pDependencies. It is possible for numDependencies to be 0, in which case the node will be
placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the
new node will be returned in pGraphNode.
|
312
Modules
When the graph is launched, the node will perform the memcpy described by pCopyParams. See
cudaMemcpy3D() for a description of the structure and its restrictions.
Memcpy nodes have some additional restrictions with regards to managed memory, if
the system contains at least one device which has a zero value for the device attribute
cudaDevAttrConcurrentManagedAccess.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaMemcpy3D, cudaGraphAddMemcpyNodeToSymbol,
cudaGraphAddMemcpyNodeFromSymbol, cudaGraphAddMemcpyNode1D,
cudaGraphMemcpyNodeGetParams, cudaGraphMemcpyNodeSetParams, cudaGraphCreate,
cudaGraphDestroyNode, cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode,
cudaGraphAddKernelNode, cudaGraphAddHostNode, cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddMemcpyNode1D
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, void *dst, const void *src, size_t count,
cudaMemcpyKind kind)
Creates a 1D memcpy node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
|
313
Modules
dst
- Destination memory address
src
- Source memory address
count
- Size in bytes to copy
kind
- Type of transfer
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new 1D memcpy node and adds it to graph with numDependencies dependencies
specified via pDependencies. It is possible for numDependencies to be 0, in which case the
node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A
handle to the new node will be returned in pGraphNode.
When the graph is launched, the node will copy count bytes from the memory area pointed to by
src to the memory area pointed to by dst, where kind specifies the direction of the copy, and
must be one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost,
cudaMemcpyDeviceToDevice, or cudaMemcpyDefault. Passing cudaMemcpyDefault is
recommended, in which case the type of transfer is inferred from the pointer values. However,
cudaMemcpyDefault is only allowed on systems that support unified virtual addressing. Launching
a memcpy node with dst and src pointers that do not match the direction of the copy results in an
undefined behavior.
Memcpy nodes have some additional restrictions with regards to managed memory, if
the system contains at least one device which has a zero value for the device attribute
cudaDevAttrConcurrentManagedAccess.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
|
314
Modules
cudaMemcpy, cudaGraphAddMemcpyNode, cudaGraphMemcpyNodeGetParams,
cudaGraphMemcpyNodeSetParams, cudaGraphMemcpyNodeSetParams1D, cudaGraphCreate,
cudaGraphDestroyNode, cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode,
cudaGraphAddKernelNode, cudaGraphAddHostNode, cudaGraphAddMemsetNode
__host__cudaError_t
cudaGraphAddMemcpyNodeFromSymbol
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, void *dst, const void *symbol, size_t
count, size_t offset, cudaMemcpyKind kind)
Creates a memcpy node to copy from a symbol on the device and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
dst
- Destination memory address
symbol
- Device symbol address
count
- Size in bytes to copy
offset
- Offset from start of symbol in bytes
kind
- Type of transfer
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new memcpy node to copy from symbol and adds it to graph with numDependencies
dependencies specified via pDependencies. It is possible for numDependencies to be 0, in
|
315
Modules
which case the node will be placed at the root of the graph. pDependencies may not have any
duplicate entries. A handle to the new node will be returned in pGraphNode.
When the graph is launched, the node will copy count bytes from the memory area pointed to by
offset bytes from the start of symbol symbol to the memory area pointed to by dst. The memory
areas may not overlap. symbol is a variable that resides in global or constant memory space. kind
can be either cudaMemcpyDeviceToHost, cudaMemcpyDeviceToDevice, or cudaMemcpyDefault.
Passing cudaMemcpyDefault is recommended, in which case the type of transfer is inferred from the
pointer values. However, cudaMemcpyDefault is only allowed on systems that support unified virtual
addressing.
Memcpy nodes have some additional restrictions with regards to managed memory, if
the system contains at least one device which has a zero value for the device attribute
cudaDevAttrConcurrentManagedAccess.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaMemcpyFromSymbol, cudaGraphAddMemcpyNode, cudaGraphAddMemcpyNodeToSymbol,
cudaGraphMemcpyNodeGetParams, cudaGraphMemcpyNodeSetParams,
cudaGraphMemcpyNodeSetParamsFromSymbol, cudaGraphMemcpyNodeSetParamsToSymbol,
cudaGraphCreate, cudaGraphDestroyNode, cudaGraphAddChildGraphNode,
cudaGraphAddEmptyNode, cudaGraphAddKernelNode, cudaGraphAddHostNode,
cudaGraphAddMemsetNode
|
316
Modules
__host__cudaError_t
cudaGraphAddMemcpyNodeToSymbol (cudaGraphNode_t
*pGraphNode, cudaGraph_t graph, const cudaGraphNode_t
*pDependencies, size_t numDependencies, const void
*symbol, const void *src, size_t count, size_t offset,
cudaMemcpyKind kind)
Creates a memcpy node to copy to a symbol on the device and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
symbol
- Device symbol address
src
- Source memory address
count
- Size in bytes to copy
offset
- Offset from start of symbol in bytes
kind
- Type of transfer
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Creates a new memcpy node to copy to symbol and adds it to graph with numDependencies
dependencies specified via pDependencies. It is possible for numDependencies to be 0, in
which case the node will be placed at the root of the graph. pDependencies may not have any
duplicate entries. A handle to the new node will be returned in pGraphNode.
When the graph is launched, the node will copy count bytes from the memory area pointed to by
src to the memory area pointed to by offset bytes from the start of symbol symbol. The memory
|
317
Modules
areas may not overlap. symbol is a variable that resides in global or constant memory space. kind
can be either cudaMemcpyHostToDevice, cudaMemcpyDeviceToDevice, or cudaMemcpyDefault.
Passing cudaMemcpyDefault is recommended, in which case the type of transfer is inferred from the
pointer values. However, cudaMemcpyDefault is only allowed on systems that support unified virtual
addressing.
Memcpy nodes have some additional restrictions with regards to managed memory, if
the system contains at least one device which has a zero value for the device attribute
cudaDevAttrConcurrentManagedAccess.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaMemcpyToSymbol, cudaGraphAddMemcpyNode, cudaGraphAddMemcpyNodeFromSymbol,
cudaGraphMemcpyNodeGetParams, cudaGraphMemcpyNodeSetParams,
cudaGraphMemcpyNodeSetParamsToSymbol, cudaGraphMemcpyNodeSetParamsFromSymbol,
cudaGraphCreate, cudaGraphDestroyNode, cudaGraphAddChildGraphNode,
cudaGraphAddEmptyNode, cudaGraphAddKernelNode, cudaGraphAddHostNode,
cudaGraphAddMemsetNode
__host__cudaError_t cudaGraphAddMemFreeNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, void *dptr)
Creates a memory free node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
|
318
Modules
numDependencies
- Number of dependencies
dptr
- Address of memory to free
Returns
cudaSuccess, cudaErrorCudartUnloading, cudaErrorInitializationError, cudaErrorNotSupported,
cudaErrorInvalidValue, cudaErrorOutOfMemory
Description
Creates a new memory free node and adds it to graph with numDependencies
dependencies specified via pDependencies and address specified in dptr. It is possible for
numDependencies to be 0, in which case the node will be placed at the root of the graph.
pDependencies may not have any duplicate entries. A handle to the new node will be returned in
pGraphNode.
cudaGraphAddMemFreeNode will return cudaErrorInvalidValue if the user attempts to free:
‣ an allocation twice in the same graph.
‣ an address that was not returned by an allocation node.
‣ an invalid address.
The following restrictions apply to graphs which contain allocation and/or memory free nodes:
‣ Nodes and edges of the graph cannot be deleted.
‣ The graph can only be used in a child node if the ownership is moved to the parent.
‣ Only one instantiation of the graph may exist at any point in time.
‣ The graph cannot be cloned.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaGraphAddNode, cudaGraphAddMemAllocNode, cudaGraphMemFreeNodeGetParams,
cudaDeviceGraphMemTrim, cudaDeviceGetGraphMemAttribute, cudaDeviceSetGraphMemAttribute,
cudaMallocAsync, cudaFreeAsync, cudaGraphCreate, cudaGraphDestroyNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddEventRecordNode,
cudaGraphAddEventWaitNode, cudaGraphAddExternalSemaphoresSignalNode,
cudaGraphAddExternalSemaphoresWaitNode, cudaGraphAddKernelNode,
cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
|
319
Modules
__host__cudaError_t cudaGraphAddMemsetNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t
graph, const cudaGraphNode_t *pDependencies,
size_t numDependencies, const cudaMemsetParams
*pMemsetParams)
Creates a memset node and adds it to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
pMemsetParams
- Parameters for the memory set
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevice
Description
Creates a new memset node and adds it to graph with numDependencies dependencies specified
via pDependencies. It is possible for numDependencies to be 0, in which case the node will be
placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the
new node will be returned in pGraphNode.
The element size must be 1, 2, or 4 bytes. When the graph is launched, the node will perform the
memset described by pMemsetParams.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
320
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddNode, cudaMemset2D, cudaGraphMemsetNodeGetParams,
cudaGraphMemsetNodeSetParams, cudaGraphCreate, cudaGraphDestroyNode,
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddHostNode, cudaGraphAddMemcpyNode
__host__cudaError_t cudaGraphAddNode
(cudaGraphNode_t *pGraphNode, cudaGraph_t graph,
const cudaGraphNode_t *pDependencies, size_t
numDependencies, cudaGraphNodeParams *nodeParams)
Adds a node of arbitrary type to a graph.
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
numDependencies
- Number of dependencies
nodeParams
- Specification of the node
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDeviceFunction, cudaErrorNotSupported
Description
Creates a new node in graph described by nodeParams with numDependencies dependencies
specified via pDependencies. numDependencies may be 0. pDependencies may be null if
numDependencies is 0. pDependencies may not have any duplicate entries.
nodeParams is a tagged union. The node type should be specified in the type field, and type-
specific parameters in the corresponding union member. All unused bytes - that is, reserved0
and all bytes past the utilized union member - must be set to zero. It is recommended to use brace
initialization or memset to ensure all bytes are initialized.
|
321
Modules
Note that for some node types, nodeParams may contain "out parameters" which are modified during
the call, such as nodeParams->alloc.dptr.
A handle to the new node will be returned in phGraphNode.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphCreate, cudaGraphNodeSetParams, cudaGraphExecNodeSetParams
__host__cudaError_t cudaGraphAddNode_v2
(cudaGraphNode_t *pGraphNode, cudaGraph_t
graph, const cudaGraphNode_t *pDependencies,
const cudaGraphEdgeData *dependencyData, size_t
numDependencies, cudaGraphNodeParams *nodeParams)
Adds a node of arbitrary type to a graph (12.3+).
Parameters
pGraphNode
- Returns newly created node
graph
- Graph to which to add the node
pDependencies
- Dependencies of the node
dependencyData
- Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for
all dependencies.
numDependencies
- Number of dependencies
nodeParams
- Specification of the node
|
322
Modules
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDeviceFunction, cudaErrorNotSupported
Description
Creates a new node in graph described by nodeParams with numDependencies dependencies
specified via pDependencies. numDependencies may be 0. pDependencies may be null if
numDependencies is 0. pDependencies may not have any duplicate entries.
nodeParams is a tagged union. The node type should be specified in the type field, and type-
specific parameters in the corresponding union member. All unused bytes - that is, reserved0
and all bytes past the utilized union member - must be set to zero. It is recommended to use brace
initialization or memset to ensure all bytes are initialized.
Note that for some node types, nodeParams may contain "out parameters" which are modified during
the call, such as nodeParams->alloc.dptr.
A handle to the new node will be returned in phGraphNode.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphCreate, cudaGraphNodeSetParams, cudaGraphExecNodeSetParams
__host__cudaError_t cudaGraphChildGraphNodeGetGraph
(cudaGraphNode_t node, cudaGraph_t *pGraph)
Gets a handle to the embedded graph of a child graph node.
Parameters
node
- Node to get the embedded graph for
pGraph
- Location to store a handle to the graph
|
323
Modules
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Gets a handle to the embedded graph in a child graph node. This call does not clone the graph. Changes
to the graph will be reflected in the node, and the node retains ownership of the graph.
Allocation and free nodes cannot be added to the returned graph. Attempting to do so will return an
error.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddChildGraphNode, cudaGraphNodeFindInClone
__host__cudaError_t cudaGraphClone (cudaGraph_t
*pGraphClone, cudaGraph_t originalGraph)
Clones a graph.
Parameters
pGraphClone
- Returns newly created cloned graph
originalGraph
- Graph to clone
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorMemoryAllocation
Description
This function creates a copy of originalGraph and returns it in pGraphClone. All parameters
are copied into the cloned graph. The original graph may be modified after this call without affecting
the clone.
|
324
Modules
Child graph nodes in the original graph are recursively copied into the clone.
Note:
: Cloning is not supported for graphs which contain memory allocation nodes, memory free nodes, or
conditional nodes.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphCreate, cudaGraphNodeFindInClone
__host__cudaError_t cudaGraphConditionalHandleCreate
(cudaGraphConditionalHandle *pHandle_out, cudaGraph_t
graph, unsigned int defaultLaunchValue, unsigned int flags)
Create a conditional handle.
Parameters
pHandle_out
- Pointer used to return the handle to the caller.
graph
defaultLaunchValue
- Optional initial value for the conditional variable. Applied at the beginning of each graph
execution if cudaGraphCondAssignDefault is set in flags.
flags
- Currently must be cudaGraphCondAssignDefault or 0.
Returns
CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_SUPPORTED
Description
Creates a conditional handle associated with hGraph.
|
325
Modules
The conditional handle must be associated with a conditional node in this graph or one of its children.
Handles not associated with a conditional node may cause graph instantiation to fail.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
See also:
cuGraphAddNode,
__host__cudaError_t cudaGraphCreate (cudaGraph_t
*pGraph, unsigned int flags)
Creates a graph.
Parameters
pGraph
- Returns newly created graph
flags
- Graph creation flags, must be 0
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorMemoryAllocation
Description
Creates an empty graph, which is returned via pGraph.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
|
326
Modules
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddHostNode, cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode,
cudaGraphInstantiate, cudaGraphDestroy, cudaGraphGetNodes, cudaGraphGetRootNodes,
cudaGraphGetEdges, cudaGraphClone
__host__cudaError_t cudaGraphDebugDotPrint
(cudaGraph_t graph, const char *path, unsigned int flags)
Write a DOT file describing graph structure.
Parameters
graph
- The graph to create a DOT file from
path
- The path to write the DOT file to
flags
- Flags from cudaGraphDebugDotFlags for specifying which additional node information to write
Returns
cudaSuccess, cudaErrorInvalidValue, cudaErrorOperatingSystem
Description
Using the provided graph, write to path a DOT formatted description of the graph. By default this
includes the graph topology, node types, node id, kernel names and memcpy direction. flags can be
specified to write more detailed information about each node type such as parameter values, kernel
attributes, node and function handles.
__host__cudaError_t cudaGraphDestroy (cudaGraph_t
graph)
Destroys a graph.
Parameters
graph
- Graph to destroy
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Destroys the graph specified by graph, as well as all of its nodes.
|
327
Modules
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaGraphCreate
__host__cudaError_t cudaGraphDestroyNode
(cudaGraphNode_t node)
Remove a node from the graph.
Parameters
node
- Node to remove
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Removes node from its graph. This operation also severs any dependencies of other nodes on node
and vice versa.
Dependencies cannot be removed from graphs which contain allocation or free nodes. Any attempt to
do so will return an error.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
328
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaGraphAddChildGraphNode, cudaGraphAddEmptyNode, cudaGraphAddKernelNode,
cudaGraphAddHostNode, cudaGraphAddMemcpyNode, cudaGraphAddMemsetNode
__host__cudaError_t
cudaGraphEventRecordNodeGetEvent (cudaGraphNode_t
node, cudaEvent_t *event_out)
Returns the event associated with an event record node.
Parameters
node
event_out
- Pointer to return the event
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the event of event record node hNode in event_out.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddEventRecordNode, cudaGraphEventRecordNodeSetEvent,
cudaGraphEventWaitNodeGetEvent, cudaEventRecordWithFlags, cudaStreamWaitEvent
|
329
Modules
__host__cudaError_t
cudaGraphEventRecordNodeSetEvent (cudaGraphNode_t
node, cudaEvent_t event)
Sets an event record node's event.
Parameters
node
event
- Event to use
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Sets the event of event record node hNode to event.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphNodeSetParams, cudaGraphAddEventRecordNode, cudaGraphEventRecordNodeGetEvent,
cudaGraphEventWaitNodeSetEvent, cudaEventRecordWithFlags, cudaStreamWaitEvent
__host__cudaError_t cudaGraphEventWaitNodeGetEvent
(cudaGraphNode_t node, cudaEvent_t *event_out)
Returns the event associated with an event wait node.
Parameters
node
event_out
- Pointer to return the event
|
330
Modules
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the event of event wait node hNode in event_out.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphAddEventWaitNode, cudaGraphEventWaitNodeSetEvent,
cudaGraphEventRecordNodeGetEvent, cudaEventRecordWithFlags, cudaStreamWaitEvent
__host__cudaError_t cudaGraphEventWaitNodeSetEvent
(cudaGraphNode_t node, cudaEvent_t event)
Sets an event wait node's event.
Parameters
node
event
- Event to use
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Sets the event of event wait node hNode to event.
Note:
‣ Graph objects are not threadsafe. More here.
|
331
Modules
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphNodeSetParams, cudaGraphAddEventWaitNode, cudaGraphEventWaitNodeGetEvent,
cudaGraphEventRecordNodeSetEvent, cudaEventRecordWithFlags, cudaStreamWaitEvent
__host__cudaError_t
cudaGraphExecChildGraphNodeSetParams
(cudaGraphExec_t hGraphExec, cudaGraphNode_t node,
cudaGraph_t childGraph)
Updates node parameters in the child graph node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
node
- Host node from the graph which was used to instantiate graphExec
childGraph
- The graph supplying the updated parameters
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Updates the work represented by node in hGraphExec as though the nodes contained in node's
graph had the parameters contained in childGraph's nodes at instantiation. node must remain in
the graph which was used to instantiate hGraphExec. Changed edges to and from node are ignored.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. node is also not modified by this call.
The topology of childGraph, as well as the node insertion order, must match that of the graph
contained in node. See cudaGraphExecUpdate() for a list of restrictions on what can be updated in an
instantiated graph. The update is recursive, so child graph nodes contained within the top level child
graph will also be updated.
|
332
Modules
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphExecNodeSetParams, cudaGraphAddChildGraphNode,
cudaGraphChildGraphNodeGetGraph, cudaGraphExecKernelNodeSetParams,
cudaGraphExecMemcpyNodeSetParams, cudaGraphExecMemsetNodeSetParams,
cudaGraphExecHostNodeSetParams, cudaGraphExecEventRecordNodeSetEvent,
cudaGraphExecEventWaitNodeSetEvent, cudaGraphExecExternalSemaphoresSignalNodeSetParams,
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t cudaGraphExecDestroy
(cudaGraphExec_t graphExec)
Destroys an executable graph.
Parameters
graphExec
- Executable graph to destroy
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Destroys the executable graph specified by graphExec.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
333
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ Use of the handle after this call is undefined behavior.
See also:
cudaGraphInstantiate, cudaGraphUpload, cudaGraphLaunch
__host__cudaError_t
cudaGraphExecEventRecordNodeSetEvent
(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode,
cudaEvent_t event)
Sets the event for an event record node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
hNode
- Event record node from the graph from which graphExec was instantiated
event
- Updated event to use
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Sets the event of an event record node in an executable graph hGraphExec. The node is identified
by the corresponding node hNode in the non-executable graph, from which the executable graph was
instantiated.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
|
334
Modules
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphExecNodeSetParams, cudaGraphAddEventRecordNode,
cudaGraphEventRecordNodeGetEvent, cudaGraphEventWaitNodeSetEvent,
cudaEventRecordWithFlags, cudaStreamWaitEvent, cudaGraphExecKernelNodeSetParams,
cudaGraphExecMemcpyNodeSetParams, cudaGraphExecMemsetNodeSetParams,
cudaGraphExecHostNodeSetParams, cudaGraphExecChildGraphNodeSetParams,
cudaGraphExecEventWaitNodeSetEvent, cudaGraphExecExternalSemaphoresSignalNodeSetParams,
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t
cudaGraphExecEventWaitNodeSetEvent
(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode,
cudaEvent_t event)
Sets the event for an event wait node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
hNode
- Event wait node from the graph from which graphExec was instantiated
event
- Updated event to use
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Sets the event of an event wait node in an executable graph hGraphExec. The node is identified by
the corresponding node hNode in the non-executable graph, from which the executable graph was
instantiated.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
Note:
|
335
Modules
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphExecNodeSetParams, cudaGraphAddEventWaitNode, cudaGraphEventWaitNodeGetEvent,
cudaGraphEventRecordNodeSetEvent, cudaEventRecordWithFlags, cudaStreamWaitEvent,
cudaGraphExecKernelNodeSetParams, cudaGraphExecMemcpyNodeSetParams,
cudaGraphExecMemsetNodeSetParams, cudaGraphExecHostNodeSetParams,
cudaGraphExecChildGraphNodeSetParams, cudaGraphExecEventRecordNodeSetEvent,
cudaGraphExecExternalSemaphoresSignalNodeSetParams,
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t
cudaGraphExecExternalSemaphoresSignalNodeSetParams
(cudaGraphExec_t hGraphExec, cudaGraphNode_t
hNode, const cudaExternalSemaphoreSignalNodeParams
*nodeParams)
Sets the parameters for an external semaphore signal node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
hNode
- semaphore signal node from the graph from which graphExec was instantiated
nodeParams
- Updated Parameters to set
Returns
cudaSuccess, cudaErrorInvalidValue,
|
336
Modules
Description
Sets the parameters of an external semaphore signal node in an executable graph hGraphExec. The
node is identified by the corresponding node hNode in the non-executable graph, from which the
executable graph was instantiated.
hNode must not have been removed from the original graph.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
Changing nodeParams->numExtSems is not supported.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphExecNodeSetParams, cudaGraphAddExternalSemaphoresSignalNode,
cudaImportExternalSemaphore, cudaSignalExternalSemaphoresAsync,
cudaWaitExternalSemaphoresAsync, cudaGraphExecKernelNodeSetParams,
cudaGraphExecMemcpyNodeSetParams, cudaGraphExecMemsetNodeSetParams,
cudaGraphExecHostNodeSetParams, cudaGraphExecChildGraphNodeSetParams,
cudaGraphExecEventRecordNodeSetEvent, cudaGraphExecEventWaitNodeSetEvent,
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
|
337
Modules
__host__cudaError_t
cudaGraphExecExternalSemaphoresWaitNodeSetParams
(cudaGraphExec_t hGraphExec, cudaGraphNode_t
hNode, const cudaExternalSemaphoreWaitNodeParams
*nodeParams)
Sets the parameters for an external semaphore wait node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
hNode
- semaphore wait node from the graph from which graphExec was instantiated
nodeParams
- Updated Parameters to set
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Sets the parameters of an external semaphore wait node in an executable graph hGraphExec. The
node is identified by the corresponding node hNode in the non-executable graph, from which the
executable graph was instantiated.
hNode must not have been removed from the original graph.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. hNode is also not modified by this call.
Changing nodeParams->numExtSems is not supported.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
|
338
Modules
See also:
cudaGraphExecNodeSetParams, cudaGraphAddExternalSemaphoresWaitNode,
cudaImportExternalSemaphore, cudaSignalExternalSemaphoresAsync,
cudaWaitExternalSemaphoresAsync, cudaGraphExecKernelNodeSetParams,
cudaGraphExecMemcpyNodeSetParams, cudaGraphExecMemsetNodeSetParams,
cudaGraphExecHostNodeSetParams, cudaGraphExecChildGraphNodeSetParams,
cudaGraphExecEventRecordNodeSetEvent, cudaGraphExecEventWaitNodeSetEvent,
cudaGraphExecExternalSemaphoresSignalNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t cudaGraphExecGetFlags
(cudaGraphExec_t graphExec, unsigned long long *flags)
Query the instantiation flags of an executable graph.
Parameters
graphExec
- The executable graph to query
flags
- Returns the instantiation flags
Returns
cudaSuccess, cudaErrorInvalidValue
Description
Returns the flags that were passed to instantiation for the given executable graph.
cudaGraphInstantiateFlagUpload will not be returned by this API as it does not affect the resulting
executable graph.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphInstantiate, cudaGraphInstantiateWithFlags, cudaGraphInstantiateWithParams
|
339
Modules
__host__cudaError_t cudaGraphExecHostNodeSetParams
(cudaGraphExec_t hGraphExec, cudaGraphNode_t node,
const cudaHostNodeParams *pNodeParams)
Sets the parameters for a host node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
node
- Host node from the graph which was used to instantiate graphExec
pNodeParams
- Updated Parameters to set
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Updates the work represented by node in hGraphExec as though node had contained
pNodeParams at instantiation. node must remain in the graph which was used to instantiate
hGraphExec. Changed edges to and from node are ignored.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. node is also not modified by this call.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
See also:
cudaGraphExecNodeSetParams, cudaGraphAddHostNode, cudaGraphHostNodeSetParams,
cudaGraphExecKernelNodeSetParams, cudaGraphExecMemcpyNodeSetParams,
cudaGraphExecMemsetNodeSetParams, cudaGraphExecChildGraphNodeSetParams,
cudaGraphExecEventRecordNodeSetEvent, cudaGraphExecEventWaitNodeSetEvent,
cudaGraphExecExternalSemaphoresSignalNodeSetParams,
|
340
Modules
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t
cudaGraphExecKernelNodeSetParams (cudaGraphExec_t
hGraphExec, cudaGraphNode_t node, const
cudaKernelNodeParams *pNodeParams)
Sets the parameters for a kernel node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
node
- kernel node from the graph from which graphExec was instantiated
pNodeParams
- Updated Parameters to set
Returns
cudaSuccess, cudaErrorInvalidValue,
Description
Sets the parameters of a kernel node in an executable graph hGraphExec. The node is identified
by the corresponding node node in the non-executable graph, from which the executable graph was
instantiated.
node must not have been removed from the original graph. All nodeParams fields may change, but
the following restrictions apply to func updates:
‣ The owning device of the function cannot change.
‣ A node whose function originally did not use CUDA dynamic parallelism cannot be updated to a
function which uses CDP
‣ A node whose function originally did not make device-side update calls cannot be updated to a
function which makes device-side update calls.
‣ If hGraphExec was not instantiated for device launch, a node whose function originally did
not use device-side cudaGraphLaunch() cannot be updated to a function which uses device-side
cudaGraphLaunch() unless the node resides on the same device as nodes which contained such
calls at instantiate-time. If no such calls were present at instantiation, these updates cannot be
performed at all.
The modifications only affect future launches of hGraphExec. Already enqueued or running
launches of hGraphExec are not affected by this call. node is also not modified by this call.
|
341
Modules
If node is a device-updatable kernel node, the next upload/launch of hGraphExec will overwrite any
previous device-side updates. Additionally, applying host updates to a device-updatable kernel node
while it is being updated from the device will result in undefined behavior.
Note:
‣ Graph objects are not threadsafe. More here.
‣ Note that this function may also return error codes from previous, asynchronous launches.
‣ Note that this function may also return cudaErrorInitializationError, cudaErrorInsufficientDriver or
cudaErrorNoDevice if this call tries to initialize internal CUDA RT state.
‣ Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback.
cudaErrorNotPermitted may, but is not guaranteed to, be returned as a diagnostic in such case.
‣ The API can also be used with a kernel cudaKernel_t by querying the handle using
cudaLibraryGetKernel() or cudaGetKernel and then passing it to the API by casting to void*. The
symbol entryFuncAddr passed to cudaGetKernel should be a symbol that is registered with the
same CUDA Runtime instance.
‣ Passing a symbol that belongs that belongs to a different runtime instance will result in undefined
behavior. The only type that can be reliably passed to a different runtime instance is cudaKernel_t
See also:
cudaGraphExecNodeSetParams, cudaGraphAddKernelNode,
cudaGraphKernelNodeSetParams, cudaGraphExecMemcpyNodeSetParams,
cudaGraphExecMemsetNodeSetParams, cudaGraphExecHostNodeSetParams,
cudaGraphExecChildGraphNodeSetParams, cudaGraphExecEventRecordNodeSetEvent,
cudaGraphExecEventWaitNodeSetEvent, cudaGraphExecExternalSemaphoresSignalNodeSetParams,
cudaGraphExecExternalSemaphoresWaitNodeSetParams, cudaGraphExecUpdate,
cudaGraphInstantiate
__host__cudaError_t
cudaGraphExecMemcpyNodeSetParams
(cudaGraphExec_t hGraphExec, cudaGraphNode_t node,
const cudaMemcpy3DParms *pNodeParams)
Sets the parameters for a memcpy node in the given graphExec.
Parameters
hGraphExec
- The executable graph in which to set the specified node
node
- Memcpy node from the graph which was used to instantiate graphExec
|
342
|
||
|
|
|