runtime#
Data types used by CUDA Runtime#
- class cuda.bindings.runtime.cudaChannelFormatDesc(void_ptr _ptr=0)#
CUDA Channel format descriptor .. attribute:: x x :type: int .. attribute:: y y :type: int .. attribute:: z z :type: int .. attribute:: w w :type: int .. attribute:: f Channel format kind :type: cudaChannelFormatKind .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaArraySparseProperties(void_ptr _ptr=0)#
Sparse CUDA array and CUDA mipmapped array properties .. attribute:: tileExtent :type: anon_struct0 .. attribute:: miptailFirstLevel First mip level at which the mip tail begins :type: unsigned int .. attribute:: miptailSize Total size of the mip tail. :type: unsigned long long .. attribute:: flags Flags will either be zero or cudaArraySparsePropertiesSingleMipTail :type: unsigned int .. attribute:: reserved :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaArrayMemoryRequirements(void_ptr _ptr=0)#
CUDA array and CUDA mipmapped array memory requirements .. attribute:: size Total size of the array. :type: size_t .. attribute:: alignment Alignment necessary for mapping the array. :type: size_t .. attribute:: reserved :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaPitchedPtr(void_ptr _ptr=0)#
CUDA Pitched memory pointer make_cudaPitchedPtr .. attribute:: ptr Pointer to allocated memory :type: Any .. attribute:: pitch Pitch of allocated memory in bytes :type: size_t .. attribute:: xsize Logical width of allocation in elements :type: size_t .. attribute:: ysize Logical height of allocation in elements :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExtent(void_ptr _ptr=0)#
CUDA extent make_cudaExtent .. attribute:: width Width in elements when referring to array memory, in bytes when referring to linear memory :type: size_t .. attribute:: height Height in elements :type: size_t .. attribute:: depth Depth in elements :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaPos(void_ptr _ptr=0)#
CUDA 3D position make_cudaPos .. attribute:: x x :type: size_t .. attribute:: y y :type: size_t .. attribute:: z z :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpy3DParms(void_ptr _ptr=0)#
CUDA 3D memory copying parameters .. attribute:: srcArray Source memory address :type: cudaArray_t .. attribute:: srcPos Source position offset :type: cudaPos .. attribute:: srcPtr Pitched source memory address :type: cudaPitchedPtr .. attribute:: dstArray Destination memory address :type: cudaArray_t .. attribute:: dstPos Destination position offset :type: cudaPos .. attribute:: dstPtr Pitched destination memory address :type: cudaPitchedPtr .. attribute:: extent Requested memory copy size :type: cudaExtent .. attribute:: kind Type of transfer :type: cudaMemcpyKind .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpyNodeParams(void_ptr _ptr=0)#
Memcpy node parameters .. attribute:: flags Must be zero :type: int .. attribute:: reserved Must be zero :type: int .. attribute:: ctx Context in which to run the memcpy. If NULL will try to use the current context. :type: cudaExecutionContext_t .. attribute:: copyParams Parameters for the memory copy :type: cudaMemcpy3DParms .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpy3DPeerParms(void_ptr _ptr=0)#
CUDA 3D cross-device memory copying parameters .. attribute:: srcArray Source memory address :type: cudaArray_t .. attribute:: srcPos Source position offset :type: cudaPos .. attribute:: srcPtr Pitched source memory address :type: cudaPitchedPtr .. attribute:: srcDevice Source device :type: int .. attribute:: dstArray Destination memory address :type: cudaArray_t .. attribute:: dstPos Destination position offset :type: cudaPos .. attribute:: dstPtr Pitched destination memory address :type: cudaPitchedPtr .. attribute:: dstDevice Destination device :type: int .. attribute:: extent Requested memory copy size :type: cudaExtent .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemsetParams(void_ptr _ptr=0)#
CUDA Memset node parameters .. attribute:: dst Destination device pointer :type: Any .. attribute:: pitch Pitch of destination device pointer. Unused if height is 1 :type: size_t .. attribute:: value Value to be set :type: unsigned int .. attribute:: elementSize Size of each element in bytes. Must be 1, 2, or 4. :type: unsigned int .. attribute:: width Width of the row in elements :type: size_t .. attribute:: height Number of rows :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemsetParamsV2(void_ptr _ptr=0)#
CUDA Memset node parameters .. attribute:: dst Destination device pointer :type: Any .. attribute:: pitch Pitch of destination device pointer. Unused if height is 1 :type: size_t .. attribute:: value Value to be set :type: unsigned int .. attribute:: elementSize Size of each element in bytes. Must be 1, 2, or 4. :type: unsigned int .. attribute:: width Width of the row in elements :type: size_t .. attribute:: height Number of rows :type: size_t .. attribute:: ctx Context in which to run the memset. If NULL will try to use the current context. :type: cudaExecutionContext_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaAccessPolicyWindow(void_ptr _ptr=0)#
Specifies an access policy for a window, a contiguous extent of memory beginning at base_ptr and ending at base_ptr + num_bytes. Partition into many segments and assign segments such that. sum of "hit segments" / window == approx. ratio. sum of "miss segments" / window == approx 1-ratio. Segments and ratio specifications are fitted to the capabilities of the architecture. Accesses in a hit segment apply the hitProp access policy. Accesses in a miss segment apply the missProp access policy. .. attribute:: base_ptr Starting address of the access policy window. CUDA driver may align it. :type: Any .. attribute:: num_bytes Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment. :type: size_t .. attribute:: hitRatio hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp. :type: float .. attribute:: hitProp ::CUaccessProperty set for hit. :type: cudaAccessProperty .. attribute:: missProp ::CUaccessProperty set for miss. Must be either NORMAL or STREAMING. :type: cudaAccessProperty .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaHostNodeParams(void_ptr _ptr=0)#
CUDA host node parameters .. attribute:: fn The function to call when the node executes :type: cudaHostFn_t .. attribute:: userData Argument to pass to the function :type: Any .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaHostNodeParamsV2(void_ptr _ptr=0)#
CUDA host node parameters .. attribute:: fn The function to call when the node executes :type: cudaHostFn_t .. attribute:: userData Argument to pass to the function :type: Any .. attribute:: syncMode The synchronization mode to use for the host task :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaResourceDesc(void_ptr _ptr=0)#
CUDA resource descriptor .. attribute:: resType Resource type :type: cudaResourceType .. attribute:: res :type: anon_union0 .. attribute:: flags Flags (must be zero) :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaResourceViewDesc(void_ptr _ptr=0)#
CUDA resource view descriptor .. attribute:: format Resource view format :type: cudaResourceViewFormat .. attribute:: width Width of the resource view :type: size_t .. attribute:: height Height of the resource view :type: size_t .. attribute:: depth Depth of the resource view :type: size_t .. attribute:: firstMipmapLevel First defined mipmap level :type: unsigned int .. attribute:: lastMipmapLevel Last defined mipmap level :type: unsigned int .. attribute:: firstLayer First layer index :type: unsigned int .. attribute:: lastLayer Last layer index :type: unsigned int .. attribute:: reserved Must be zero :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaPointerAttributes(void_ptr _ptr=0)#
CUDA pointer attributes .. attribute:: type The type of memory - cudaMemoryTypeUnregistered, cudaMemoryTypeHost, cudaMemoryTypeDevice or cudaMemoryTypeManaged. :type: cudaMemoryType .. attribute:: device The device against which the memory was allocated or registered. If the memory type is cudaMemoryTypeDevice then this identifies the device on which the memory referred physically resides. If the memory type is cudaMemoryTypeHost or::cudaMemoryTypeManaged then this identifies the device which was current when the memory was allocated or registered (and if that device is deinitialized then this allocation will vanish with that device's state). :type: int .. attribute:: devicePointer The address which may be dereferenced on the current device to access the memory or NULL if no such address exists. :type: Any .. attribute:: hostPointer The address which may be dereferenced on the host to access the memory or NULL if no such address exists. CUDA doesn't check if unregistered memory is allocated so this field may contain invalid pointer if an invalid pointer has been passed to CUDA. :type: Any .. attribute:: reserved Must be zero :type: list[long] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaFuncAttributes(void_ptr _ptr=0)#
CUDA function attributes .. attribute:: sharedSizeBytes The size in bytes of statically-allocated shared memory per block required by this function. This does not include dynamically- allocated shared memory requested by the user at runtime. :type: size_t .. attribute:: constSizeBytes The size in bytes of user-allocated constant memory required by this function. :type: size_t .. attribute:: localSizeBytes The size in bytes of local memory used by each thread of this function. :type: size_t .. attribute:: maxThreadsPerBlock The maximum number of threads per block, beyond which a launch of the function would fail. This number depends on both the function and the device on which the function is currently loaded. :type: int .. attribute:: numRegs The number of registers used by each thread of this function. :type: int .. attribute:: ptxVersion The PTX virtual architecture version for which the function was compiled. This value is the major PTX version * 10 + the minor PTX version, so a PTX version 1.3 function would return the value 13. :type: int .. attribute:: binaryVersion The binary architecture version for which the function was compiled. This value is the major binary version * 10 + the minor binary version, so a binary version 1.3 function would return the value 13. :type: int .. attribute:: cacheModeCA The attribute to indicate whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set. :type: int .. attribute:: maxDynamicSharedSizeBytes The maximum size in bytes of dynamic shared memory per block for this function. Any launch must have a dynamic shared memory size smaller than this value. :type: int .. attribute:: preferredShmemCarveout On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the maximum shared memory. Refer to cudaDevAttrMaxSharedMemoryPerMultiprocessor. This is only a hint, and the driver can choose a different ratio if required to execute the function. See cudaFuncSetAttribute :type: int .. attribute:: clusterDimMustBeSet If this attribute is set, the kernel must launch with a valid cluster dimension specified. :type: int .. attribute:: requiredClusterWidth The required cluster width/height/depth in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime should return cudaErrorNotPermitted. See cudaFuncSetAttribute :type: int .. attribute:: requiredClusterHeight :type: int .. attribute:: requiredClusterDepth :type: int .. attribute:: clusterSchedulingPolicyPreference The block scheduling policy of a function. See cudaFuncSetAttribute :type: int .. attribute:: nonPortableClusterSizeAllowed Whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable cluster size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run on a different hardware platform. CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired size can be launched on the current device. Portable Cluster Size A portable cluster size is guaranteed to be functional on all compute capabilities higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase for future compute capabilities. The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable. See cudaFuncSetAttribute :type: int .. attribute:: reserved0 :type: int .. attribute:: reserved Reserved for future use. :type: list[int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemLocation(void_ptr _ptr=0)#
Specifies a memory location. To specify a gpu, set type = cudaMemLocationTypeDevice and set id = the gpu's device ordinal. To specify a cpu NUMA node, set type = cudaMemLocationTypeHostNuma and set id = host NUMA node id. .. attribute:: type Specifies the location type, which modifies the meaning of id. :type: cudaMemLocationType .. attribute:: id identifier for a given this location's ::CUmemLocationType. :type: int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemAccessDesc(void_ptr _ptr=0)#
Memory access descriptor .. attribute:: location Location on which the request is to change it's accessibility :type: cudaMemLocation .. attribute:: flags ::CUmemProt accessibility flags to set on the request :type: cudaMemAccessFlags .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemPoolProps(void_ptr _ptr=0)#
Specifies the properties of allocations made from the pool. .. attribute:: allocType Allocation type. Currently must be specified as cudaMemAllocationTypePinned :type: cudaMemAllocationType .. attribute:: handleTypes Handle types that will be supported by allocations from the pool. :type: cudaMemAllocationHandleType .. attribute:: location Location allocations should reside. :type: cudaMemLocation .. attribute:: win32SecurityAttributes Windows-specific LPSECURITYATTRIBUTES required when cudaMemHandleTypeWin32 is specified. This security attribute defines the scope of which exported allocations may be tranferred to other processes. In all other cases, this field is required to be zero. :type: Any .. attribute:: maxSize Maximum pool size. When set to 0, defaults to a system dependent value. :type: size_t .. attribute:: usage Bitmask indicating intended usage for the pool. :type: unsigned short .. attribute:: reserved reserved for future use, must be 0 :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemPoolPtrExportData(void_ptr _ptr=0)#
Opaque data for exporting a pool allocation .. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemAllocNodeParams(void_ptr _ptr=0)#
Memory allocation node parameters .. attribute:: poolProps in: location where the allocation should reside (specified in ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is not supported. in: array of memory access descriptors. Used to describe peer GPU access :type: cudaMemPoolProps .. attribute:: accessDescs in: number of memory access descriptors. Must not exceed the number of GPUs. :type: cudaMemAccessDesc .. attribute:: accessDescCount in: Number of `accessDescs`s :type: size_t .. attribute:: bytesize in: size in bytes of the requested allocation :type: size_t .. attribute:: dptr out: address of the allocation returned by CUDA :type: Any .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemAllocNodeParamsV2(void_ptr _ptr=0)#
Memory allocation node parameters .. attribute:: poolProps in: location where the allocation should reside (specified in ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is not supported. in: array of memory access descriptors. Used to describe peer GPU access :type: cudaMemPoolProps .. attribute:: accessDescs in: number of memory access descriptors. Must not exceed the number of GPUs. :type: cudaMemAccessDesc .. attribute:: accessDescCount in: Number of `accessDescs`s :type: size_t .. attribute:: bytesize in: size in bytes of the requested allocation :type: size_t .. attribute:: dptr out: address of the allocation returned by CUDA :type: Any .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemFreeNodeParams(void_ptr _ptr=0)#
Memory free node parameters .. attribute:: dptr in: the pointer to free :type: Any .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpyAttributes(void_ptr _ptr=0)#
Attributes specific to copies within a batch. For more details on usage see cudaMemcpyBatchAsync. .. attribute:: srcAccessOrder Source access ordering to be observed for copies with this attribute. :type: cudaMemcpySrcAccessOrder .. attribute:: srcLocHint Hint location for the source operand. Ignored when the pointers are not managed memory or memory allocated outside CUDA. :type: cudaMemLocation .. attribute:: dstLocHint Hint location for the destination operand. Ignored when the pointers are not managed memory or memory allocated outside CUDA. :type: cudaMemLocation .. attribute:: flags Additional flags for copies with this attribute. See cudaMemcpyFlags. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaOffset3D(void_ptr _ptr=0)#
Struct representing offset into a cudaArray_t in elements .. attribute:: x :type: size_t .. attribute:: y :type: size_t .. attribute:: z :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpy3DOperand(void_ptr _ptr=0)#
Struct representing an operand for copy with cudaMemcpy3DBatchAsync .. attribute:: type :type: cudaMemcpy3DOperandType .. attribute:: op :type: anon_union1 .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemcpy3DBatchOp(void_ptr _ptr=0)#
.. attribute:: src Source memcpy operand. :type: cudaMemcpy3DOperand .. attribute:: dst Destination memcpy operand. :type: cudaMemcpy3DOperand .. attribute:: extent Extents of the memcpy between src and dst. The width, height and depth components must not be 0. :type: cudaExtent .. attribute:: srcAccessOrder Source access ordering to be observed for copy from src to dst. :type: cudaMemcpySrcAccessOrder .. attribute:: flags Additional flags for copy from src to dst. See cudaMemcpyFlags. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.CUuuid_st(void_ptr _ptr=0)#
.. attribute:: bytes < CUDA definition of UUID :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDeviceProp(void_ptr _ptr=0)#
CUDA device properties .. attribute:: name ASCII string identifying device :type: bytes .. attribute:: uuid 16-byte unique identifier :type: cudaUUID_t .. attribute:: luid 8-byte locally unique identifier. Value is undefined on TCC and non-Windows platforms :type: bytes .. attribute:: luidDeviceNodeMask LUID device node mask. Value is undefined on TCC and non-Windows platforms :type: unsigned int .. attribute:: totalGlobalMem Global memory available on device in bytes :type: size_t .. attribute:: sharedMemPerBlock Shared memory available per block in bytes :type: size_t .. attribute:: regsPerBlock 32-bit registers available per block :type: int .. attribute:: warpSize Warp size in threads :type: int .. attribute:: memPitch Maximum pitch in bytes allowed by memory copies :type: size_t .. attribute:: maxThreadsPerBlock Maximum number of threads per block :type: int .. attribute:: maxThreadsDim Maximum size of each dimension of a block :type: list[int] .. attribute:: maxGridSize Maximum size of each dimension of a grid :type: list[int] .. attribute:: totalConstMem Constant memory available on device in bytes :type: size_t .. attribute:: major Major compute capability :type: int .. attribute:: minor Minor compute capability :type: int .. attribute:: textureAlignment Alignment requirement for textures :type: size_t .. attribute:: texturePitchAlignment Pitch alignment requirement for texture references bound to pitched memory :type: size_t .. attribute:: multiProcessorCount Number of multiprocessors on device :type: int .. attribute:: integrated Device is integrated as opposed to discrete :type: int .. attribute:: canMapHostMemory Device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer :type: int .. attribute:: maxTexture1D Maximum 1D texture size :type: int .. attribute:: maxTexture1DMipmap Maximum 1D mipmapped texture size :type: int .. attribute:: maxTexture2D Maximum 2D texture dimensions :type: list[int] .. attribute:: maxTexture2DMipmap Maximum 2D mipmapped texture dimensions :type: list[int] .. attribute:: maxTexture2DLinear Maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory :type: list[int] .. attribute:: maxTexture2DGather Maximum 2D texture dimensions if texture gather operations have to be performed :type: list[int] .. attribute:: maxTexture3D Maximum 3D texture dimensions :type: list[int] .. attribute:: maxTexture3DAlt Maximum alternate 3D texture dimensions :type: list[int] .. attribute:: maxTextureCubemap Maximum Cubemap texture dimensions :type: int .. attribute:: maxTexture1DLayered Maximum 1D layered texture dimensions :type: list[int] .. attribute:: maxTexture2DLayered Maximum 2D layered texture dimensions :type: list[int] .. attribute:: maxTextureCubemapLayered Maximum Cubemap layered texture dimensions :type: list[int] .. attribute:: maxSurface1D Maximum 1D surface size :type: int .. attribute:: maxSurface2D Maximum 2D surface dimensions :type: list[int] .. attribute:: maxSurface3D Maximum 3D surface dimensions :type: list[int] .. attribute:: maxSurface1DLayered Maximum 1D layered surface dimensions :type: list[int] .. attribute:: maxSurface2DLayered Maximum 2D layered surface dimensions :type: list[int] .. attribute:: maxSurfaceCubemap Maximum Cubemap surface dimensions :type: int .. attribute:: maxSurfaceCubemapLayered Maximum Cubemap layered surface dimensions :type: list[int] .. attribute:: surfaceAlignment Alignment requirements for surfaces :type: size_t .. attribute:: concurrentKernels Device can possibly execute multiple kernels concurrently :type: int .. attribute:: ECCEnabled Device has ECC support enabled :type: int .. attribute:: pciBusID PCI bus ID of the device :type: int .. attribute:: pciDeviceID PCI device ID of the device :type: int .. attribute:: pciDomainID PCI domain ID of the device :type: int .. attribute:: tccDriver 1 if device is a Tesla device using TCC driver, 0 otherwise :type: int .. attribute:: asyncEngineCount Number of asynchronous engines :type: int .. attribute:: unifiedAddressing Device shares a unified address space with the host :type: int .. attribute:: memoryBusWidth Global memory bus width in bits :type: int .. attribute:: l2CacheSize Size of L2 cache in bytes :type: int .. attribute:: persistingL2CacheMaxSize Device's maximum l2 persisting lines capacity setting in bytes :type: int .. attribute:: maxThreadsPerMultiProcessor Maximum resident threads per multiprocessor :type: int .. attribute:: streamPrioritiesSupported Device supports stream priorities :type: int .. attribute:: globalL1CacheSupported Device supports caching globals in L1 :type: int .. attribute:: localL1CacheSupported Device supports caching locals in L1 :type: int .. attribute:: sharedMemPerMultiprocessor Shared memory available per multiprocessor in bytes :type: size_t .. attribute:: regsPerMultiprocessor 32-bit registers available per multiprocessor :type: int .. attribute:: managedMemory Device supports allocating managed memory on this system :type: int .. attribute:: isMultiGpuBoard Device is on a multi-GPU board :type: int .. attribute:: multiGpuBoardGroupID Unique identifier for a group of devices on the same multi-GPU board :type: int .. attribute:: hostNativeAtomicSupported Link between the device and the host supports native atomic operations :type: int .. attribute:: pageableMemoryAccess Device supports coherently accessing pageable memory without calling cudaHostRegister on it :type: int .. attribute:: concurrentManagedAccess Device can coherently access managed memory concurrently with the CPU :type: int .. attribute:: computePreemptionSupported Device supports Compute Preemption :type: int .. attribute:: canUseHostPointerForRegisteredMem Device can access host registered memory at the same virtual address as the CPU :type: int .. attribute:: cooperativeLaunch Device supports launching cooperative kernels via cudaLaunchCooperativeKernel :type: int .. attribute:: sharedMemPerBlockOptin Per device maximum shared memory per block usable by special opt in :type: size_t .. attribute:: pageableMemoryAccessUsesHostPageTables Device accesses pageable memory via the host's page tables :type: int .. attribute:: directManagedMemAccessFromHost Host can directly access managed memory on the device without migration. :type: int .. attribute:: maxBlocksPerMultiProcessor Maximum number of resident blocks per multiprocessor :type: int .. attribute:: accessPolicyMaxWindowSize The maximum value of cudaAccessPolicyWindow::num_bytes. :type: int .. attribute:: reservedSharedMemPerBlock Shared memory reserved by CUDA driver per block in bytes :type: size_t .. attribute:: hostRegisterSupported Device supports host memory registration via cudaHostRegister. :type: int .. attribute:: sparseCudaArraySupported 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise :type: int .. attribute:: hostRegisterReadOnlySupported Device supports using the cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU :type: int .. attribute:: timelineSemaphoreInteropSupported External timeline semaphore interop is supported on the device :type: int .. attribute:: memoryPoolsSupported 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise :type: int .. attribute:: gpuDirectRDMASupported 1 if the device supports GPUDirect RDMA APIs, 0 otherwise :type: int .. attribute:: gpuDirectRDMAFlushWritesOptions Bitmask to be interpreted according to the cudaFlushGPUDirectRDMAWritesOptions enum :type: unsigned int .. attribute:: gpuDirectRDMAWritesOrdering See the cudaGPUDirectRDMAWritesOrdering enum for numerical values :type: int .. attribute:: memoryPoolSupportedHandleTypes Bitmask of handle types supported with mempool-based IPC :type: unsigned int .. attribute:: deferredMappingCudaArraySupported 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays :type: int .. attribute:: ipcEventSupported Device supports IPC Events. :type: int .. attribute:: clusterLaunch Indicates device supports cluster launch :type: int .. attribute:: unifiedFunctionPointers Indicates device supports unified pointers :type: int .. attribute:: deviceNumaConfig NUMA configuration of a device: value is of type cudaDeviceNumaConfig enum :type: int .. attribute:: deviceNumaId NUMA node ID of the GPU memory :type: int .. attribute:: mpsEnabled Indicates if contexts created on this device will be shared via MPS :type: int .. attribute:: hostNumaId NUMA ID of the host node closest to the device or -1 when system does not support NUMA :type: int .. attribute:: gpuPciDeviceID The combined 16-bit PCI device ID and 16-bit PCI vendor ID :type: unsigned int .. attribute:: gpuPciSubsystemID The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID :type: unsigned int .. attribute:: hostNumaMultinodeIpcSupported 1 if the device supports HostNuma location IPC between nodes in a multi-node system. :type: int .. attribute:: reserved Reserved for future use :type: list[int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaIpcEventHandle_st(void_ptr _ptr=0)#
CUDA IPC event handle .. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaIpcMemHandle_st(void_ptr _ptr=0)#
CUDA IPC memory handle .. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemFabricHandle_st(void_ptr _ptr=0)#
.. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalMemoryHandleDesc(void_ptr _ptr=0)#
External memory handle descriptor .. attribute:: type Type of the handle :type: cudaExternalMemoryHandleType .. attribute:: handle :type: anon_union2 .. attribute:: size Size of the memory allocation :type: unsigned long long .. attribute:: flags Flags must either be zero or cudaExternalMemoryDedicated :type: unsigned int .. attribute:: reserved Must be zero :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalMemoryBufferDesc(void_ptr _ptr=0)#
External memory buffer descriptor .. attribute:: offset Offset into the memory object where the buffer's base is :type: unsigned long long .. attribute:: size Size of the buffer :type: unsigned long long .. attribute:: flags Flags reserved for future use. Must be zero. :type: unsigned int .. attribute:: reserved Must be zero :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalMemoryMipmappedArrayDesc(void_ptr _ptr=0)#
External memory mipmap descriptor .. attribute:: offset Offset into the memory object where the base level of the mipmap chain is. :type: unsigned long long .. attribute:: formatDesc Format of base level of the mipmap chain :type: cudaChannelFormatDesc .. attribute:: extent Dimensions of base level of the mipmap chain :type: cudaExtent .. attribute:: flags Flags associated with CUDA mipmapped arrays. See cudaMallocMipmappedArray :type: unsigned int .. attribute:: numLevels Total number of levels in the mipmap chain :type: unsigned int .. attribute:: reserved Must be zero :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreHandleDesc(void_ptr _ptr=0)#
External semaphore handle descriptor .. attribute:: type Type of the handle :type: cudaExternalSemaphoreHandleType .. attribute:: handle :type: anon_union3 .. attribute:: flags Flags reserved for the future. Must be zero. :type: unsigned int .. attribute:: reserved Must be zero :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreSignalParams(void_ptr _ptr=0)#
External semaphore signal parameters, compatible with driver type .. attribute:: params :type: anon_struct12 .. attribute:: flags Only when cudaExternalSemaphoreSignalParams is used to signal a cudaExternalSemaphore_t of type cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates that while signaling the cudaExternalSemaphore_t, no memory synchronization operations should be performed for any external memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For all other types of cudaExternalSemaphore_t, flags must be zero. :type: unsigned int .. attribute:: reserved :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreWaitParams(void_ptr _ptr=0)#
External semaphore wait parameters, compatible with driver type .. attribute:: params :type: anon_struct15 .. attribute:: flags Only when cudaExternalSemaphoreSignalParams is used to signal a cudaExternalSemaphore_t of type cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates that while waiting for the cudaExternalSemaphore_t, no memory synchronization operations should be performed for any external memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For all other types of cudaExternalSemaphore_t, flags must be zero. :type: unsigned int .. attribute:: reserved :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevSmResource(void_ptr _ptr=0)#
Data for SM-related resources All parameters in this structure are OUTPUT only. Do not write to any of the fields in this structure. .. attribute:: smCount The amount of streaming multiprocessors available in this resource. :type: unsigned int .. attribute:: minSmPartitionSize The minimum number of streaming multiprocessors required to partition this resource. :type: unsigned int .. attribute:: smCoscheduledAlignment The number of streaming multiprocessors in this resource that are guaranteed to be co-scheduled on the same GPU processing cluster. smCount will be a multiple of this value, unless the backfill flag is set. :type: unsigned int .. attribute:: flags The flags set on this SM resource. For available flags see cudaDevSmResourceGroup_flags. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevWorkqueueConfigResource(void_ptr _ptr=0)#
Data for workqueue configuration related resources .. attribute:: device The device on which the workqueue resources are available :type: int .. attribute:: wqConcurrencyLimit The expected maximum number of concurrent stream-ordered workloads :type: unsigned int .. attribute:: sharingScope The sharing scope for the workqueue resources :type: cudaDevWorkqueueConfigScope .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevWorkqueueResource(void_ptr _ptr=0)#
Handle to a pre-existing workqueue related resource .. attribute:: reserved Reserved for future use :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevSmResourceGroupParams_st(void_ptr _ptr=0)#
Input data for splitting SMs .. attribute:: smCount The amount of SMs available in this resource. :type: unsigned int .. attribute:: coscheduledSmCount The amount of co-scheduled SMs grouped together for locality purposes. :type: unsigned int .. attribute:: preferredCoscheduledSmCount When possible, combine co-scheduled groups together into larger groups of this size. :type: unsigned int .. attribute:: flags Combination of `cudaDevSmResourceGroup_flags` values to indicate this this group is created. :type: unsigned int .. attribute:: reserved Reserved for future use - ensure this is is zero initialized. :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevResource_st(void_ptr _ptr=0)#
A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it. struct enumcudaDevResourceTypetype; union structcudaDevSmResourcesm; structcudaDevWorkqueueConfigResourcewqConfig; structcudaDevWorkqueueResourcewq; ; ; - If `typename` is `cudaDevResourceTypeInvalid`, this resoure is not valid and cannot be further accessed. - If `typename` is `cudaDevResourceTypeSm`, the cudaDevSmResource structure `sm` is filled in. For example, `sm.smCount` will reflect the amount of streaming multiprocessors available in this resource. - If `typename` is `cudaDevResourceTypeWorkqueueConfig`, the cudaDevWorkqueueConfigResource structure `wqConfig` is filled in. - If `typename` is `cudaDevResourceTypeWorkqueue`, the cudaDevWorkqueueResource structure `wq` is filled in. .. attribute:: type Type of resource, dictates which union field was last set :type: cudaDevResourceType .. attribute:: _internal_padding :type: bytes .. attribute:: sm Resource corresponding to cudaDevResourceTypeSm `typename`. :type: cudaDevSmResource .. attribute:: wqConfig Resource corresponding to cudaDevResourceTypeWorkqueueConfig `typename`. :type: cudaDevWorkqueueConfigResource .. attribute:: wq Resource corresponding to cudaDevResourceTypeWorkqueue `typename`. :type: cudaDevWorkqueueResource .. attribute:: _oversize :type: bytes .. attribute:: nextResource :type: cudaDevResource_st .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudalibraryHostUniversalFunctionAndDataTable(void_ptr _ptr=0)#
.. attribute:: functionTable :type: Any .. attribute:: functionWindowSize :type: size_t .. attribute:: dataTable :type: Any .. attribute:: dataWindowSize :type: size_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaKernelNodeParams(void_ptr _ptr=0)#
CUDA GPU kernel node parameters .. attribute:: func Kernel to launch :type: Any .. attribute:: gridDim Grid dimensions :type: dim3 .. attribute:: blockDim Block dimensions :type: dim3 .. attribute:: sharedMemBytes Dynamic shared-memory size per thread block in bytes :type: unsigned int .. attribute:: kernelParams Array of pointers to individual kernel arguments :type: Any .. attribute:: extra Pointer to kernel arguments in the "extra" format :type: Any .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaKernelNodeParamsV2(void_ptr _ptr=0)#
CUDA GPU kernel node parameters .. attribute:: func functionType = cudaKernelFucntionTypeDevice :type: Any .. attribute:: kern functionType = cudaKernelFucntionTypeKernel :type: cudaKernel_t .. attribute:: cuFunc functionType = cudaKernelFucntionTypeFunction :type: cudaFunction_t .. attribute:: gridDim Grid dimensions :type: dim3 .. attribute:: blockDim Block dimensions :type: dim3 .. attribute:: sharedMemBytes Dynamic shared-memory size per thread block in bytes :type: unsigned int .. attribute:: kernelParams Array of pointers to individual kernel arguments :type: Any .. attribute:: extra Pointer to kernel arguments in the "extra" format :type: Any .. attribute:: ctx Context in which to run the kernel. If NULL will try to use the current context. :type: cudaExecutionContext_t .. attribute:: functionType Type of handle passed in the func/kern/cuFunc union above :type: cudaKernelFunctionType .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreSignalNodeParams(void_ptr _ptr=0)#
External semaphore signal node parameters .. attribute:: extSemArray Array of external semaphore handles. :type: cudaExternalSemaphore_t .. attribute:: paramsArray Array of external semaphore signal parameters. :type: cudaExternalSemaphoreSignalParams .. attribute:: numExtSems Number of handles and parameters supplied in extSemArray and paramsArray. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreSignalNodeParamsV2(void_ptr _ptr=0)#
External semaphore signal node parameters .. attribute:: extSemArray Array of external semaphore handles. :type: cudaExternalSemaphore_t .. attribute:: paramsArray Array of external semaphore signal parameters. :type: cudaExternalSemaphoreSignalParams .. attribute:: numExtSems Number of handles and parameters supplied in extSemArray and paramsArray. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreWaitNodeParams(void_ptr _ptr=0)#
External semaphore wait node parameters .. attribute:: extSemArray Array of external semaphore handles. :type: cudaExternalSemaphore_t .. attribute:: paramsArray Array of external semaphore wait parameters. :type: cudaExternalSemaphoreWaitParams .. attribute:: numExtSems Number of handles and parameters supplied in extSemArray and paramsArray. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphoreWaitNodeParamsV2(void_ptr _ptr=0)#
External semaphore wait node parameters .. attribute:: extSemArray Array of external semaphore handles. :type: cudaExternalSemaphore_t .. attribute:: paramsArray Array of external semaphore wait parameters. :type: cudaExternalSemaphoreWaitParams .. attribute:: numExtSems Number of handles and parameters supplied in extSemArray and paramsArray. :type: unsigned int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaConditionalNodeParams(void_ptr _ptr=0)#
CUDA conditional node parameters .. attribute:: handle Conditional node handle. Handles must be created in advance of creating the node using cudaGraphConditionalHandleCreate. :type: cudaGraphConditionalHandle .. attribute:: type Type of conditional node. :type: cudaGraphConditionalNodeType .. attribute:: size Size of graph output array. Allowed values are 1 for cudaGraphCondTypeWhile, 1 or 2 for cudaGraphCondTypeIf, or any value greater than zero for cudaGraphCondTypeSwitch. :type: unsigned int .. attribute:: phGraph_out CUDA-owned array populated with conditional node child graphs during creation of the node. Valid for the lifetime of the conditional node. The contents of the graph(s) are subject to the following constraints: - Allowed node types are kernel nodes, empty nodes, child graphs, memsets, memcopies, and conditionals. This applies recursively to child graphs and conditional bodies. - All kernels, including kernels in nested conditionals or child graphs at any level, must belong to the same CUDA context. These graphs may be populated using graph node creation APIs or cudaStreamBeginCaptureToGraph. cudaGraphCondTypeIf: phGraph_out[0] is executed when the condition is non-zero. If `size` == 2, phGraph_out[1] will be executed when the condition is zero. cudaGraphCondTypeWhile: phGraph_out[0] is executed as long as the condition is non-zero. cudaGraphCondTypeSwitch: phGraph_out[n] is executed when the condition is equal to n. If the condition >= `size`, no body graph is executed. :type: cudaGraph_t .. attribute:: ctx CUDA Execution Context :type: cudaExecutionContext_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaChildGraphNodeParams(void_ptr _ptr=0)#
Child graph node parameters .. attribute:: graph The child graph to clone into the node for node creation, or a handle to the graph owned by the node for node query. The graph must not contain conditional nodes. Graphs containing memory allocation or memory free nodes must set the ownership to be moved to the parent. :type: cudaGraph_t .. attribute:: ownership The ownership relationship of the child graph node. :type: cudaGraphChildGraphNodeOwnership .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEventRecordNodeParams(void_ptr _ptr=0)#
Event record node parameters .. attribute:: event The event to record when the node executes :type: cudaEvent_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEventWaitNodeParams(void_ptr _ptr=0)#
Event wait node parameters .. attribute:: event The event to wait on from the node :type: cudaEvent_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphNodeParams(void_ptr _ptr=0)#
Graph node parameters. See cudaGraphAddNode. .. attribute:: type Type of the node :type: cudaGraphNodeType .. attribute:: reserved0 Reserved. Must be zero. :type: list[int] .. attribute:: reserved1 Padding. Unused bytes must be zero. :type: list[long long] .. attribute:: kernel Kernel node parameters. :type: cudaKernelNodeParamsV2 .. attribute:: memcpy Memcpy node parameters. :type: cudaMemcpyNodeParams .. attribute:: memset Memset node parameters. :type: cudaMemsetParamsV2 .. attribute:: host Host node parameters. :type: cudaHostNodeParamsV2 .. attribute:: graph Child graph node parameters. :type: cudaChildGraphNodeParams .. attribute:: eventWait Event wait node parameters. :type: cudaEventWaitNodeParams .. attribute:: eventRecord Event record node parameters. :type: cudaEventRecordNodeParams .. attribute:: extSemSignal External semaphore signal node parameters. :type: cudaExternalSemaphoreSignalNodeParamsV2 .. attribute:: extSemWait External semaphore wait node parameters. :type: cudaExternalSemaphoreWaitNodeParamsV2 .. attribute:: alloc Memory allocation node parameters. :type: cudaMemAllocNodeParamsV2 .. attribute:: free Memory free node parameters. :type: cudaMemFreeNodeParams .. attribute:: conditional Conditional node parameters. :type: cudaConditionalNodeParams .. attribute:: reserved2 Reserved bytes. Must be zero. :type: long long .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphEdgeData_st(void_ptr _ptr=0)#
Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and default to a zero-initialized value if not specified. A zero-initialized struct indicates a standard full serialization of two nodes with memory visibility. .. attribute:: from_port This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value of 0 in all cases means full completion of the upstream node, with memory visibility to the downstream node or portion thereof (indicated by `to_port`). Only kernel nodes define non-zero ports. A kernel node can use the following output port types: cudaGraphKernelNodePortDefault, cudaGraphKernelNodePortProgrammatic, or cudaGraphKernelNodePortLaunchCompletion. :type: bytes .. attribute:: to_port This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). The meaning is specific to the node type. A value of 0 in all cases means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. :type: bytes .. attribute:: type This should be populated with a value from cudaGraphDependencyType. (It is typed as char due to compiler-specific layout of bitfields.) See cudaGraphDependencyType. :type: bytes .. attribute:: reserved These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphInstantiateParams_st(void_ptr _ptr=0)#
Graph instantiation parameters .. attribute:: flags Instantiation flags :type: unsigned long long .. attribute:: uploadStream Upload stream :type: cudaStream_t .. attribute:: errNode_out The node which caused instantiation to fail, if any :type: cudaGraphNode_t .. attribute:: result_out Whether instantiation was successful. If it failed, the reason why :type: cudaGraphInstantiateResult .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphExecUpdateResultInfo_st(void_ptr _ptr=0)#
Result information returned by cudaGraphExecUpdate .. attribute:: result Gives more specific detail when a cuda graph update fails. :type: cudaGraphExecUpdateResult .. attribute:: errorNode The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. :type: cudaGraphNode_t .. attribute:: errorFromNode The from node of error edge when the topologies do not match. Otherwise NULL. :type: cudaGraphNode_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphKernelNodeUpdate(void_ptr _ptr=0)#
Struct to specify a single node update to pass as part of a larger array to ::cudaGraphKernelNodeUpdatesApply .. attribute:: node Node to update :type: cudaGraphDeviceNode_t .. attribute:: field Which type of update to apply. Determines how updateData is interpreted :type: cudaGraphKernelNodeField .. attribute:: updateData Update data to apply. Which field is used depends on field's value :type: anon_union9 .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchMemSyncDomainMap_st(void_ptr _ptr=0)#
Memory Synchronization Domain map See cudaLaunchMemSyncDomain. By default, kernels are launched in domain 0. Kernel launched with cudaLaunchMemSyncDomainRemote will have a different domain ID. User may also alter the domain ID with cudaLaunchMemSyncDomainMap for a specific stream / graph node / kernel launch. See cudaLaunchAttributeMemSyncDomainMap. Domain ID range is available through cudaDevAttrMemSyncDomainCount. .. attribute:: default_ The default domain ID to use for designated kernels :type: bytes .. attribute:: remote The remote domain ID to use for designated kernels :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchAttributeValue(void_ptr _ptr=0)#
Launch attributes union; used as value field of cudaLaunchAttribute .. attribute:: pad :type: bytes .. attribute:: accessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. :type: cudaAccessPolicyWindow .. attribute:: cooperative Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). :type: int .. attribute:: syncPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. cudaSynchronizationPolicy for work queued up in this stream. :type: cudaSynchronizationPolicy .. attribute:: clusterDim Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the cluster, in blocks. Must be a divisor of the grid X dimension. - `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. :type: anon_struct17 .. attribute:: clusterSchedulingPolicyPreference Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. :type: cudaClusterSchedulingPolicy .. attribute:: programmaticStreamSerializationAllowed Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. :type: int .. attribute:: programmaticEvent Value of launch attribute cudaLaunchAttributeProgrammaticEvent with the following fields: - `cudaEvent_t` event - Event to fire when all blocks trigger it. - `int` flags; - Event record flags, see ::cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. - `int` triggerAtBlockStart - If this is set to non-0, each block launch will automatically trigger the event. :type: anon_struct18 .. attribute:: priority Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. :type: int .. attribute:: memSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See cudaLaunchMemSyncDomainMap. :type: cudaLaunchMemSyncDomainMap .. attribute:: memSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. :type: cudaLaunchMemSyncDomain .. attribute:: preferredClusterDim Value of launch attribute cudaLaunchAttributePreferredClusterDimension that represents the desired preferred cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the preferred cluster, in blocks. Must be a divisor of the grid X dimension, and must be a multiple of the `x` field of ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension of the preferred cluster, in blocks. Must be a divisor of the grid Y dimension, and must be a multiple of the `y` field of ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension of the preferred cluster, in blocks. Must be equal to the `z` field of ::cudaLaunchAttributeValue::clusterDim. :type: anon_struct19 .. attribute:: launchCompletionEvent Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent with the following fields: - `cudaEvent_t` event - Event to fire when the last block launches. - `int` flags - Event record flags, see ::cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. :type: anon_struct20 .. attribute:: deviceUpdatableKernelNode Value of launch attribute cudaLaunchAttributeDeviceUpdatableKernelNode with the following fields: - `int` deviceUpdatable - Whether or not the resulting kernel node should be device-updatable. - `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the various device-side update functions. :type: anon_struct21 .. attribute:: sharedMemCarveout Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. :type: unsigned int .. attribute:: nvlinkUtilCentricScheduling Value of launch attribute cudaLaunchAttributeNvlinkUtilCentricScheduling. :type: unsigned int .. attribute:: portableClusterSizeMode Value of launch attribute cudaLaunchAttributePortableClusterSizeMode :type: cudaLaunchAttributePortableClusterMode .. attribute:: sharedMemoryMode Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See cudaSharedMemoryMode for acceptable values. :type: cudaSharedMemoryMode .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchAttribute_st(void_ptr _ptr=0)#
Launch attribute .. attribute:: id Attribute to set :type: cudaLaunchAttributeID .. attribute:: val Value of the attribute :type: cudaLaunchAttributeValue .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaAsyncNotificationInfo(void_ptr _ptr=0)#
Information describing an async notification event .. attribute:: type The type of notification being sent :type: cudaAsyncNotificationType .. attribute:: info Information about the notification. `typename` must be checked in order to interpret this field. :type: anon_union10 .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaTextureDesc(void_ptr _ptr=0)#
CUDA texture descriptor .. attribute:: addressMode Texture address mode for up to 3 dimensions :type: list[cudaTextureAddressMode] .. attribute:: filterMode Texture filter mode :type: cudaTextureFilterMode .. attribute:: readMode Texture read mode :type: cudaTextureReadMode .. attribute:: sRGB Perform sRGB->linear conversion during texture read :type: int .. attribute:: borderColor Texture Border Color :type: list[float] .. attribute:: normalizedCoords Indicates whether texture reads are normalized or not :type: int .. attribute:: maxAnisotropy Limit to the anisotropy ratio :type: unsigned int .. attribute:: mipmapFilterMode Mipmap filter mode :type: cudaTextureFilterMode .. attribute:: mipmapLevelBias Offset applied to the supplied mipmap level :type: float .. attribute:: minMipmapLevelClamp Lower end of the mipmap level range to clamp access to :type: float .. attribute:: maxMipmapLevelClamp Upper end of the mipmap level range to clamp access to :type: float .. attribute:: disableTrilinearOptimization Disable any trilinear filtering optimizations. :type: int .. attribute:: seamlessCubemap Enable seamless cube map filtering. :type: int .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEglPlaneDesc_st(void_ptr _ptr=0)#
CUDA EGL Plane Descriptor - structure defining each plane of a CUDA EGLFrame .. attribute:: width Width of plane :type: unsigned int .. attribute:: height Height of plane :type: unsigned int .. attribute:: depth Depth of plane :type: unsigned int .. attribute:: pitch Pitch of plane :type: unsigned int .. attribute:: numChannels Number of channels for the plane :type: unsigned int .. attribute:: channelDesc Channel Format Descriptor :type: cudaChannelFormatDesc .. attribute:: reserved Reserved for future use :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEglFrame_st(void_ptr _ptr=0)#
CUDA EGLFrame Descriptor - structure defining one frame of EGL. Each frame may contain one or more planes depending on whether the surface is Multiplanar or not. Each plane of EGLFrame is represented by cudaEglPlaneDesc which is defined as: typedefstructcudaEglPlaneDesc_st unsignedintwidth; unsignedintheight; unsignedintdepth; unsignedintpitch; unsignedintnumChannels; structcudaChannelFormatDescchannelDesc; unsignedintreserved[4]; cudaEglPlaneDesc; .. attribute:: frame :type: anon_union11 .. attribute:: planeDesc CUDA EGL Plane Descriptor cudaEglPlaneDesc :type: list[cudaEglPlaneDesc] .. attribute:: planeCount Number of planes :type: unsigned int .. attribute:: frameType Array or Pitch :type: cudaEglFrameType .. attribute:: eglColorFormat CUDA EGL Color Format :type: cudaEglColorFormat .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaError_t(value: int)#
impl_private CUDA error types
- cudaSuccess = <cudaError_t.cudaSuccess: 0>#
The API call returned with no errors. In the case of query calls, this also means that the operation being queried is complete (see
cudaEventQuery()andcudaStreamQuery()).
- cudaErrorInvalidValue = <cudaError_t.cudaErrorInvalidValue: 1>#
This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
- cudaErrorMemoryAllocation = <cudaError_t.cudaErrorMemoryAllocation: 2>#
The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation.
- cudaErrorInitializationError = <cudaError_t.cudaErrorInitializationError: 3>#
The API call failed because the CUDA driver and runtime could not be initialized.
- cudaErrorCudartUnloading = <cudaError_t.cudaErrorCudartUnloading: 4>#
This indicates that a CUDA Runtime API call cannot be executed because it is being called during process shut down, at a point in time after CUDA driver has been unloaded.
- cudaErrorProfilerDisabled = <cudaError_t.cudaErrorProfilerDisabled: 5>#
This indicates profiler is not initialized for this run. This can happen when the application is running with external profiling tools like visual profiler.
- cudaErrorProfilerNotInitialized = <cudaError_t.cudaErrorProfilerNotInitialized: 6>#
[Deprecated]
- cudaErrorProfilerAlreadyStarted = <cudaError_t.cudaErrorProfilerAlreadyStarted: 7>#
[Deprecated]
- cudaErrorProfilerAlreadyStopped = <cudaError_t.cudaErrorProfilerAlreadyStopped: 8>#
[Deprecated]
- cudaErrorInvalidConfiguration = <cudaError_t.cudaErrorInvalidConfiguration: 9>#
This indicates that a kernel launch is requesting resources that can never be satisfied by the current device. Requesting more shared memory per block than the device supports will trigger this error, as will requesting too many threads or blocks. See
cudaDevicePropfor more device limitations.
- cudaErrorVersionTranslation = <cudaError_t.cudaErrorVersionTranslation: 10>#
This indicates that the driver is newer than the runtime version and returned graph node parameter information that the runtime does not understand and is unable to translate.
- cudaErrorInvalidPitchValue = <cudaError_t.cudaErrorInvalidPitchValue: 12>#
This indicates that one or more of the pitch-related parameters passed to the API call is not within the acceptable range for pitch.
- cudaErrorInvalidSymbol = <cudaError_t.cudaErrorInvalidSymbol: 13>#
This indicates that the symbol name/identifier passed to the API call is not a valid name or identifier.
- cudaErrorInvalidHostPointer = <cudaError_t.cudaErrorInvalidHostPointer: 16>#
This indicates that at least one host pointer passed to the API call is not a valid host pointer. [Deprecated]
- cudaErrorInvalidDevicePointer = <cudaError_t.cudaErrorInvalidDevicePointer: 17>#
This indicates that at least one device pointer passed to the API call is not a valid device pointer. [Deprecated]
- cudaErrorInvalidTexture = <cudaError_t.cudaErrorInvalidTexture: 18>#
This indicates that the texture passed to the API call is not a valid texture.
- cudaErrorInvalidTextureBinding = <cudaError_t.cudaErrorInvalidTextureBinding: 19>#
This indicates that the texture binding is not valid. This occurs if you call
cudaGetTextureAlignmentOffset()with an unbound texture.
- cudaErrorInvalidChannelDescriptor = <cudaError_t.cudaErrorInvalidChannelDescriptor: 20>#
This indicates that the channel descriptor passed to the API call is not valid. This occurs if the format is not one of the formats specified by
cudaChannelFormatKind, or if one of the dimensions is invalid.
- cudaErrorInvalidMemcpyDirection = <cudaError_t.cudaErrorInvalidMemcpyDirection: 21>#
This indicates that the direction of the memcpy passed to the API call is not one of the types specified by
cudaMemcpyKind.
- cudaErrorAddressOfConstant = <cudaError_t.cudaErrorAddressOfConstant: 22>#
This indicated that the user has taken the address of a constant variable, which was forbidden up until the CUDA 3.1 release. [Deprecated]
- cudaErrorTextureFetchFailed = <cudaError_t.cudaErrorTextureFetchFailed: 23>#
This indicated that a texture fetch was not able to be performed. This was previously used for device emulation of texture operations. [Deprecated]
- cudaErrorTextureNotBound = <cudaError_t.cudaErrorTextureNotBound: 24>#
This indicated that a texture was not bound for access. This was previously used for device emulation of texture operations. [Deprecated]
- cudaErrorSynchronizationError = <cudaError_t.cudaErrorSynchronizationError: 25>#
This indicated that a synchronization operation had failed. This was previously used for some device emulation functions. [Deprecated]
- cudaErrorInvalidFilterSetting = <cudaError_t.cudaErrorInvalidFilterSetting: 26>#
This indicates that a non-float texture was being accessed with linear filtering. This is not supported by CUDA.
- cudaErrorInvalidNormSetting = <cudaError_t.cudaErrorInvalidNormSetting: 27>#
This indicates that an attempt was made to read an unsupported data type as a normalized float. This is not supported by CUDA.
- cudaErrorMixedDeviceExecution = <cudaError_t.cudaErrorMixedDeviceExecution: 28>#
Mixing of device and device emulation code was not allowed. [Deprecated]
- cudaErrorNotYetImplemented = <cudaError_t.cudaErrorNotYetImplemented: 31>#
This indicates that the API call is not yet implemented. Production releases of CUDA will never return this error. [Deprecated]
- cudaErrorMemoryValueTooLarge = <cudaError_t.cudaErrorMemoryValueTooLarge: 32>#
This indicated that an emulated device pointer exceeded the 32-bit address range. [Deprecated]
- cudaErrorStubLibrary = <cudaError_t.cudaErrorStubLibrary: 34>#
This indicates that the CUDA driver that the application has loaded is a stub library. Applications that run with the stub rather than a real driver loaded will result in CUDA API returning this error.
- cudaErrorInsufficientDriver = <cudaError_t.cudaErrorInsufficientDriver: 35>#
This indicates that the installed NVIDIA CUDA driver is older than the CUDA runtime library. This is not a supported configuration. Users should install an updated NVIDIA display driver to allow the application to run.
- cudaErrorCallRequiresNewerDriver = <cudaError_t.cudaErrorCallRequiresNewerDriver: 36>#
This indicates that the API call requires a newer CUDA driver than the one currently installed. Users should install an updated NVIDIA CUDA driver to allow the API call to succeed.
- cudaErrorInvalidSurface = <cudaError_t.cudaErrorInvalidSurface: 37>#
This indicates that the surface passed to the API call is not a valid surface.
- cudaErrorDuplicateVariableName = <cudaError_t.cudaErrorDuplicateVariableName: 43>#
This indicates that multiple global or constant variables (across separate CUDA source files in the application) share the same string name.
- cudaErrorDuplicateTextureName = <cudaError_t.cudaErrorDuplicateTextureName: 44>#
This indicates that multiple textures (across separate CUDA source files in the application) share the same string name.
- cudaErrorDuplicateSurfaceName = <cudaError_t.cudaErrorDuplicateSurfaceName: 45>#
This indicates that multiple surfaces (across separate CUDA source files in the application) share the same string name.
This indicates that all CUDA devices are busy or unavailable at the current time. Devices are often busy/unavailable due to use of
cudaComputeModeProhibited,cudaComputeModeExclusiveProcess, or when long running CUDA kernels have filled up the GPU and are blocking new work from starting. They can also be unavailable due to memory constraints on a device that already has active CUDA work being performed.
- cudaErrorIncompatibleDriverContext = <cudaError_t.cudaErrorIncompatibleDriverContext: 49>#
This indicates that the current context is not compatible with this the CUDA Runtime. This can only occur if you are using CUDA Runtime/Driver interoperability and have created an existing Driver context using the driver API. The Driver context may be incompatible either because the Driver context was created using an older version of the API, because the Runtime API call expects a primary driver context and the Driver context is not primary, or because the Driver context has been destroyed. Please see :py:obj:`~.Interactions`with the CUDA Driver API” for more information.
- cudaErrorMissingConfiguration = <cudaError_t.cudaErrorMissingConfiguration: 52>#
The device function being invoked (usually via
cudaLaunchKernel()) was not previously configured via thecudaConfigureCall()function.
- cudaErrorPriorLaunchFailure = <cudaError_t.cudaErrorPriorLaunchFailure: 53>#
This indicated that a previous kernel launch failed. This was previously used for device emulation of kernel launches. [Deprecated]
- cudaErrorLaunchMaxDepthExceeded = <cudaError_t.cudaErrorLaunchMaxDepthExceeded: 65>#
This error indicates that a device runtime grid launch did not occur because the depth of the child grid would exceed the maximum supported number of nested grid launches.
- cudaErrorLaunchFileScopedTex = <cudaError_t.cudaErrorLaunchFileScopedTex: 66>#
This error indicates that a grid launch did not occur because the kernel uses file-scoped textures which are unsupported by the device runtime. Kernels launched via the device runtime only support textures created with the Texture Object API’s.
- cudaErrorLaunchFileScopedSurf = <cudaError_t.cudaErrorLaunchFileScopedSurf: 67>#
This error indicates that a grid launch did not occur because the kernel uses file-scoped surfaces which are unsupported by the device runtime. Kernels launched via the device runtime only support surfaces created with the Surface Object API’s.
- cudaErrorSyncDepthExceeded = <cudaError_t.cudaErrorSyncDepthExceeded: 68>#
This error indicates that a call to
cudaDeviceSynchronizemade from the device runtime failed because the call was made at grid depth greater than than either the default (2 levels of grids) or user specified device limitcudaLimitDevRuntimeSyncDepth. To be able to synchronize on launched grids at a greater depth successfully, the maximum nested depth at whichcudaDeviceSynchronizewill be called must be specified with thecudaLimitDevRuntimeSyncDepthlimit to thecudaDeviceSetLimitapi before the host-side launch of a kernel using the device runtime. Keep in mind that additional levels of sync depth require the runtime to reserve large amounts of device memory that cannot be used for user allocations. Note thatcudaDeviceSynchronizemade from device runtime is only supported on devices of compute capability < 9.0.
- cudaErrorLaunchPendingCountExceeded = <cudaError_t.cudaErrorLaunchPendingCountExceeded: 69>#
This error indicates that a device runtime grid launch failed because the launch would exceed the limit
cudaLimitDevRuntimePendingLaunchCount. For this launch to proceed successfully,cudaDeviceSetLimitmust be called to set thecudaLimitDevRuntimePendingLaunchCountto be higher than the upper bound of outstanding launches that can be issued to the device runtime. Keep in mind that raising the limit of pending device runtime launches will require the runtime to reserve device memory that cannot be used for user allocations.
- cudaErrorInvalidDeviceFunction = <cudaError_t.cudaErrorInvalidDeviceFunction: 98>#
The requested device function does not exist or is not compiled for the proper device architecture.
- cudaErrorNoDevice = <cudaError_t.cudaErrorNoDevice: 100>#
This indicates that no CUDA-capable devices were detected by the installed CUDA driver.
- cudaErrorInvalidDevice = <cudaError_t.cudaErrorInvalidDevice: 101>#
This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device or that the action requested is invalid for the specified device.
- cudaErrorDeviceNotLicensed = <cudaError_t.cudaErrorDeviceNotLicensed: 102>#
This indicates that the device doesn’t have a valid Grid License.
- cudaErrorSoftwareValidityNotEstablished = <cudaError_t.cudaErrorSoftwareValidityNotEstablished: 103>#
By default, the CUDA runtime may perform a minimal set of self-tests, as well as CUDA driver tests, to establish the validity of both. Introduced in CUDA 11.2, this error return indicates that at least one of these tests has failed and the validity of either the runtime or the driver could not be established.
- cudaErrorStartupFailure = <cudaError_t.cudaErrorStartupFailure: 127>#
This indicates an internal startup failure in the CUDA runtime.
- cudaErrorInvalidKernelImage = <cudaError_t.cudaErrorInvalidKernelImage: 200>#
This indicates that the device kernel image is invalid.
- cudaErrorDeviceUninitialized = <cudaError_t.cudaErrorDeviceUninitialized: 201>#
This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had
cuCtxDestroy()invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). SeecuCtxGetApiVersion()for more details.
- cudaErrorMapBufferObjectFailed = <cudaError_t.cudaErrorMapBufferObjectFailed: 205>#
This indicates that the buffer object could not be mapped.
- cudaErrorUnmapBufferObjectFailed = <cudaError_t.cudaErrorUnmapBufferObjectFailed: 206>#
This indicates that the buffer object could not be unmapped.
- cudaErrorArrayIsMapped = <cudaError_t.cudaErrorArrayIsMapped: 207>#
This indicates that the specified array is currently mapped and thus cannot be destroyed.
- cudaErrorAlreadyMapped = <cudaError_t.cudaErrorAlreadyMapped: 208>#
This indicates that the resource is already mapped.
- cudaErrorNoKernelImageForDevice = <cudaError_t.cudaErrorNoKernelImageForDevice: 209>#
This indicates that there is no kernel image available that is suitable for the device. This can occur when a user specifies code generation options for a particular CUDA source file that do not include the corresponding device configuration.
- cudaErrorAlreadyAcquired = <cudaError_t.cudaErrorAlreadyAcquired: 210>#
This indicates that a resource has already been acquired.
- cudaErrorNotMapped = <cudaError_t.cudaErrorNotMapped: 211>#
This indicates that a resource is not mapped.
- cudaErrorNotMappedAsArray = <cudaError_t.cudaErrorNotMappedAsArray: 212>#
This indicates that a mapped resource is not available for access as an array.
- cudaErrorNotMappedAsPointer = <cudaError_t.cudaErrorNotMappedAsPointer: 213>#
This indicates that a mapped resource is not available for access as a pointer.
- cudaErrorECCUncorrectable = <cudaError_t.cudaErrorECCUncorrectable: 214>#
This indicates that an uncorrectable ECC error was detected during execution.
- cudaErrorUnsupportedLimit = <cudaError_t.cudaErrorUnsupportedLimit: 215>#
This indicates that the
cudaLimitpassed to the API call is not supported by the active device.
- cudaErrorDeviceAlreadyInUse = <cudaError_t.cudaErrorDeviceAlreadyInUse: 216>#
This indicates that a call tried to access an exclusive-thread device that is already in use by a different thread.
- cudaErrorPeerAccessUnsupported = <cudaError_t.cudaErrorPeerAccessUnsupported: 217>#
This error indicates that P2P access is not supported across the given devices.
- cudaErrorInvalidPtx = <cudaError_t.cudaErrorInvalidPtx: 218>#
A PTX compilation failed. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device.
- cudaErrorInvalidGraphicsContext = <cudaError_t.cudaErrorInvalidGraphicsContext: 219>#
This indicates an error with the OpenGL or DirectX context.
- cudaErrorNvlinkUncorrectable = <cudaError_t.cudaErrorNvlinkUncorrectable: 220>#
This indicates that an uncorrectable NVLink error was detected during the execution.
- cudaErrorJitCompilerNotFound = <cudaError_t.cudaErrorJitCompilerNotFound: 221>#
This indicates that the PTX JIT compiler library was not found. The JIT Compiler library is used for PTX compilation. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device.
- cudaErrorUnsupportedPtxVersion = <cudaError_t.cudaErrorUnsupportedPtxVersion: 222>#
This indicates that the provided PTX was compiled with an unsupported toolchain. The most common reason for this, is the PTX was generated by a compiler newer than what is supported by the CUDA driver and PTX JIT compiler.
- cudaErrorJitCompilationDisabled = <cudaError_t.cudaErrorJitCompilationDisabled: 223>#
This indicates that the JIT compilation was disabled. The JIT compilation compiles PTX. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device.
- cudaErrorUnsupportedExecAffinity = <cudaError_t.cudaErrorUnsupportedExecAffinity: 224>#
This indicates that the provided execution affinity is not supported by the device.
- cudaErrorUnsupportedDevSideSync = <cudaError_t.cudaErrorUnsupportedDevSideSync: 225>#
This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize.
- cudaErrorContained = <cudaError_t.cudaErrorContained: 226>#
This indicates that an exception occurred on the device that is now contained by the GPU’s error containment capability. Common causes are - a. Certain types of invalid accesses of peer GPU memory over nvlink b. Certain classes of hardware errors This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorInvalidSource = <cudaError_t.cudaErrorInvalidSource: 300>#
This indicates that the device kernel source is invalid.
- cudaErrorFileNotFound = <cudaError_t.cudaErrorFileNotFound: 301>#
This indicates that the file specified was not found.
This indicates that a link to a shared object failed to resolve.
This indicates that initialization of a shared object failed.
- cudaErrorOperatingSystem = <cudaError_t.cudaErrorOperatingSystem: 304>#
This error indicates that an OS call failed.
- cudaErrorInvalidResourceHandle = <cudaError_t.cudaErrorInvalidResourceHandle: 400>#
This indicates that a resource handle passed to the API call was not valid. Resource handles are opaque types like
cudaStream_tandcudaEvent_t.
- cudaErrorIllegalState = <cudaError_t.cudaErrorIllegalState: 401>#
This indicates that a resource required by the API call is not in a valid state to perform the requested operation.
- cudaErrorLossyQuery = <cudaError_t.cudaErrorLossyQuery: 402>#
This indicates an attempt was made to introspect an object in a way that would discard semantically important information. This is either due to the object using funtionality newer than the API version used to introspect it or omission of optional return arguments.
- cudaErrorSymbolNotFound = <cudaError_t.cudaErrorSymbolNotFound: 500>#
This indicates that a named symbol was not found. Examples of symbols are global/constant variable names, driver function names, texture names, and surface names.
- cudaErrorNotReady = <cudaError_t.cudaErrorNotReady: 600>#
This indicates that asynchronous operations issued previously have not completed yet. This result is not actually an error, but must be indicated differently than
cudaSuccess(which indicates completion). Calls that may return this value includecudaEventQuery()andcudaStreamQuery().
- cudaErrorIllegalAddress = <cudaError_t.cudaErrorIllegalAddress: 700>#
The device encountered a load or store instruction on an invalid memory address. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorLaunchOutOfResources = <cudaError_t.cudaErrorLaunchOutOfResources: 701>#
This indicates that a launch did not occur because it did not have appropriate resources. Although this error is similar to
cudaErrorInvalidConfiguration, this error usually indicates that the user has attempted to pass too many arguments to the device kernel, or the kernel launch specifies too many threads for the kernel’s register count.
- cudaErrorLaunchTimeout = <cudaError_t.cudaErrorLaunchTimeout: 702>#
This indicates that the device kernel took too long to execute. This can only occur if timeouts are enabled - see the device attribute
cudaDevAttrKernelExecTimeoutfor more information. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorLaunchIncompatibleTexturing = <cudaError_t.cudaErrorLaunchIncompatibleTexturing: 703>#
This error indicates a kernel launch that uses an incompatible texturing mode.
- cudaErrorPeerAccessAlreadyEnabled = <cudaError_t.cudaErrorPeerAccessAlreadyEnabled: 704>#
This error indicates that a call to
cudaDeviceEnablePeerAccess()is trying to re-enable peer addressing on from a context which has already had peer addressing enabled.
- cudaErrorPeerAccessNotEnabled = <cudaError_t.cudaErrorPeerAccessNotEnabled: 705>#
This error indicates that
cudaDeviceDisablePeerAccess()is trying to disable peer addressing which has not been enabled yet viacudaDeviceEnablePeerAccess().
- cudaErrorSetOnActiveProcess = <cudaError_t.cudaErrorSetOnActiveProcess: 708>#
This indicates that the user has called
cudaSetValidDevices(),cudaSetDeviceFlags(),cudaD3D9SetDirect3DDevice(),cudaD3D10SetDirect3DDevice,cudaD3D11SetDirect3DDevice(), orcudaVDPAUSetVDPAUDevice()after initializing the CUDA runtime by calling non-device management operations (allocating memory and launching kernels are examples of non-device management operations). This error can also be returned if using runtime/driver interoperability and there is an existingCUcontextactive on the host thread.
- cudaErrorContextIsDestroyed = <cudaError_t.cudaErrorContextIsDestroyed: 709>#
This error indicates that the context current to the calling thread has been destroyed using
cuCtxDestroy, or is a primary context which has not yet been initialized.
- cudaErrorAssert = <cudaError_t.cudaErrorAssert: 710>#
An assert triggered in device code during kernel execution. The device cannot be used again. All existing allocations are invalid. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorTooManyPeers = <cudaError_t.cudaErrorTooManyPeers: 711>#
This error indicates that the hardware resources required to enable peer access have been exhausted for one or more of the devices passed to
cudaEnablePeerAccess().
- cudaErrorHostMemoryAlreadyRegistered = <cudaError_t.cudaErrorHostMemoryAlreadyRegistered: 712>#
This error indicates that the memory range passed to
cudaHostRegister()has already been registered.
- cudaErrorHostMemoryNotRegistered = <cudaError_t.cudaErrorHostMemoryNotRegistered: 713>#
This error indicates that the pointer passed to
cudaHostUnregister()does not correspond to any currently registered memory region.
- cudaErrorHardwareStackError = <cudaError_t.cudaErrorHardwareStackError: 714>#
Device encountered an error in the call stack during kernel execution, possibly due to stack corruption or exceeding the stack size limit. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorIllegalInstruction = <cudaError_t.cudaErrorIllegalInstruction: 715>#
The device encountered an illegal instruction during kernel execution This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorMisalignedAddress = <cudaError_t.cudaErrorMisalignedAddress: 716>#
The device encountered a load or store instruction on a memory address which is not aligned. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorInvalidAddressSpace = <cudaError_t.cudaErrorInvalidAddressSpace: 717>#
While executing a kernel, the device encountered an instruction which can only operate on memory locations in certain address spaces (global, shared, or local), but was supplied a memory address not belonging to an allowed address space. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorInvalidPc = <cudaError_t.cudaErrorInvalidPc: 718>#
The device encountered an invalid program counter. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorLaunchFailure = <cudaError_t.cudaErrorLaunchFailure: 719>#
An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorCooperativeLaunchTooLarge = <cudaError_t.cudaErrorCooperativeLaunchTooLarge: 720>#
This error indicates that the number of blocks launched per grid for a kernel that was launched via either
cudaLaunchCooperativeKernelexceeds the maximum number of blocks as allowed bycudaOccupancyMaxActiveBlocksPerMultiprocessororcudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlagstimes the number of multiprocessors as specified by the device attributecudaDevAttrMultiProcessorCount.
- cudaErrorTensorMemoryLeak = <cudaError_t.cudaErrorTensorMemoryLeak: 721>#
An exception occurred on the device while exiting a kernel using tensor memory: the tensor memory was not completely deallocated. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorNotPermitted = <cudaError_t.cudaErrorNotPermitted: 800>#
This error indicates the attempted operation is not permitted.
- cudaErrorNotSupported = <cudaError_t.cudaErrorNotSupported: 801>#
This error indicates the attempted operation is not supported on the current system or device.
- cudaErrorSystemNotReady = <cudaError_t.cudaErrorSystemNotReady: 802>#
This error indicates that the system is not yet ready to start any CUDA work. To continue using CUDA, verify the system configuration is in a valid state and all required driver daemons are actively running. More information about this error can be found in the system specific user guide.
- cudaErrorSystemDriverMismatch = <cudaError_t.cudaErrorSystemDriverMismatch: 803>#
This error indicates that there is a mismatch between the versions of the display driver and the CUDA driver. Refer to the compatibility documentation for supported versions.
- cudaErrorCompatNotSupportedOnDevice = <cudaError_t.cudaErrorCompatNotSupportedOnDevice: 804>#
This error indicates that the system was upgraded to run with forward compatibility but the visible hardware detected by CUDA does not support this configuration. Refer to the compatibility documentation for the supported hardware matrix or ensure that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES environment variable.
- cudaErrorMpsConnectionFailed = <cudaError_t.cudaErrorMpsConnectionFailed: 805>#
This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server.
- cudaErrorMpsRpcFailure = <cudaError_t.cudaErrorMpsRpcFailure: 806>#
This error indicates that the remote procedural call between the MPS server and the MPS client failed.
- cudaErrorMpsServerNotReady = <cudaError_t.cudaErrorMpsServerNotReady: 807>#
This error indicates that the MPS server is not ready to accept new MPS client requests. This error can be returned when the MPS server is in the process of recovering from a fatal failure.
- cudaErrorMpsMaxClientsReached = <cudaError_t.cudaErrorMpsMaxClientsReached: 808>#
This error indicates that the hardware resources required to create MPS client have been exhausted.
- cudaErrorMpsMaxConnectionsReached = <cudaError_t.cudaErrorMpsMaxConnectionsReached: 809>#
This error indicates the the hardware resources required to device connections have been exhausted.
- cudaErrorMpsClientTerminated = <cudaError_t.cudaErrorMpsClientTerminated: 810>#
This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched.
- cudaErrorCdpNotSupported = <cudaError_t.cudaErrorCdpNotSupported: 811>#
This error indicates, that the program is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it.
- cudaErrorCdpVersionMismatch = <cudaError_t.cudaErrorCdpVersionMismatch: 812>#
This error indicates, that the program contains an unsupported interaction between different versions of CUDA Dynamic Parallelism.
- cudaErrorStreamCaptureUnsupported = <cudaError_t.cudaErrorStreamCaptureUnsupported: 900>#
The operation is not permitted when the stream is capturing.
- cudaErrorStreamCaptureInvalidated = <cudaError_t.cudaErrorStreamCaptureInvalidated: 901>#
The current capture sequence on the stream has been invalidated due to a previous error.
- cudaErrorStreamCaptureMerge = <cudaError_t.cudaErrorStreamCaptureMerge: 902>#
The operation would have resulted in a merge of two independent capture sequences.
- cudaErrorStreamCaptureUnmatched = <cudaError_t.cudaErrorStreamCaptureUnmatched: 903>#
The capture was not initiated in this stream.
- cudaErrorStreamCaptureUnjoined = <cudaError_t.cudaErrorStreamCaptureUnjoined: 904>#
The capture sequence contains a fork that was not joined to the primary stream.
- cudaErrorStreamCaptureIsolation = <cudaError_t.cudaErrorStreamCaptureIsolation: 905>#
A dependency would have been created which crosses the capture sequence boundary. Only implicit in-stream ordering dependencies are allowed to cross the boundary.
- cudaErrorStreamCaptureImplicit = <cudaError_t.cudaErrorStreamCaptureImplicit: 906>#
The operation would have resulted in a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy.
- cudaErrorCapturedEvent = <cudaError_t.cudaErrorCapturedEvent: 907>#
The operation is not permitted on an event which was last recorded in a capturing stream.
- cudaErrorStreamCaptureWrongThread = <cudaError_t.cudaErrorStreamCaptureWrongThread: 908>#
A stream capture sequence not initiated with the
cudaStreamCaptureModeRelaxedargument tocudaStreamBeginCapturewas passed tocudaStreamEndCapturein a different thread.
- cudaErrorTimeout = <cudaError_t.cudaErrorTimeout: 909>#
This indicates that the wait operation has timed out.
- cudaErrorGraphExecUpdateFailure = <cudaError_t.cudaErrorGraphExecUpdateFailure: 910>#
This error indicates that the graph update was not performed because it included changes which violated constraints specific to instantiated graph update.
- cudaErrorExternalDevice = <cudaError_t.cudaErrorExternalDevice: 911>#
This indicates that an error has occurred in a device outside of GPU. It can be a synchronous error w.r.t. CUDA API or an asynchronous error from the external device. In case of asynchronous error, it means that if cuda was waiting for an external device’s signal before consuming shared data, the external device signaled an error indicating that the data is not valid for consumption. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. In case of synchronous error, it means that one or more external devices have encountered an error and cannot complete the operation.
- cudaErrorInvalidClusterSize = <cudaError_t.cudaErrorInvalidClusterSize: 912>#
This indicates that a kernel launch error has occurred due to cluster misconfiguration.
- cudaErrorFunctionNotLoaded = <cudaError_t.cudaErrorFunctionNotLoaded: 913>#
Indiciates a function handle is not loaded when calling an API that requires a loaded function.
- cudaErrorInvalidResourceType = <cudaError_t.cudaErrorInvalidResourceType: 914>#
This error indicates one or more resources passed in are not valid resource types for the operation.
- cudaErrorInvalidResourceConfiguration = <cudaError_t.cudaErrorInvalidResourceConfiguration: 915>#
This error indicates one or more resources are insufficient or non-applicable for the operation.
- cudaErrorStreamDetached = <cudaError_t.cudaErrorStreamDetached: 917>#
This error indicates that the requested operation is not permitted because the stream is in a detached state. This can occur if the green context associated with the stream has been destroyed, limiting the stream’s operational capabilities.
- cudaErrorUnknown = <cudaError_t.cudaErrorUnknown: 999>#
This indicates that an unknown internal error has occurred.
- cudaErrorApiFailureBase = <cudaError_t.cudaErrorApiFailureBase: 10000>#
- class cuda.bindings.runtime.cudaChannelFormatKind(value: int)#
Channel format kind
- cudaChannelFormatKindSigned = <cudaChannelFormatKind.cudaChannelFormatKindSigned: 0>#
Signed channel format
- cudaChannelFormatKindUnsigned = <cudaChannelFormatKind.cudaChannelFormatKindUnsigned: 1>#
Unsigned channel format
- cudaChannelFormatKindFloat = <cudaChannelFormatKind.cudaChannelFormatKindFloat: 2>#
Float channel format
- cudaChannelFormatKindNone = <cudaChannelFormatKind.cudaChannelFormatKindNone: 3>#
No channel format
- cudaChannelFormatKindNV12 = <cudaChannelFormatKind.cudaChannelFormatKindNV12: 4>#
Unsigned 8-bit integers, planar 4:2:0 YUV format
- cudaChannelFormatKindUnsignedNormalized8X1 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1: 5>#
1 channel unsigned 8-bit normalized integer
- cudaChannelFormatKindUnsignedNormalized8X2 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2: 6>#
2 channel unsigned 8-bit normalized integer
- cudaChannelFormatKindUnsignedNormalized8X4 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4: 7>#
4 channel unsigned 8-bit normalized integer
- cudaChannelFormatKindUnsignedNormalized16X1 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1: 8>#
1 channel unsigned 16-bit normalized integer
- cudaChannelFormatKindUnsignedNormalized16X2 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2: 9>#
2 channel unsigned 16-bit normalized integer
- cudaChannelFormatKindUnsignedNormalized16X4 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4: 10>#
4 channel unsigned 16-bit normalized integer
- cudaChannelFormatKindSignedNormalized8X1 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1: 11>#
1 channel signed 8-bit normalized integer
- cudaChannelFormatKindSignedNormalized8X2 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2: 12>#
2 channel signed 8-bit normalized integer
- cudaChannelFormatKindSignedNormalized8X4 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4: 13>#
4 channel signed 8-bit normalized integer
- cudaChannelFormatKindSignedNormalized16X1 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1: 14>#
1 channel signed 16-bit normalized integer
- cudaChannelFormatKindSignedNormalized16X2 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2: 15>#
2 channel signed 16-bit normalized integer
- cudaChannelFormatKindSignedNormalized16X4 = <cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4: 16>#
4 channel signed 16-bit normalized integer
- cudaChannelFormatKindUnsignedBlockCompressed1 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1: 17>#
4 channel unsigned normalized block-compressed (BC1 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed1SRGB = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB: 18>#
4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding
- cudaChannelFormatKindUnsignedBlockCompressed2 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2: 19>#
4 channel unsigned normalized block-compressed (BC2 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed2SRGB = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB: 20>#
4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding
- cudaChannelFormatKindUnsignedBlockCompressed3 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3: 21>#
4 channel unsigned normalized block-compressed (BC3 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed3SRGB = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB: 22>#
4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding
- cudaChannelFormatKindUnsignedBlockCompressed4 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4: 23>#
1 channel unsigned normalized block-compressed (BC4 compression) format
- cudaChannelFormatKindSignedBlockCompressed4 = <cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4: 24>#
1 channel signed normalized block-compressed (BC4 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed5 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5: 25>#
2 channel unsigned normalized block-compressed (BC5 compression) format
- cudaChannelFormatKindSignedBlockCompressed5 = <cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5: 26>#
2 channel signed normalized block-compressed (BC5 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed6H = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H: 27>#
3 channel unsigned half-float block-compressed (BC6H compression) format
- cudaChannelFormatKindSignedBlockCompressed6H = <cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H: 28>#
3 channel signed half-float block-compressed (BC6H compression) format
- cudaChannelFormatKindUnsignedBlockCompressed7 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7: 29>#
4 channel unsigned normalized block-compressed (BC7 compression) format
- cudaChannelFormatKindUnsignedBlockCompressed7SRGB = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB: 30>#
4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding
- cudaChannelFormatKindUnsignedNormalized1010102 = <cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102: 31>#
4 channel unsigned normalized (10-bit, 10-bit, 10-bit, 2-bit) format
- class cuda.bindings.runtime.cudaMemoryType(value: int)#
CUDA memory types
- cudaMemoryTypeUnregistered = <cudaMemoryType.cudaMemoryTypeUnregistered: 0>#
Unregistered memory
- cudaMemoryTypeHost = <cudaMemoryType.cudaMemoryTypeHost: 1>#
Host memory
- cudaMemoryTypeDevice = <cudaMemoryType.cudaMemoryTypeDevice: 2>#
Device memory
- cudaMemoryTypeManaged = <cudaMemoryType.cudaMemoryTypeManaged: 3>#
Managed memory
- class cuda.bindings.runtime.cudaMemcpyKind(value: int)#
CUDA memory copy types
- cudaMemcpyHostToHost = <cudaMemcpyKind.cudaMemcpyHostToHost: 0>#
Host -> Host
- cudaMemcpyHostToDevice = <cudaMemcpyKind.cudaMemcpyHostToDevice: 1>#
Host -> Device
- cudaMemcpyDeviceToHost = <cudaMemcpyKind.cudaMemcpyDeviceToHost: 2>#
Device -> Host
- cudaMemcpyDeviceToDevice = <cudaMemcpyKind.cudaMemcpyDeviceToDevice: 3>#
Device -> Device
- cudaMemcpyDefault = <cudaMemcpyKind.cudaMemcpyDefault: 4>#
Direction of the transfer is inferred from the pointer values. Requires unified virtual addressing
- class cuda.bindings.runtime.cudaAccessProperty(value: int)#
Specifies performance hint with :py:obj:`~.cudaAccessPolicyWindow` for hitProp and missProp members.
- cudaAccessPropertyNormal = <cudaAccessProperty.cudaAccessPropertyNormal: 0>#
Normal cache persistence.
- cudaAccessPropertyStreaming = <cudaAccessProperty.cudaAccessPropertyStreaming: 1>#
Streaming access is less likely to persit from cache.
- cudaAccessPropertyPersisting = <cudaAccessProperty.cudaAccessPropertyPersisting: 2>#
Persisting access is more likely to persist in cache.
- class cuda.bindings.runtime.cudaStreamCaptureStatus(value: int)#
Possible stream capture statuses returned by :py:obj:`~.cudaStreamIsCapturing`
- cudaStreamCaptureStatusNone = <cudaStreamCaptureStatus.cudaStreamCaptureStatusNone: 0>#
Stream is not capturing
- cudaStreamCaptureStatusActive = <cudaStreamCaptureStatus.cudaStreamCaptureStatusActive: 1>#
Stream is actively capturing
- cudaStreamCaptureStatusInvalidated = <cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated: 2>#
Stream is part of a capture sequence that has been invalidated, but not terminated
- class cuda.bindings.runtime.cudaStreamCaptureMode(value: int)#
Possible modes for stream capture thread interactions. For more details see :py:obj:`~.cudaStreamBeginCapture` and :py:obj:`~.cudaThreadExchangeStreamCaptureMode`
- cudaStreamCaptureModeGlobal = <cudaStreamCaptureMode.cudaStreamCaptureModeGlobal: 0>#
- cudaStreamCaptureModeThreadLocal = <cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal: 1>#
- cudaStreamCaptureModeRelaxed = <cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed: 2>#
- class cuda.bindings.runtime.cudaSynchronizationPolicy(value: int)#
- cudaSyncPolicyAuto = <cudaSynchronizationPolicy.cudaSyncPolicyAuto: 1>#
- cudaSyncPolicySpin = <cudaSynchronizationPolicy.cudaSyncPolicySpin: 2>#
- cudaSyncPolicyYield = <cudaSynchronizationPolicy.cudaSyncPolicyYield: 3>#
- cudaSyncPolicyBlockingSync = <cudaSynchronizationPolicy.cudaSyncPolicyBlockingSync: 4>#
- class cuda.bindings.runtime.cudaClusterSchedulingPolicy(value: int)#
Cluster scheduling policies. These may be passed to :py:obj:`~.cudaFuncSetAttribute`
- cudaClusterSchedulingPolicyDefault = <cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyDefault: 0>#
the default policy
- cudaClusterSchedulingPolicySpread = <cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicySpread: 1>#
spread the blocks within a cluster to the SMs
- cudaClusterSchedulingPolicyLoadBalancing = <cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyLoadBalancing: 2>#
allow the hardware to load-balance the blocks in a cluster to the SMs
- class cuda.bindings.runtime.cudaStreamUpdateCaptureDependenciesFlags(value: int)#
Flags for :py:obj:`~.cudaStreamUpdateCaptureDependencies`
- cudaStreamAddCaptureDependencies = <cudaStreamUpdateCaptureDependenciesFlags.cudaStreamAddCaptureDependencies: 0>#
Add new nodes to the dependency set
- cudaStreamSetCaptureDependencies = <cudaStreamUpdateCaptureDependenciesFlags.cudaStreamSetCaptureDependencies: 1>#
Replace the dependency set with the new nodes
- class cuda.bindings.runtime.cudaUserObjectFlags(value: int)#
Flags for user objects for graphs
- cudaUserObjectNoDestructorSync = <cudaUserObjectFlags.cudaUserObjectNoDestructorSync: 1>#
Indicates the destructor execution is not synchronized by any CUDA handle.
- class cuda.bindings.runtime.cudaUserObjectRetainFlags(value: int)#
Flags for retaining user object references for graphs
- cudaGraphUserObjectMove = <cudaUserObjectRetainFlags.cudaGraphUserObjectMove: 1>#
Transfer references from the caller rather than creating new references.
- class cuda.bindings.runtime.cudaHostTaskSyncMode(value: int)#
Flags for host task sync mode
- cudaHostTaskBlocking = <cudaHostTaskSyncMode.cudaHostTaskBlocking: 0>#
- cudaHostTaskSpinWait = <cudaHostTaskSyncMode.cudaHostTaskSpinWait: 1>#
- class cuda.bindings.runtime.cudaGraphicsRegisterFlags(value: int)#
CUDA graphics interop register flags
- cudaGraphicsRegisterFlagsNone = <cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone: 0>#
Default
- cudaGraphicsRegisterFlagsReadOnly = <cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsReadOnly: 1>#
CUDA will not write to this resource
- cudaGraphicsRegisterFlagsWriteDiscard = <cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard: 2>#
CUDA will only write to and will not read from this resource
- cudaGraphicsRegisterFlagsSurfaceLoadStore = <cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsSurfaceLoadStore: 4>#
CUDA will bind this resource to a surface reference
- cudaGraphicsRegisterFlagsTextureGather = <cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsTextureGather: 8>#
CUDA will perform texture gather operations on this resource
- class cuda.bindings.runtime.cudaGraphicsMapFlags(value: int)#
CUDA graphics interop map flags
- cudaGraphicsMapFlagsNone = <cudaGraphicsMapFlags.cudaGraphicsMapFlagsNone: 0>#
Default; Assume resource can be read/written
- cudaGraphicsMapFlagsReadOnly = <cudaGraphicsMapFlags.cudaGraphicsMapFlagsReadOnly: 1>#
CUDA will not write to this resource
- cudaGraphicsMapFlagsWriteDiscard = <cudaGraphicsMapFlags.cudaGraphicsMapFlagsWriteDiscard: 2>#
CUDA will only write to and will not read from this resource
- class cuda.bindings.runtime.cudaGraphicsCubeFace(value: int)#
CUDA graphics interop array indices for cube maps
- cudaGraphicsCubeFacePositiveX = <cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveX: 0>#
Positive X face of cubemap
- cudaGraphicsCubeFaceNegativeX = <cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeX: 1>#
Negative X face of cubemap
- cudaGraphicsCubeFacePositiveY = <cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveY: 2>#
Positive Y face of cubemap
- cudaGraphicsCubeFaceNegativeY = <cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeY: 3>#
Negative Y face of cubemap
- cudaGraphicsCubeFacePositiveZ = <cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveZ: 4>#
Positive Z face of cubemap
- cudaGraphicsCubeFaceNegativeZ = <cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeZ: 5>#
Negative Z face of cubemap
- class cuda.bindings.runtime.cudaResourceType(value: int)#
CUDA resource types
- cudaResourceTypeArray = <cudaResourceType.cudaResourceTypeArray: 0>#
Array resource
- cudaResourceTypeMipmappedArray = <cudaResourceType.cudaResourceTypeMipmappedArray: 1>#
Mipmapped array resource
- cudaResourceTypeLinear = <cudaResourceType.cudaResourceTypeLinear: 2>#
Linear resource
- cudaResourceTypePitch2D = <cudaResourceType.cudaResourceTypePitch2D: 3>#
Pitch 2D resource
- class cuda.bindings.runtime.cudaResourceViewFormat(value: int)#
CUDA texture resource view formats
- cudaResViewFormatNone = <cudaResourceViewFormat.cudaResViewFormatNone: 0>#
No resource view format (use underlying resource format)
- cudaResViewFormatUnsignedChar1 = <cudaResourceViewFormat.cudaResViewFormatUnsignedChar1: 1>#
1 channel unsigned 8-bit integers
- cudaResViewFormatUnsignedChar2 = <cudaResourceViewFormat.cudaResViewFormatUnsignedChar2: 2>#
2 channel unsigned 8-bit integers
- cudaResViewFormatUnsignedChar4 = <cudaResourceViewFormat.cudaResViewFormatUnsignedChar4: 3>#
4 channel unsigned 8-bit integers
- cudaResViewFormatSignedChar1 = <cudaResourceViewFormat.cudaResViewFormatSignedChar1: 4>#
1 channel signed 8-bit integers
- cudaResViewFormatSignedChar2 = <cudaResourceViewFormat.cudaResViewFormatSignedChar2: 5>#
2 channel signed 8-bit integers
- cudaResViewFormatSignedChar4 = <cudaResourceViewFormat.cudaResViewFormatSignedChar4: 6>#
4 channel signed 8-bit integers
- cudaResViewFormatUnsignedShort1 = <cudaResourceViewFormat.cudaResViewFormatUnsignedShort1: 7>#
1 channel unsigned 16-bit integers
- cudaResViewFormatUnsignedShort2 = <cudaResourceViewFormat.cudaResViewFormatUnsignedShort2: 8>#
2 channel unsigned 16-bit integers
- cudaResViewFormatUnsignedShort4 = <cudaResourceViewFormat.cudaResViewFormatUnsignedShort4: 9>#
4 channel unsigned 16-bit integers
- cudaResViewFormatSignedShort1 = <cudaResourceViewFormat.cudaResViewFormatSignedShort1: 10>#
1 channel signed 16-bit integers
- cudaResViewFormatSignedShort2 = <cudaResourceViewFormat.cudaResViewFormatSignedShort2: 11>#
2 channel signed 16-bit integers
- cudaResViewFormatSignedShort4 = <cudaResourceViewFormat.cudaResViewFormatSignedShort4: 12>#
4 channel signed 16-bit integers
- cudaResViewFormatUnsignedInt1 = <cudaResourceViewFormat.cudaResViewFormatUnsignedInt1: 13>#
1 channel unsigned 32-bit integers
- cudaResViewFormatUnsignedInt2 = <cudaResourceViewFormat.cudaResViewFormatUnsignedInt2: 14>#
2 channel unsigned 32-bit integers
- cudaResViewFormatUnsignedInt4 = <cudaResourceViewFormat.cudaResViewFormatUnsignedInt4: 15>#
4 channel unsigned 32-bit integers
- cudaResViewFormatSignedInt1 = <cudaResourceViewFormat.cudaResViewFormatSignedInt1: 16>#
1 channel signed 32-bit integers
- cudaResViewFormatSignedInt2 = <cudaResourceViewFormat.cudaResViewFormatSignedInt2: 17>#
2 channel signed 32-bit integers
- cudaResViewFormatSignedInt4 = <cudaResourceViewFormat.cudaResViewFormatSignedInt4: 18>#
4 channel signed 32-bit integers
- cudaResViewFormatHalf1 = <cudaResourceViewFormat.cudaResViewFormatHalf1: 19>#
1 channel 16-bit floating point
- cudaResViewFormatHalf2 = <cudaResourceViewFormat.cudaResViewFormatHalf2: 20>#
2 channel 16-bit floating point
- cudaResViewFormatHalf4 = <cudaResourceViewFormat.cudaResViewFormatHalf4: 21>#
4 channel 16-bit floating point
- cudaResViewFormatFloat1 = <cudaResourceViewFormat.cudaResViewFormatFloat1: 22>#
1 channel 32-bit floating point
- cudaResViewFormatFloat2 = <cudaResourceViewFormat.cudaResViewFormatFloat2: 23>#
2 channel 32-bit floating point
- cudaResViewFormatFloat4 = <cudaResourceViewFormat.cudaResViewFormatFloat4: 24>#
4 channel 32-bit floating point
- cudaResViewFormatUnsignedBlockCompressed1 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed1: 25>#
Block compressed 1
- cudaResViewFormatUnsignedBlockCompressed2 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed2: 26>#
Block compressed 2
- cudaResViewFormatUnsignedBlockCompressed3 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed3: 27>#
Block compressed 3
- cudaResViewFormatUnsignedBlockCompressed4 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed4: 28>#
Block compressed 4 unsigned
- cudaResViewFormatSignedBlockCompressed4 = <cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed4: 29>#
Block compressed 4 signed
- cudaResViewFormatUnsignedBlockCompressed5 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed5: 30>#
Block compressed 5 unsigned
- cudaResViewFormatSignedBlockCompressed5 = <cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed5: 31>#
Block compressed 5 signed
- cudaResViewFormatUnsignedBlockCompressed6H = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed6H: 32>#
Block compressed 6 unsigned half-float
- cudaResViewFormatSignedBlockCompressed6H = <cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed6H: 33>#
Block compressed 6 signed half-float
- cudaResViewFormatUnsignedBlockCompressed7 = <cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed7: 34>#
Block compressed 7
- class cuda.bindings.runtime.cudaFuncAttribute(value: int)#
CUDA function attributes that can be set using :py:obj:`~.cudaFuncSetAttribute`
Maximum dynamic shared memory size
Preferred shared memory-L1 cache split
- cudaFuncAttributeClusterDimMustBeSet = <cudaFuncAttribute.cudaFuncAttributeClusterDimMustBeSet: 10>#
Indicator to enforce valid cluster dimension specification on kernel launch
- cudaFuncAttributeRequiredClusterWidth = <cudaFuncAttribute.cudaFuncAttributeRequiredClusterWidth: 11>#
Required cluster width
- cudaFuncAttributeRequiredClusterHeight = <cudaFuncAttribute.cudaFuncAttributeRequiredClusterHeight: 12>#
Required cluster height
- cudaFuncAttributeRequiredClusterDepth = <cudaFuncAttribute.cudaFuncAttributeRequiredClusterDepth: 13>#
Required cluster depth
- cudaFuncAttributeNonPortableClusterSizeAllowed = <cudaFuncAttribute.cudaFuncAttributeNonPortableClusterSizeAllowed: 14>#
Whether non-portable cluster scheduling policy is supported
- cudaFuncAttributeClusterSchedulingPolicyPreference = <cudaFuncAttribute.cudaFuncAttributeClusterSchedulingPolicyPreference: 15>#
Required cluster scheduling policy preference
- cudaFuncAttributeMax = <cudaFuncAttribute.cudaFuncAttributeMax: 16>#
- class cuda.bindings.runtime.cudaFuncCache(value: int)#
CUDA function cache configurations
- cudaFuncCachePreferNone = <cudaFuncCache.cudaFuncCachePreferNone: 0>#
Default function cache configuration, no preference
Prefer larger shared memory and smaller L1 cache
- cudaFuncCachePreferL1 = <cudaFuncCache.cudaFuncCachePreferL1: 2>#
Prefer larger L1 cache and smaller shared memory
- cudaFuncCachePreferEqual = <cudaFuncCache.cudaFuncCachePreferEqual: 3>#
Prefer equal size L1 cache and shared memory
CUDA shared memory configuration [Deprecated]
Shared memory carveout configurations. These may be passed to cudaFuncSetAttribute
No preference for shared memory or L1 (default)
Prefer maximum available shared memory, minimum L1 cache
Prefer maximum available L1 cache, minimum shared memory
- class cuda.bindings.runtime.cudaComputeMode(value: int)#
CUDA device compute modes
- cudaComputeModeDefault = <cudaComputeMode.cudaComputeModeDefault: 0>#
Default compute mode (Multiple threads can use
cudaSetDevice()with this device)
- cudaComputeModeExclusive = <cudaComputeMode.cudaComputeModeExclusive: 1>#
Compute-exclusive-thread mode (Only one thread in one process will be able to use
cudaSetDevice()with this device)
- cudaComputeModeProhibited = <cudaComputeMode.cudaComputeModeProhibited: 2>#
Compute-prohibited mode (No threads can use
cudaSetDevice()with this device)
- cudaComputeModeExclusiveProcess = <cudaComputeMode.cudaComputeModeExclusiveProcess: 3>#
Compute-exclusive-process mode (Many threads in one process will be able to use
cudaSetDevice()with this device)
- class cuda.bindings.runtime.cudaLimit(value: int)#
CUDA Limits
- cudaLimitStackSize = <cudaLimit.cudaLimitStackSize: 0>#
GPU thread stack size
- cudaLimitPrintfFifoSize = <cudaLimit.cudaLimitPrintfFifoSize: 1>#
GPU printf FIFO size
- cudaLimitMallocHeapSize = <cudaLimit.cudaLimitMallocHeapSize: 2>#
GPU malloc heap size
- cudaLimitDevRuntimeSyncDepth = <cudaLimit.cudaLimitDevRuntimeSyncDepth: 3>#
GPU device runtime synchronize depth
- cudaLimitDevRuntimePendingLaunchCount = <cudaLimit.cudaLimitDevRuntimePendingLaunchCount: 4>#
GPU device runtime pending launch count
- cudaLimitMaxL2FetchGranularity = <cudaLimit.cudaLimitMaxL2FetchGranularity: 5>#
A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint
- cudaLimitPersistingL2CacheSize = <cudaLimit.cudaLimitPersistingL2CacheSize: 6>#
A size in bytes for L2 persisting lines cache size
- class cuda.bindings.runtime.cudaMemoryAdvise(value: int)#
CUDA Memory Advise values
- cudaMemAdviseSetReadMostly = <cudaMemoryAdvise.cudaMemAdviseSetReadMostly: 1>#
Data will mostly be read and only occassionally be written to
- cudaMemAdviseUnsetReadMostly = <cudaMemoryAdvise.cudaMemAdviseUnsetReadMostly: 2>#
Undo the effect of
cudaMemAdviseSetReadMostly
- cudaMemAdviseSetPreferredLocation = <cudaMemoryAdvise.cudaMemAdviseSetPreferredLocation: 3>#
Set the preferred location for the data as the specified device
- cudaMemAdviseUnsetPreferredLocation = <cudaMemoryAdvise.cudaMemAdviseUnsetPreferredLocation: 4>#
Clear the preferred location for the data
- cudaMemAdviseSetAccessedBy = <cudaMemoryAdvise.cudaMemAdviseSetAccessedBy: 5>#
Data will be accessed by the specified device, so prevent page faults as much as possible
- cudaMemAdviseUnsetAccessedBy = <cudaMemoryAdvise.cudaMemAdviseUnsetAccessedBy: 6>#
Let the Unified Memory subsystem decide on the page faulting policy for the specified device
- class cuda.bindings.runtime.cudaMemRangeAttribute(value: int)#
CUDA range attributes
- cudaMemRangeAttributeReadMostly = <cudaMemRangeAttribute.cudaMemRangeAttributeReadMostly: 1>#
Whether the range will mostly be read and only occassionally be written to
- cudaMemRangeAttributePreferredLocation = <cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocation: 2>#
The preferred location of the range
- cudaMemRangeAttributeAccessedBy = <cudaMemRangeAttribute.cudaMemRangeAttributeAccessedBy: 3>#
Memory range has
cudaMemAdviseSetAccessedByset for specified device
- cudaMemRangeAttributeLastPrefetchLocation = <cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocation: 4>#
The last location to which the range was prefetched
- cudaMemRangeAttributePreferredLocationType = <cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationType: 5>#
The preferred location type of the range
- cudaMemRangeAttributePreferredLocationId = <cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationId: 6>#
The preferred location id of the range
- cudaMemRangeAttributeLastPrefetchLocationType = <cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationType: 7>#
The last location type to which the range was prefetched
- cudaMemRangeAttributeLastPrefetchLocationId = <cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationId: 8>#
The last location id to which the range was prefetched
- class cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesOptions(value: int)#
CUDA GPUDirect RDMA flush writes APIs supported on the device
- cudaFlushGPUDirectRDMAWritesOptionHost = <cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionHost: 1>#
cudaDeviceFlushGPUDirectRDMAWrites()and its CUDA Driver API counterpart are supported on the device.
- cudaFlushGPUDirectRDMAWritesOptionMemOps = <cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionMemOps: 2>#
The
CU_STREAM_WAIT_VALUE_FLUSHflag and theCU_STREAM_MEM_OP_FLUSH_REMOTE_WRITESMemOp are supported on the CUDA device.
- class cuda.bindings.runtime.cudaGPUDirectRDMAWritesOrdering(value: int)#
CUDA GPUDirect RDMA flush writes ordering features of the device
- cudaGPUDirectRDMAWritesOrderingNone = <cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingNone: 0>#
The device does not natively support ordering of GPUDirect RDMA writes.
cudaFlushGPUDirectRDMAWrites()can be leveraged if supported.
- cudaGPUDirectRDMAWritesOrderingOwner = <cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingOwner: 100>#
Natively, the device can consistently consume GPUDirect RDMA writes, although other CUDA devices may not.
- cudaGPUDirectRDMAWritesOrderingAllDevices = <cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingAllDevices: 200>#
Any CUDA device in the system can consistently consume GPUDirect RDMA writes to this device.
- class cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesScope(value: int)#
CUDA GPUDirect RDMA flush writes scopes
- cudaFlushGPUDirectRDMAWritesToOwner = <cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToOwner: 100>#
Blocks until remote writes are visible to the CUDA device context owning the data.
- cudaFlushGPUDirectRDMAWritesToAllDevices = <cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToAllDevices: 200>#
Blocks until remote writes are visible to all CUDA device contexts.
- class cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesTarget(value: int)#
CUDA GPUDirect RDMA flush writes targets
- cudaFlushGPUDirectRDMAWritesTargetCurrentDevice = <cudaFlushGPUDirectRDMAWritesTarget.cudaFlushGPUDirectRDMAWritesTargetCurrentDevice: 0>#
Sets the target for
cudaDeviceFlushGPUDirectRDMAWrites()to the currently active CUDA device context.
- class cuda.bindings.runtime.cudaDeviceAttr(value: int)#
CUDA device attributes
- cudaDevAttrMaxThreadsPerBlock = <cudaDeviceAttr.cudaDevAttrMaxThreadsPerBlock: 1>#
Maximum number of threads per block
- cudaDevAttrMaxBlockDimX = <cudaDeviceAttr.cudaDevAttrMaxBlockDimX: 2>#
Maximum block dimension X
- cudaDevAttrMaxBlockDimY = <cudaDeviceAttr.cudaDevAttrMaxBlockDimY: 3>#
Maximum block dimension Y
- cudaDevAttrMaxBlockDimZ = <cudaDeviceAttr.cudaDevAttrMaxBlockDimZ: 4>#
Maximum block dimension Z
- cudaDevAttrMaxGridDimX = <cudaDeviceAttr.cudaDevAttrMaxGridDimX: 5>#
Maximum grid dimension X
- cudaDevAttrMaxGridDimY = <cudaDeviceAttr.cudaDevAttrMaxGridDimY: 6>#
Maximum grid dimension Y
- cudaDevAttrMaxGridDimZ = <cudaDeviceAttr.cudaDevAttrMaxGridDimZ: 7>#
Maximum grid dimension Z
Maximum shared memory available per block in bytes
- cudaDevAttrTotalConstantMemory = <cudaDeviceAttr.cudaDevAttrTotalConstantMemory: 9>#
Memory available on device for constant variables in a CUDA C kernel in bytes
- cudaDevAttrWarpSize = <cudaDeviceAttr.cudaDevAttrWarpSize: 10>#
Warp size in threads
- cudaDevAttrMaxPitch = <cudaDeviceAttr.cudaDevAttrMaxPitch: 11>#
Maximum pitch in bytes allowed by memory copies
- cudaDevAttrMaxRegistersPerBlock = <cudaDeviceAttr.cudaDevAttrMaxRegistersPerBlock: 12>#
Maximum number of 32-bit registers available per block
- cudaDevAttrClockRate = <cudaDeviceAttr.cudaDevAttrClockRate: 13>#
Peak clock frequency in kilohertz
- cudaDevAttrTextureAlignment = <cudaDeviceAttr.cudaDevAttrTextureAlignment: 14>#
Alignment requirement for textures
- cudaDevAttrGpuOverlap = <cudaDeviceAttr.cudaDevAttrGpuOverlap: 15>#
Device can possibly copy memory and execute a kernel concurrently
- cudaDevAttrMultiProcessorCount = <cudaDeviceAttr.cudaDevAttrMultiProcessorCount: 16>#
Number of multiprocessors on device
- cudaDevAttrKernelExecTimeout = <cudaDeviceAttr.cudaDevAttrKernelExecTimeout: 17>#
Specifies whether there is a run time limit on kernels
- cudaDevAttrIntegrated = <cudaDeviceAttr.cudaDevAttrIntegrated: 18>#
Device is integrated with host memory
- cudaDevAttrCanMapHostMemory = <cudaDeviceAttr.cudaDevAttrCanMapHostMemory: 19>#
Device can map host memory into CUDA address space
- cudaDevAttrComputeMode = <cudaDeviceAttr.cudaDevAttrComputeMode: 20>#
Compute mode (See
cudaComputeModefor details)
- cudaDevAttrMaxTexture1DWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture1DWidth: 21>#
Maximum 1D texture width
- cudaDevAttrMaxTexture2DWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture2DWidth: 22>#
Maximum 2D texture width
- cudaDevAttrMaxTexture2DHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture2DHeight: 23>#
Maximum 2D texture height
- cudaDevAttrMaxTexture3DWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture3DWidth: 24>#
Maximum 3D texture width
- cudaDevAttrMaxTexture3DHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture3DHeight: 25>#
Maximum 3D texture height
- cudaDevAttrMaxTexture3DDepth = <cudaDeviceAttr.cudaDevAttrMaxTexture3DDepth: 26>#
Maximum 3D texture depth
- cudaDevAttrMaxTexture2DLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredWidth: 27>#
Maximum 2D layered texture width
- cudaDevAttrMaxTexture2DLayeredHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredHeight: 28>#
Maximum 2D layered texture height
- cudaDevAttrMaxTexture2DLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredLayers: 29>#
Maximum layers in a 2D layered texture
- cudaDevAttrSurfaceAlignment = <cudaDeviceAttr.cudaDevAttrSurfaceAlignment: 30>#
Alignment requirement for surfaces
- cudaDevAttrConcurrentKernels = <cudaDeviceAttr.cudaDevAttrConcurrentKernels: 31>#
Device can possibly execute multiple kernels concurrently
- cudaDevAttrEccEnabled = <cudaDeviceAttr.cudaDevAttrEccEnabled: 32>#
Device has ECC support enabled
- cudaDevAttrPciBusId = <cudaDeviceAttr.cudaDevAttrPciBusId: 33>#
PCI bus ID of the device
- cudaDevAttrPciDeviceId = <cudaDeviceAttr.cudaDevAttrPciDeviceId: 34>#
PCI device ID of the device
- cudaDevAttrTccDriver = <cudaDeviceAttr.cudaDevAttrTccDriver: 35>#
Device is using TCC driver model
- cudaDevAttrMemoryClockRate = <cudaDeviceAttr.cudaDevAttrMemoryClockRate: 36>#
Peak memory clock frequency in kilohertz
- cudaDevAttrGlobalMemoryBusWidth = <cudaDeviceAttr.cudaDevAttrGlobalMemoryBusWidth: 37>#
Global memory bus width in bits
- cudaDevAttrL2CacheSize = <cudaDeviceAttr.cudaDevAttrL2CacheSize: 38>#
Size of L2 cache in bytes
- cudaDevAttrMaxThreadsPerMultiProcessor = <cudaDeviceAttr.cudaDevAttrMaxThreadsPerMultiProcessor: 39>#
Maximum resident threads per multiprocessor
- cudaDevAttrAsyncEngineCount = <cudaDeviceAttr.cudaDevAttrAsyncEngineCount: 40>#
Number of asynchronous engines
- cudaDevAttrUnifiedAddressing = <cudaDeviceAttr.cudaDevAttrUnifiedAddressing: 41>#
Device shares a unified address space with the host
- cudaDevAttrMaxTexture1DLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredWidth: 42>#
Maximum 1D layered texture width
- cudaDevAttrMaxTexture1DLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredLayers: 43>#
Maximum layers in a 1D layered texture
- cudaDevAttrMaxTexture2DGatherWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherWidth: 45>#
Maximum 2D texture width if cudaArrayTextureGather is set
- cudaDevAttrMaxTexture2DGatherHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherHeight: 46>#
Maximum 2D texture height if cudaArrayTextureGather is set
- cudaDevAttrMaxTexture3DWidthAlt = <cudaDeviceAttr.cudaDevAttrMaxTexture3DWidthAlt: 47>#
Alternate maximum 3D texture width
- cudaDevAttrMaxTexture3DHeightAlt = <cudaDeviceAttr.cudaDevAttrMaxTexture3DHeightAlt: 48>#
Alternate maximum 3D texture height
- cudaDevAttrMaxTexture3DDepthAlt = <cudaDeviceAttr.cudaDevAttrMaxTexture3DDepthAlt: 49>#
Alternate maximum 3D texture depth
- cudaDevAttrPciDomainId = <cudaDeviceAttr.cudaDevAttrPciDomainId: 50>#
PCI domain ID of the device
- cudaDevAttrTexturePitchAlignment = <cudaDeviceAttr.cudaDevAttrTexturePitchAlignment: 51>#
Pitch alignment requirement for textures
- cudaDevAttrMaxTextureCubemapWidth = <cudaDeviceAttr.cudaDevAttrMaxTextureCubemapWidth: 52>#
Maximum cubemap texture width/height
- cudaDevAttrMaxTextureCubemapLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredWidth: 53>#
Maximum cubemap layered texture width/height
- cudaDevAttrMaxTextureCubemapLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredLayers: 54>#
Maximum layers in a cubemap layered texture
- cudaDevAttrMaxSurface1DWidth = <cudaDeviceAttr.cudaDevAttrMaxSurface1DWidth: 55>#
Maximum 1D surface width
- cudaDevAttrMaxSurface2DWidth = <cudaDeviceAttr.cudaDevAttrMaxSurface2DWidth: 56>#
Maximum 2D surface width
- cudaDevAttrMaxSurface2DHeight = <cudaDeviceAttr.cudaDevAttrMaxSurface2DHeight: 57>#
Maximum 2D surface height
- cudaDevAttrMaxSurface3DWidth = <cudaDeviceAttr.cudaDevAttrMaxSurface3DWidth: 58>#
Maximum 3D surface width
- cudaDevAttrMaxSurface3DHeight = <cudaDeviceAttr.cudaDevAttrMaxSurface3DHeight: 59>#
Maximum 3D surface height
- cudaDevAttrMaxSurface3DDepth = <cudaDeviceAttr.cudaDevAttrMaxSurface3DDepth: 60>#
Maximum 3D surface depth
- cudaDevAttrMaxSurface1DLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredWidth: 61>#
Maximum 1D layered surface width
- cudaDevAttrMaxSurface1DLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredLayers: 62>#
Maximum layers in a 1D layered surface
- cudaDevAttrMaxSurface2DLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredWidth: 63>#
Maximum 2D layered surface width
- cudaDevAttrMaxSurface2DLayeredHeight = <cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredHeight: 64>#
Maximum 2D layered surface height
- cudaDevAttrMaxSurface2DLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredLayers: 65>#
Maximum layers in a 2D layered surface
- cudaDevAttrMaxSurfaceCubemapWidth = <cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapWidth: 66>#
Maximum cubemap surface width
- cudaDevAttrMaxSurfaceCubemapLayeredWidth = <cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredWidth: 67>#
Maximum cubemap layered surface width
- cudaDevAttrMaxSurfaceCubemapLayeredLayers = <cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredLayers: 68>#
Maximum layers in a cubemap layered surface
- cudaDevAttrMaxTexture1DLinearWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture1DLinearWidth: 69>#
Maximum 1D linear texture width
- cudaDevAttrMaxTexture2DLinearWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearWidth: 70>#
Maximum 2D linear texture width
- cudaDevAttrMaxTexture2DLinearHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearHeight: 71>#
Maximum 2D linear texture height
- cudaDevAttrMaxTexture2DLinearPitch = <cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearPitch: 72>#
Maximum 2D linear texture pitch in bytes
- cudaDevAttrMaxTexture2DMipmappedWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedWidth: 73>#
Maximum mipmapped 2D texture width
- cudaDevAttrMaxTexture2DMipmappedHeight = <cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedHeight: 74>#
Maximum mipmapped 2D texture height
- cudaDevAttrComputeCapabilityMajor = <cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor: 75>#
Major compute capability version number
- cudaDevAttrComputeCapabilityMinor = <cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor: 76>#
Minor compute capability version number
- cudaDevAttrMaxTexture1DMipmappedWidth = <cudaDeviceAttr.cudaDevAttrMaxTexture1DMipmappedWidth: 77>#
Maximum mipmapped 1D texture width
- cudaDevAttrStreamPrioritiesSupported = <cudaDeviceAttr.cudaDevAttrStreamPrioritiesSupported: 78>#
Device supports stream priorities
- cudaDevAttrGlobalL1CacheSupported = <cudaDeviceAttr.cudaDevAttrGlobalL1CacheSupported: 79>#
Device supports caching globals in L1
- cudaDevAttrLocalL1CacheSupported = <cudaDeviceAttr.cudaDevAttrLocalL1CacheSupported: 80>#
Device supports caching locals in L1
Maximum shared memory available per multiprocessor in bytes
- cudaDevAttrMaxRegistersPerMultiprocessor = <cudaDeviceAttr.cudaDevAttrMaxRegistersPerMultiprocessor: 82>#
Maximum number of 32-bit registers available per multiprocessor
- cudaDevAttrManagedMemory = <cudaDeviceAttr.cudaDevAttrManagedMemory: 83>#
Device can allocate managed memory on this system
- cudaDevAttrIsMultiGpuBoard = <cudaDeviceAttr.cudaDevAttrIsMultiGpuBoard: 84>#
Device is on a multi-GPU board
- cudaDevAttrMultiGpuBoardGroupID = <cudaDeviceAttr.cudaDevAttrMultiGpuBoardGroupID: 85>#
Unique identifier for a group of devices on the same multi-GPU board
- cudaDevAttrHostNativeAtomicSupported = <cudaDeviceAttr.cudaDevAttrHostNativeAtomicSupported: 86>#
Link between the device and the host supports native atomic operations
- cudaDevAttrSingleToDoublePrecisionPerfRatio = <cudaDeviceAttr.cudaDevAttrSingleToDoublePrecisionPerfRatio: 87>#
Ratio of single precision performance (in floating-point operations per second) to double precision performance
- cudaDevAttrPageableMemoryAccess = <cudaDeviceAttr.cudaDevAttrPageableMemoryAccess: 88>#
Device supports coherently accessing pageable memory without calling cudaHostRegister on it
- cudaDevAttrConcurrentManagedAccess = <cudaDeviceAttr.cudaDevAttrConcurrentManagedAccess: 89>#
Device can coherently access managed memory concurrently with the CPU
- cudaDevAttrComputePreemptionSupported = <cudaDeviceAttr.cudaDevAttrComputePreemptionSupported: 90>#
Device supports Compute Preemption
- cudaDevAttrCanUseHostPointerForRegisteredMem = <cudaDeviceAttr.cudaDevAttrCanUseHostPointerForRegisteredMem: 91>#
Device can access host registered memory at the same virtual address as the CPU
- cudaDevAttrReserved92 = <cudaDeviceAttr.cudaDevAttrReserved92: 92>#
- cudaDevAttrReserved93 = <cudaDeviceAttr.cudaDevAttrReserved93: 93>#
- cudaDevAttrReserved94 = <cudaDeviceAttr.cudaDevAttrReserved94: 94>#
- cudaDevAttrCooperativeLaunch = <cudaDeviceAttr.cudaDevAttrCooperativeLaunch: 95>#
Device supports launching cooperative kernels via
cudaLaunchCooperativeKernel
- cudaDevAttrReserved96 = <cudaDeviceAttr.cudaDevAttrReserved96: 96>#
The maximum optin shared memory per block. This value may vary by chip. See
cudaFuncSetAttribute
- cudaDevAttrCanFlushRemoteWrites = <cudaDeviceAttr.cudaDevAttrCanFlushRemoteWrites: 98>#
Device supports flushing of outstanding remote writes.
- cudaDevAttrHostRegisterSupported = <cudaDeviceAttr.cudaDevAttrHostRegisterSupported: 99>#
Device supports host memory registration via
cudaHostRegister.
- cudaDevAttrPageableMemoryAccessUsesHostPageTables = <cudaDeviceAttr.cudaDevAttrPageableMemoryAccessUsesHostPageTables: 100>#
Device accesses pageable memory via the host’s page tables.
- cudaDevAttrDirectManagedMemAccessFromHost = <cudaDeviceAttr.cudaDevAttrDirectManagedMemAccessFromHost: 101>#
Host can directly access managed memory on the device without migration.
- cudaDevAttrMaxBlocksPerMultiprocessor = <cudaDeviceAttr.cudaDevAttrMaxBlocksPerMultiprocessor: 106>#
Maximum number of blocks per multiprocessor
- cudaDevAttrMaxPersistingL2CacheSize = <cudaDeviceAttr.cudaDevAttrMaxPersistingL2CacheSize: 108>#
Maximum L2 persisting lines capacity setting in bytes.
- cudaDevAttrMaxAccessPolicyWindowSize = <cudaDeviceAttr.cudaDevAttrMaxAccessPolicyWindowSize: 109>#
Maximum value of
num_bytes.
Shared memory reserved by CUDA driver per block in bytes
- cudaDevAttrSparseCudaArraySupported = <cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported: 112>#
Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays
- cudaDevAttrHostRegisterReadOnlySupported = <cudaDeviceAttr.cudaDevAttrHostRegisterReadOnlySupported: 113>#
Device supports using the
cudaHostRegisterflag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU
- cudaDevAttrTimelineSemaphoreInteropSupported = <cudaDeviceAttr.cudaDevAttrTimelineSemaphoreInteropSupported: 114>#
External timeline semaphore interop is supported on the device
- cudaDevAttrMemoryPoolsSupported = <cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported: 115>#
Device supports using the
cudaMallocAsyncandcudaMemPoolfamily of APIs
- cudaDevAttrGPUDirectRDMASupported = <cudaDeviceAttr.cudaDevAttrGPUDirectRDMASupported: 116>#
Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information)
- cudaDevAttrGPUDirectRDMAFlushWritesOptions = <cudaDeviceAttr.cudaDevAttrGPUDirectRDMAFlushWritesOptions: 117>#
The returned attribute shall be interpreted as a bitmask, where the individual bits are listed in the
cudaFlushGPUDirectRDMAWritesOptionsenum
- cudaDevAttrGPUDirectRDMAWritesOrdering = <cudaDeviceAttr.cudaDevAttrGPUDirectRDMAWritesOrdering: 118>#
GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See
cudaGPUDirectRDMAWritesOrderingfor the numerical values returned here.
- cudaDevAttrMemoryPoolSupportedHandleTypes = <cudaDeviceAttr.cudaDevAttrMemoryPoolSupportedHandleTypes: 119>#
Handle types supported with mempool based IPC
- cudaDevAttrClusterLaunch = <cudaDeviceAttr.cudaDevAttrClusterLaunch: 120>#
Indicates device supports cluster launch
- cudaDevAttrDeferredMappingCudaArraySupported = <cudaDeviceAttr.cudaDevAttrDeferredMappingCudaArraySupported: 121>#
Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays
- cudaDevAttrReserved122 = <cudaDeviceAttr.cudaDevAttrReserved122: 122>#
- cudaDevAttrReserved123 = <cudaDeviceAttr.cudaDevAttrReserved123: 123>#
- cudaDevAttrReserved124 = <cudaDeviceAttr.cudaDevAttrReserved124: 124>#
- cudaDevAttrIpcEventSupport = <cudaDeviceAttr.cudaDevAttrIpcEventSupport: 125>#
Device supports IPC Events.
- cudaDevAttrMemSyncDomainCount = <cudaDeviceAttr.cudaDevAttrMemSyncDomainCount: 126>#
Number of memory synchronization domains the device supports.
- cudaDevAttrReserved127 = <cudaDeviceAttr.cudaDevAttrReserved127: 127>#
- cudaDevAttrReserved128 = <cudaDeviceAttr.cudaDevAttrReserved128: 128>#
- cudaDevAttrReserved129 = <cudaDeviceAttr.cudaDevAttrReserved129: 129>#
- cudaDevAttrNumaConfig = <cudaDeviceAttr.cudaDevAttrNumaConfig: 130>#
NUMA configuration of a device: value is of type
cudaDeviceNumaConfigenum
- cudaDevAttrNumaId = <cudaDeviceAttr.cudaDevAttrNumaId: 131>#
NUMA node ID of the GPU memory
- cudaDevAttrReserved132 = <cudaDeviceAttr.cudaDevAttrReserved132: 132>#
- cudaDevAttrMpsEnabled = <cudaDeviceAttr.cudaDevAttrMpsEnabled: 133>#
Contexts created on this device will be shared via MPS
- cudaDevAttrHostNumaId = <cudaDeviceAttr.cudaDevAttrHostNumaId: 134>#
NUMA ID of the host node closest to the device or -1 when system does not support NUMA
- cudaDevAttrD3D12CigSupported = <cudaDeviceAttr.cudaDevAttrD3D12CigSupported: 135>#
Device supports CIG with D3D12.
- cudaDevAttrVulkanCigSupported = <cudaDeviceAttr.cudaDevAttrVulkanCigSupported: 138>#
Device supports CIG with Vulkan.
- cudaDevAttrGpuPciDeviceId = <cudaDeviceAttr.cudaDevAttrGpuPciDeviceId: 139>#
The combined 16-bit PCI device ID and 16-bit PCI vendor ID.
- cudaDevAttrGpuPciSubsystemId = <cudaDeviceAttr.cudaDevAttrGpuPciSubsystemId: 140>#
The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID.
- cudaDevAttrReserved141 = <cudaDeviceAttr.cudaDevAttrReserved141: 141>#
- cudaDevAttrHostNumaMemoryPoolsSupported = <cudaDeviceAttr.cudaDevAttrHostNumaMemoryPoolsSupported: 142>#
Device supports HOST_NUMA location with the
cudaMallocAsyncandcudaMemPoolfamily of APIs
- cudaDevAttrHostNumaMultinodeIpcSupported = <cudaDeviceAttr.cudaDevAttrHostNumaMultinodeIpcSupported: 143>#
Device supports HostNuma location IPC between nodes in a multi-node system.
- cudaDevAttrHostMemoryPoolsSupported = <cudaDeviceAttr.cudaDevAttrHostMemoryPoolsSupported: 144>#
Device suports HOST location with the
cuMemAllocAsyncandcuMemPoolfamily of APIs
- cudaDevAttrReserved145 = <cudaDeviceAttr.cudaDevAttrReserved145: 145>#
- cudaDevAttrOnlyPartialHostNativeAtomicSupported = <cudaDeviceAttr.cudaDevAttrOnlyPartialHostNativeAtomicSupported: 147>#
Link between the device and the host supports only some native atomic operations
- cudaDevAttrMax = <cudaDeviceAttr.cudaDevAttrMax: 148>#
- class cuda.bindings.runtime.cudaMemPoolAttr(value: int)#
CUDA memory pool attributes
- cudaMemPoolReuseFollowEventDependencies = <cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies: 1>#
(value type = int) Allow cuMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering dependency of the allocating stream on the free action exists. Cuda events and null stream interactions can create the required stream ordered dependencies. (default enabled)
- cudaMemPoolReuseAllowOpportunistic = <cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic: 2>#
(value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled)
- cudaMemPoolReuseAllowInternalDependencies = <cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies: 3>#
(value type = int) Allow cuMemAllocAsync to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by cuFreeAsync (default enabled).
- cudaMemPoolAttrReleaseThreshold = <cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold: 4>#
(value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0)
- cudaMemPoolAttrReservedMemCurrent = <cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent: 5>#
(value type = cuuint64_t) Amount of backing memory currently allocated for the mempool.
- cudaMemPoolAttrReservedMemHigh = <cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh: 6>#
(value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset. High watermark can only be reset to zero.
- cudaMemPoolAttrUsedMemCurrent = <cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent: 7>#
(value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application.
- cudaMemPoolAttrUsedMemHigh = <cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh: 8>#
(value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset. High watermark can only be reset to zero.
- cudaMemPoolAttrAllocationType = <cudaMemPoolAttr.cudaMemPoolAttrAllocationType: 9>#
(value type = cudaMemAllocationType) The allocation type of the mempool
- cudaMemPoolAttrExportHandleTypes = <cudaMemPoolAttr.cudaMemPoolAttrExportHandleTypes: 10>#
(value type = cudaMemAllocationHandleType) Available export handle types for the mempool. For imported pools this value is always cudaMemHandleTypeNone as an imported pool cannot be re-exported
- cudaMemPoolAttrLocationId = <cudaMemPoolAttr.cudaMemPoolAttrLocationId: 11>#
(value type = int) The location id for the mempool. If the location type for this pool is cudaMemLocationTypeInvisible then ID will be cudaInvalidDeviceId
- cudaMemPoolAttrLocationType = <cudaMemPoolAttr.cudaMemPoolAttrLocationType: 12>#
(value type = cudaMemLocationType) The location type for the mempool. For imported memory pools where the device is not directly visible to the importing process or pools imported via fabric handles across nodes this will be cudaMemLocationTypeInvisible
- cudaMemPoolAttrMaxPoolSize = <cudaMemPoolAttr.cudaMemPoolAttrMaxPoolSize: 13>#
(value type = cuuint64_t) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cudaMemPoolCreate due to alignment requirements. A value of 0 indicates no maximum size. For cudaMemAllocationTypeManaged and IPC imported pools this value will be system dependent.
- cudaMemPoolAttrHwDecompressEnabled = <cudaMemPoolAttr.cudaMemPoolAttrHwDecompressEnabled: 14>#
(value type = int) Indicates whether the pool has hardware compresssion enabled
- class cuda.bindings.runtime.cudaMemLocationType(value: int)#
Specifies the type of location
- cudaMemLocationTypeInvalid = <cudaMemLocationType.cudaMemLocationTypeInvalid: 0>#
- cudaMemLocationTypeNone = <cudaMemLocationType.cudaMemLocationTypeNone: 0>#
Location is unspecified. This is used when creating a managed memory pool to indicate no preferred location for the pool
- cudaMemLocationTypeDevice = <cudaMemLocationType.cudaMemLocationTypeDevice: 1>#
Location is a device location, thus id is a device ordinal
- cudaMemLocationTypeHost = <cudaMemLocationType.cudaMemLocationTypeHost: 2>#
Location is host, id is ignored
- cudaMemLocationTypeHostNuma = <cudaMemLocationType.cudaMemLocationTypeHostNuma: 3>#
Location is a host NUMA node, thus id is a host NUMA node id
- cudaMemLocationTypeHostNumaCurrent = <cudaMemLocationType.cudaMemLocationTypeHostNumaCurrent: 4>#
Location is the host NUMA node closest to the current thread’s CPU, id is ignored
- cudaMemLocationTypeInvisible = <cudaMemLocationType.cudaMemLocationTypeInvisible: 5>#
Location is not visible but device is accessible, id is always cudaInvalidDeviceId
- class cuda.bindings.runtime.cudaMemAccessFlags(value: int)#
Specifies the memory protection flags for mapping.
- cudaMemAccessFlagsProtNone = <cudaMemAccessFlags.cudaMemAccessFlagsProtNone: 0>#
Default, make the address range not accessible
- cudaMemAccessFlagsProtRead = <cudaMemAccessFlags.cudaMemAccessFlagsProtRead: 1>#
Make the address range read accessible
- cudaMemAccessFlagsProtReadWrite = <cudaMemAccessFlags.cudaMemAccessFlagsProtReadWrite: 3>#
Make the address range read-write accessible
- class cuda.bindings.runtime.cudaMemAllocationType(value: int)#
Defines the allocation types available
- cudaMemAllocationTypeInvalid = <cudaMemAllocationType.cudaMemAllocationTypeInvalid: 0>#
- cudaMemAllocationTypePinned = <cudaMemAllocationType.cudaMemAllocationTypePinned: 1>#
This allocation type is ‘pinned’, i.e. cannot migrate from its current location while the application is actively using it
- cudaMemAllocationTypeManaged = <cudaMemAllocationType.cudaMemAllocationTypeManaged: 2>#
This allocation type is managed memory
- cudaMemAllocationTypeMax = <cudaMemAllocationType.cudaMemAllocationTypeMax: 2147483647>#
- class cuda.bindings.runtime.cudaMemAllocationHandleType(value: int)#
Flags for specifying particular handle types
- cudaMemHandleTypeNone = <cudaMemAllocationHandleType.cudaMemHandleTypeNone: 0>#
Does not allow any export mechanism. >
- cudaMemHandleTypePosixFileDescriptor = <cudaMemAllocationHandleType.cudaMemHandleTypePosixFileDescriptor: 1>#
Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int)
- cudaMemHandleTypeWin32 = <cudaMemAllocationHandleType.cudaMemHandleTypeWin32: 2>#
Allows a Win32 NT handle to be used for exporting. (HANDLE)
- cudaMemHandleTypeWin32Kmt = <cudaMemAllocationHandleType.cudaMemHandleTypeWin32Kmt: 4>#
Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE)
- cudaMemHandleTypeFabric = <cudaMemAllocationHandleType.cudaMemHandleTypeFabric: 8>#
Allows a fabric handle to be used for exporting. (cudaMemFabricHandle_t)
- class cuda.bindings.runtime.cudaGraphMemAttributeType(value: int)#
Graph memory attributes
- cudaGraphMemAttrUsedMemCurrent = <cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemCurrent: 0>#
(value type = cuuint64_t) Amount of memory, in bytes, currently associated with graphs.
- cudaGraphMemAttrUsedMemHigh = <cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemHigh: 1>#
(value type = cuuint64_t) 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 = <cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemCurrent: 2>#
(value type = cuuint64_t) Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
- cudaGraphMemAttrReservedMemHigh = <cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemHigh: 3>#
(value type = cuuint64_t) High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator.
- class cuda.bindings.runtime.cudaMemcpyFlags(value: int)#
Flags to specify for copies within a batch. For more details see :py:obj:`~.cudaMemcpyBatchAsync`.
- cudaMemcpyFlagDefault = <cudaMemcpyFlags.cudaMemcpyFlagDefault: 0>#
- cudaMemcpyFlagPreferOverlapWithCompute = <cudaMemcpyFlags.cudaMemcpyFlagPreferOverlapWithCompute: 1>#
Hint to the driver to try and overlap the copy with compute work on the SMs.
- class cuda.bindings.runtime.cudaMemcpySrcAccessOrder(value: int)#
- cudaMemcpySrcAccessOrderInvalid = <cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderInvalid: 0>#
Default invalid.
- cudaMemcpySrcAccessOrderStream = <cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderStream: 1>#
Indicates that access to the source pointer must be in stream order.
- cudaMemcpySrcAccessOrderDuringApiCall = <cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderDuringApiCall: 2>#
Indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it’s known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call.
- cudaMemcpySrcAccessOrderAny = <cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderAny: 3>#
Indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it’s known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms.
- cudaMemcpySrcAccessOrderMax = <cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderMax: 2147483647>#
- class cuda.bindings.runtime.cudaMemcpy3DOperandType(value: int)#
These flags allow applications to convey the operand type for individual copies specified in :py:obj:`~.cudaMemcpy3DBatchAsync`.
- cudaMemcpyOperandTypePointer = <cudaMemcpy3DOperandType.cudaMemcpyOperandTypePointer: 1>#
Memcpy operand is a valid pointer.
- cudaMemcpyOperandTypeArray = <cudaMemcpy3DOperandType.cudaMemcpyOperandTypeArray: 2>#
Memcpy operand is a CUarray.
- cudaMemcpyOperandTypeMax = <cudaMemcpy3DOperandType.cudaMemcpyOperandTypeMax: 2147483647>#
- class cuda.bindings.runtime.cudaDeviceP2PAttr(value: int)#
CUDA device P2P attributes
- cudaDevP2PAttrPerformanceRank = <cudaDeviceP2PAttr.cudaDevP2PAttrPerformanceRank: 1>#
A relative value indicating the performance of the link between two devices
- cudaDevP2PAttrAccessSupported = <cudaDeviceP2PAttr.cudaDevP2PAttrAccessSupported: 2>#
Peer access is enabled
- cudaDevP2PAttrNativeAtomicSupported = <cudaDeviceP2PAttr.cudaDevP2PAttrNativeAtomicSupported: 3>#
Native atomic operation over the link supported
- cudaDevP2PAttrCudaArrayAccessSupported = <cudaDeviceP2PAttr.cudaDevP2PAttrCudaArrayAccessSupported: 4>#
Accessing CUDA arrays over the link supported
- cudaDevP2PAttrOnlyPartialNativeAtomicSupported = <cudaDeviceP2PAttr.cudaDevP2PAttrOnlyPartialNativeAtomicSupported: 5>#
Only some CUDA-valid atomic operations over the link are supported.
- class cuda.bindings.runtime.cudaAtomicOperation(value: int)#
CUDA-valid Atomic Operations
- cudaAtomicOperationIntegerAdd = <cudaAtomicOperation.cudaAtomicOperationIntegerAdd: 0>#
- cudaAtomicOperationIntegerMin = <cudaAtomicOperation.cudaAtomicOperationIntegerMin: 1>#
- cudaAtomicOperationIntegerMax = <cudaAtomicOperation.cudaAtomicOperationIntegerMax: 2>#
- cudaAtomicOperationIntegerIncrement = <cudaAtomicOperation.cudaAtomicOperationIntegerIncrement: 3>#
- cudaAtomicOperationIntegerDecrement = <cudaAtomicOperation.cudaAtomicOperationIntegerDecrement: 4>#
- cudaAtomicOperationAnd = <cudaAtomicOperation.cudaAtomicOperationAnd: 5>#
- cudaAtomicOperationOr = <cudaAtomicOperation.cudaAtomicOperationOr: 6>#
- cudaAtomicOperationXOR = <cudaAtomicOperation.cudaAtomicOperationXOR: 7>#
- cudaAtomicOperationExchange = <cudaAtomicOperation.cudaAtomicOperationExchange: 8>#
- cudaAtomicOperationCAS = <cudaAtomicOperation.cudaAtomicOperationCAS: 9>#
- cudaAtomicOperationFloatAdd = <cudaAtomicOperation.cudaAtomicOperationFloatAdd: 10>#
- cudaAtomicOperationFloatMin = <cudaAtomicOperation.cudaAtomicOperationFloatMin: 11>#
- cudaAtomicOperationFloatMax = <cudaAtomicOperation.cudaAtomicOperationFloatMax: 12>#
- class cuda.bindings.runtime.cudaAtomicOperationCapability(value: int)#
CUDA-valid Atomic Operation capabilities
- class cuda.bindings.runtime.cudaExternalMemoryHandleType(value: int)#
External memory handle types
- cudaExternalMemoryHandleTypeOpaqueFd = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd: 1>#
Handle is an opaque file descriptor
- cudaExternalMemoryHandleTypeOpaqueWin32 = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32: 2>#
Handle is an opaque shared NT handle
- cudaExternalMemoryHandleTypeOpaqueWin32Kmt = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt: 3>#
Handle is an opaque, globally shared handle
- cudaExternalMemoryHandleTypeD3D12Heap = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap: 4>#
Handle is a D3D12 heap object
- cudaExternalMemoryHandleTypeD3D12Resource = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource: 5>#
Handle is a D3D12 committed resource
- cudaExternalMemoryHandleTypeD3D11Resource = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource: 6>#
Handle is a shared NT handle to a D3D11 resource
- cudaExternalMemoryHandleTypeD3D11ResourceKmt = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt: 7>#
Handle is a globally shared handle to a D3D11 resource
- cudaExternalMemoryHandleTypeNvSciBuf = <cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf: 8>#
Handle is an NvSciBuf object
- class cuda.bindings.runtime.cudaExternalSemaphoreHandleType(value: int)#
External semaphore handle types
- cudaExternalSemaphoreHandleTypeOpaqueFd = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd: 1>#
Handle is an opaque file descriptor
- cudaExternalSemaphoreHandleTypeOpaqueWin32 = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32: 2>#
Handle is an opaque shared NT handle
- cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt: 3>#
Handle is an opaque, globally shared handle
- cudaExternalSemaphoreHandleTypeD3D12Fence = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence: 4>#
Handle is a shared NT handle referencing a D3D12 fence object
- cudaExternalSemaphoreHandleTypeD3D11Fence = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence: 5>#
Handle is a shared NT handle referencing a D3D11 fence object
- cudaExternalSemaphoreHandleTypeNvSciSync = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync: 6>#
Opaque handle to NvSciSync Object
- cudaExternalSemaphoreHandleTypeKeyedMutex = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex: 7>#
Handle is a shared NT handle referencing a D3D11 keyed mutex object
- cudaExternalSemaphoreHandleTypeKeyedMutexKmt = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt: 8>#
Handle is a shared KMT handle referencing a D3D11 keyed mutex object
- cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd: 9>#
Handle is an opaque handle file descriptor referencing a timeline semaphore
- cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = <cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32: 10>#
Handle is an opaque handle file descriptor referencing a timeline semaphore
- class cuda.bindings.runtime.cudaDevSmResourceGroup_flags(value: int)#
Flags for a CUdevSmResource group
- cudaDevSmResourceGroupDefault = <cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupDefault: 0>#
- cudaDevSmResourceGroupBackfill = <cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupBackfill: 1>#
Lets smCount be a non-multiple of minCoscheduledCount, filling the difference with other SMs.
- class cuda.bindings.runtime.cudaDevSmResourceSplitByCount_flags(value: int)#
- cudaDevSmResourceSplitIgnoreSmCoscheduling = <cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitIgnoreSmCoscheduling: 1>#
- cudaDevSmResourceSplitMaxPotentialClusterSize = <cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitMaxPotentialClusterSize: 2>#
- class cuda.bindings.runtime.cudaDevResourceType(value: int)#
Type of resource
- cudaDevResourceTypeInvalid = <cudaDevResourceType.cudaDevResourceTypeInvalid: 0>#
- cudaDevResourceTypeSm = <cudaDevResourceType.cudaDevResourceTypeSm: 1>#
Streaming multiprocessors related information
- cudaDevResourceTypeWorkqueueConfig = <cudaDevResourceType.cudaDevResourceTypeWorkqueueConfig: 1000>#
Workqueue configuration related information
- cudaDevResourceTypeWorkqueue = <cudaDevResourceType.cudaDevResourceTypeWorkqueue: 10000>#
Pre-existing workqueue related information
- class cuda.bindings.runtime.cudaDevWorkqueueConfigScope(value: int)#
Sharing scope for workqueues
- cudaDevWorkqueueConfigScopeDeviceCtx = <cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeDeviceCtx: 0>#
Use all shared workqueue resources on the device. Default driver behaviour.
- cudaDevWorkqueueConfigScopeGreenCtxBalanced = <cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeGreenCtxBalanced: 1>#
When possible, use non-overlapping workqueue resources with other balanced green contexts.
- class cuda.bindings.runtime.cudaJitOption(value: int)#
Online compiler and linker options
- cudaJitMaxRegisters = <cudaJitOption.cudaJitMaxRegisters: 0>#
Max number of registers that a thread may use.
Option type: unsigned int
Applies to: compiler only
- cudaJitThreadsPerBlock = <cudaJitOption.cudaJitThreadsPerBlock: 1>#
IN: Specifies minimum number of threads per block to target compilation for
OUT: Returns the number of threads the compiler actually targeted. This restricts the resource utilization of the compiler (e.g. max registers) such that a block with the given number of threads should be able to launch based on register limitations. Note, this option does not currently take into account any other resource limitations, such as shared memory utilization.
Option type: unsigned int
Applies to: compiler only
- cudaJitWallTime = <cudaJitOption.cudaJitWallTime: 2>#
Overwrites the option value with the total wall clock time, in milliseconds, spent in the compiler and linker
Option type: float
Applies to: compiler and linker
- cudaJitInfoLogBuffer = <cudaJitOption.cudaJitInfoLogBuffer: 3>#
Pointer to a buffer in which to print any log messages that are informational in nature (the buffer size is specified via option
cudaJitInfoLogBufferSizeBytes)Option type: char *
Applies to: compiler and linker
- cudaJitInfoLogBufferSizeBytes = <cudaJitOption.cudaJitInfoLogBufferSizeBytes: 4>#
IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator)
OUT: Amount of log buffer filled with messages
Option type: unsigned int
Applies to: compiler and linker
- cudaJitErrorLogBuffer = <cudaJitOption.cudaJitErrorLogBuffer: 5>#
Pointer to a buffer in which to print any log messages that reflect errors (the buffer size is specified via option
cudaJitErrorLogBufferSizeBytes)Option type: char *
Applies to: compiler and linker
- cudaJitErrorLogBufferSizeBytes = <cudaJitOption.cudaJitErrorLogBufferSizeBytes: 6>#
IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator)
OUT: Amount of log buffer filled with messages
Option type: unsigned int
Applies to: compiler and linker
- cudaJitOptimizationLevel = <cudaJitOption.cudaJitOptimizationLevel: 7>#
Level of optimizations to apply to generated code (0 - 4), with 4 being the default and highest level of optimizations.
Option type: unsigned int
Applies to: compiler only
- cudaJitFallbackStrategy = <cudaJitOption.cudaJitFallbackStrategy: 10>#
Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied
cudaJit_Fallback. Option type: unsigned int for enumerated typecudaJit_FallbackApplies to: compiler only
- cudaJitGenerateDebugInfo = <cudaJitOption.cudaJitGenerateDebugInfo: 11>#
Specifies whether to create debug information in output (-g) (0: false, default)
Option type: int
Applies to: compiler and linker
- cudaJitLogVerbose = <cudaJitOption.cudaJitLogVerbose: 12>#
Generate verbose log messages (0: false, default)
Option type: int
Applies to: compiler and linker
- cudaJitGenerateLineInfo = <cudaJitOption.cudaJitGenerateLineInfo: 13>#
Generate line number information (-lineinfo) (0: false, default)
Option type: int
Applies to: compiler only
- cudaJitCacheMode = <cudaJitOption.cudaJitCacheMode: 14>#
Specifies whether to enable caching explicitly (-dlcm)
Choice is based on supplied
cudaJit_CacheMode.Option type: unsigned int for enumerated type
cudaJit_CacheModeApplies to: compiler only
- cudaJitPositionIndependentCode = <cudaJitOption.cudaJitPositionIndependentCode: 30>#
Generate position independent code (0: false)
Option type: int
Applies to: compiler only
- cudaJitMinCtaPerSm = <cudaJitOption.cudaJitMinCtaPerSm: 31>#
This option hints to the JIT compiler the minimum number of CTAs from the kernel’s grid to be mapped to a SM. This option is ignored when used together with
cudaJitMaxRegistersorcudaJitThreadsPerBlock. Optimizations based on this option needcudaJitMaxThreadsPerBlockto be specified as well. For kernels already using PTX directive .minnctapersm, this option will be ignored by default. UsecudaJitOverrideDirectiveValuesto let this option take precedence over the PTX directive. Option type: unsigned intApplies to: compiler only
- cudaJitMaxThreadsPerBlock = <cudaJitOption.cudaJitMaxThreadsPerBlock: 32>#
Maximum number threads in a thread block, computed as the product of the maximum extent specifed for each dimension of the block. This limit is guaranteed not to be exeeded in any invocation of the kernel. Exceeding the the maximum number of threads results in runtime error or kernel launch failure. For kernels already using PTX directive .maxntid, this option will be ignored by default. Use
cudaJitOverrideDirectiveValuesto let this option take precedence over the PTX directive. Option type: intApplies to: compiler only
- cudaJitOverrideDirectiveValues = <cudaJitOption.cudaJitOverrideDirectiveValues: 33>#
This option lets the values specified using
cudaJitMaxRegisters,cudaJitThreadsPerBlock,cudaJitMaxThreadsPerBlockandcudaJitMinCtaPerSmtake precedence over any PTX directives. (0: Disable, default; 1: Enable) Option type: intApplies to: compiler only
- class cuda.bindings.runtime.cudaLibraryOption(value: int)#
Library options to be specified with :py:obj:`~.cudaLibraryLoadData()` or :py:obj:`~.cudaLibraryLoadFromFile()`
- cudaLibraryHostUniversalFunctionAndDataTable = <cudaLibraryOption.cudaLibraryHostUniversalFunctionAndDataTable: 0>#
- cudaLibraryBinaryIsPreserved = <cudaLibraryOption.cudaLibraryBinaryIsPreserved: 1>#
Specifes that the argument code passed to
cudaLibraryLoadData()will be preserved. Specifying this option will let the driver know that code can be accessed at any point untilcudaLibraryUnload(). The default behavior is for the driver to allocate and maintain its own copy of code. Note that this is only a memory usage optimization hint and the driver can choose to ignore it if required. Specifying this option withcudaLibraryLoadFromFile()is invalid and will returncudaErrorInvalidValue.
- class cuda.bindings.runtime.cudaJit_CacheMode(value: int)#
Caching modes for dlcm
- cudaJitCacheOptionNone = <cudaJit_CacheMode.cudaJitCacheOptionNone: 0>#
Compile with no -dlcm flag specified
- cudaJitCacheOptionCG = <cudaJit_CacheMode.cudaJitCacheOptionCG: 1>#
Compile with L1 cache disabled
- cudaJitCacheOptionCA = <cudaJit_CacheMode.cudaJitCacheOptionCA: 2>#
Compile with L1 cache enabled
- class cuda.bindings.runtime.cudaJit_Fallback(value: int)#
Cubin matching fallback strategies
- cudaPreferPtx = <cudaJit_Fallback.cudaPreferPtx: 0>#
Prefer to compile ptx if exact binary match not found
- cudaPreferBinary = <cudaJit_Fallback.cudaPreferBinary: 1>#
Prefer to fall back to compatible binary code if exact match not found
- class cuda.bindings.runtime.cudaCGScope(value: int)#
CUDA cooperative group scope
- cudaCGScopeInvalid = <cudaCGScope.cudaCGScopeInvalid: 0>#
Invalid cooperative group scope
- cudaCGScopeGrid = <cudaCGScope.cudaCGScopeGrid: 1>#
Scope represented by a grid_group
- cudaCGScopeReserved = <cudaCGScope.cudaCGScopeReserved: 2>#
Reserved
- class cuda.bindings.runtime.cudaKernelFunctionType(value: int)#
CUDA Kernel Function Handle Type
- cudaKernelFunctionTypeUnspecified = <cudaKernelFunctionType.cudaKernelFunctionTypeUnspecified: 0>#
CUDA will attempt to deduce the type of the function handle
- cudaKernelFunctionTypeDeviceEntry = <cudaKernelFunctionType.cudaKernelFunctionTypeDeviceEntry: 1>#
Function handle is a device-entry function pointer(i.e. global function pointer)
- cudaKernelFunctionTypeKernel = <cudaKernelFunctionType.cudaKernelFunctionTypeKernel: 2>#
Function handle is a cudaKernel_t
- cudaKernelFunctionTypeFunction = <cudaKernelFunctionType.cudaKernelFunctionTypeFunction: 3>#
Function handle is a cudaFunction_t
- class cuda.bindings.runtime.cudaGraphConditionalHandleFlags(value: int)#
- cudaGraphCondAssignDefault = <cudaGraphConditionalHandleFlags.cudaGraphCondAssignDefault: 1>#
Apply default handle value when graph is launched.
- class cuda.bindings.runtime.cudaGraphConditionalNodeType(value: int)#
CUDA conditional node types
- cudaGraphCondTypeIf = <cudaGraphConditionalNodeType.cudaGraphCondTypeIf: 0>#
Conditional ‘if/else’ Node. Body[0] executed if condition is non-zero. If size == 2, an optional ELSE graph is created and this is executed if the condition is zero.
- cudaGraphCondTypeWhile = <cudaGraphConditionalNodeType.cudaGraphCondTypeWhile: 1>#
Conditional ‘while’ Node. Body executed repeatedly while condition value is non-zero.
- cudaGraphCondTypeSwitch = <cudaGraphConditionalNodeType.cudaGraphCondTypeSwitch: 2>#
Conditional ‘switch’ Node. Body[n] is executed once, where ‘n’ is the value of the condition. If the condition does not match a body index, no body is launched.
- class cuda.bindings.runtime.cudaGraphNodeType(value: int)#
CUDA Graph node types
- cudaGraphNodeTypeKernel = <cudaGraphNodeType.cudaGraphNodeTypeKernel: 0>#
GPU kernel node
- cudaGraphNodeTypeMemcpy = <cudaGraphNodeType.cudaGraphNodeTypeMemcpy: 1>#
Memcpy node
- cudaGraphNodeTypeMemset = <cudaGraphNodeType.cudaGraphNodeTypeMemset: 2>#
Memset node
- cudaGraphNodeTypeHost = <cudaGraphNodeType.cudaGraphNodeTypeHost: 3>#
Host (executable) node
- cudaGraphNodeTypeGraph = <cudaGraphNodeType.cudaGraphNodeTypeGraph: 4>#
Node which executes an embedded graph
- cudaGraphNodeTypeEmpty = <cudaGraphNodeType.cudaGraphNodeTypeEmpty: 5>#
Empty (no-op) node
- cudaGraphNodeTypeWaitEvent = <cudaGraphNodeType.cudaGraphNodeTypeWaitEvent: 6>#
External event wait node
- cudaGraphNodeTypeEventRecord = <cudaGraphNodeType.cudaGraphNodeTypeEventRecord: 7>#
External event record node
- cudaGraphNodeTypeExtSemaphoreSignal = <cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal: 8>#
External semaphore signal node
- cudaGraphNodeTypeExtSemaphoreWait = <cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait: 9>#
External semaphore wait node
- cudaGraphNodeTypeMemAlloc = <cudaGraphNodeType.cudaGraphNodeTypeMemAlloc: 10>#
Memory allocation node
- cudaGraphNodeTypeMemFree = <cudaGraphNodeType.cudaGraphNodeTypeMemFree: 11>#
Memory free node
- cudaGraphNodeTypeConditional = <cudaGraphNodeType.cudaGraphNodeTypeConditional: 13>#
Conditional node May be used to implement a conditional execution path or loop
inside of a graph. The graph(s) contained within the body of the conditional node
can be selectively executed or iterated upon based on the value of a conditional
variable.
Handles must be created in advance of creating the node
using
cudaGraphConditionalHandleCreate.The following restrictions apply to graphs which contain conditional nodes:
The graph cannot be used in a child node.
Only one instantiation of the graph may exist at any point in time.
The graph cannot be cloned.
To set the control value, supply a default value when creating the handle and/or
call
cudaGraphSetConditionalfrom device code.
- cudaGraphNodeTypeCount = <cudaGraphNodeType.cudaGraphNodeTypeCount: 14>#
- class cuda.bindings.runtime.cudaGraphChildGraphNodeOwnership(value: int)#
Child graph node ownership
- cudaGraphChildGraphOwnershipClone = <cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipClone: 0>#
Default behavior for a child graph node. Child graph is cloned into the parent and memory allocation/free nodes can’t be present in the child graph.
- cudaGraphChildGraphOwnershipMove = <cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipMove: 1>#
The child graph is moved to the parent. The handle to the child graph is owned by the parent and will be destroyed when the parent is destroyed.
The following restrictions apply to child graphs after they have been moved: Cannot be independently instantiated or destroyed; Cannot be added as a child graph of a separate parent graph; Cannot be used as an argument to cudaGraphExecUpdate; Cannot have additional memory allocation or free nodes added.
- cudaGraphChildGraphOwnershipInvalid = <cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipInvalid: -1>#
Invalid ownership flag. Set when params are queried to prevent accidentally reusing the driver-owned graph object
- class cuda.bindings.runtime.cudaGraphDependencyType(value: int)#
Type annotations that can be applied to graph edges as part of :py:obj:`~.cudaGraphEdgeData`.
- cudaGraphDependencyTypeDefault = <cudaGraphDependencyType.cudaGraphDependencyTypeDefault: 0>#
This is an ordinary dependency.
- cudaGraphDependencyTypeProgrammatic = <cudaGraphDependencyType.cudaGraphDependencyTypeProgrammatic: 1>#
This dependency type allows the downstream node to use cudaGridDependencySynchronize(). It may only be used between kernel nodes, and must be used with either the
cudaGraphKernelNodePortProgrammaticorcudaGraphKernelNodePortLaunchCompletionoutgoing port.
- class cuda.bindings.runtime.cudaGraphExecUpdateResult(value: int)#
CUDA Graph Update error types
- cudaGraphExecUpdateSuccess = <cudaGraphExecUpdateResult.cudaGraphExecUpdateSuccess: 0>#
The update succeeded
- cudaGraphExecUpdateError = <cudaGraphExecUpdateResult.cudaGraphExecUpdateError: 1>#
The update failed for an unexpected reason which is described in the return value of the function
- cudaGraphExecUpdateErrorTopologyChanged = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorTopologyChanged: 2>#
The update failed because the topology changed
- cudaGraphExecUpdateErrorNodeTypeChanged = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNodeTypeChanged: 3>#
The update failed because a node type changed
- cudaGraphExecUpdateErrorFunctionChanged = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorFunctionChanged: 4>#
The update failed because the function of a kernel node changed (CUDA driver < 11.2)
- cudaGraphExecUpdateErrorParametersChanged = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorParametersChanged: 5>#
The update failed because the parameters changed in a way that is not supported
- cudaGraphExecUpdateErrorNotSupported = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNotSupported: 6>#
The update failed because something about the node is not supported
- cudaGraphExecUpdateErrorUnsupportedFunctionChange = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorUnsupportedFunctionChange: 7>#
The update failed because the function of a kernel node changed in an unsupported way
- cudaGraphExecUpdateErrorAttributesChanged = <cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorAttributesChanged: 8>#
The update failed because the node attributes changed in a way that is not supported
- class cuda.bindings.runtime.cudaGraphInstantiateResult(value: int)#
Graph instantiation results
- cudaGraphInstantiateSuccess = <cudaGraphInstantiateResult.cudaGraphInstantiateSuccess: 0>#
Instantiation succeeded
- cudaGraphInstantiateError = <cudaGraphInstantiateResult.cudaGraphInstantiateError: 1>#
Instantiation failed for an unexpected reason which is described in the return value of the function
- cudaGraphInstantiateInvalidStructure = <cudaGraphInstantiateResult.cudaGraphInstantiateInvalidStructure: 2>#
Instantiation failed due to invalid structure, such as cycles
- cudaGraphInstantiateNodeOperationNotSupported = <cudaGraphInstantiateResult.cudaGraphInstantiateNodeOperationNotSupported: 3>#
Instantiation for device launch failed because the graph contained an unsupported operation
- cudaGraphInstantiateMultipleDevicesNotSupported = <cudaGraphInstantiateResult.cudaGraphInstantiateMultipleDevicesNotSupported: 4>#
Instantiation for device launch failed due to the nodes belonging to different contexts
- cudaGraphInstantiateConditionalHandleUnused = <cudaGraphInstantiateResult.cudaGraphInstantiateConditionalHandleUnused: 5>#
One or more conditional handles are not associated with conditional nodes
- class cuda.bindings.runtime.cudaGraphKernelNodeField(value: int)#
Specifies the field to update when performing multiple node updates from the device
- cudaGraphKernelNodeFieldInvalid = <cudaGraphKernelNodeField.cudaGraphKernelNodeFieldInvalid: 0>#
Invalid field
- cudaGraphKernelNodeFieldGridDim = <cudaGraphKernelNodeField.cudaGraphKernelNodeFieldGridDim: 1>#
Grid dimension update
- cudaGraphKernelNodeFieldParam = <cudaGraphKernelNodeField.cudaGraphKernelNodeFieldParam: 2>#
Kernel parameter update
- cudaGraphKernelNodeFieldEnabled = <cudaGraphKernelNodeField.cudaGraphKernelNodeFieldEnabled: 3>#
Node enable/disable
- class cuda.bindings.runtime.cudaGetDriverEntryPointFlags(value: int)#
Flags to specify search options to be used with :py:obj:`~.cudaGetDriverEntryPoint` For more details see :py:obj:`~.cuGetProcAddress`
- cudaEnableDefault = <cudaGetDriverEntryPointFlags.cudaEnableDefault: 0>#
Default search mode for driver symbols.
- cudaEnableLegacyStream = <cudaGetDriverEntryPointFlags.cudaEnableLegacyStream: 1>#
Search for legacy versions of driver symbols.
- cudaEnablePerThreadDefaultStream = <cudaGetDriverEntryPointFlags.cudaEnablePerThreadDefaultStream: 2>#
Search for per-thread versions of driver symbols.
- class cuda.bindings.runtime.cudaDriverEntryPointQueryResult(value: int)#
Enum for status from obtaining driver entry points, used with :py:obj:`~.cudaApiGetDriverEntryPoint`
- cudaDriverEntryPointSuccess = <cudaDriverEntryPointQueryResult.cudaDriverEntryPointSuccess: 0>#
Search for symbol found a match
- cudaDriverEntryPointSymbolNotFound = <cudaDriverEntryPointQueryResult.cudaDriverEntryPointSymbolNotFound: 1>#
Search for symbol was not found
- cudaDriverEntryPointVersionNotSufficent = <cudaDriverEntryPointQueryResult.cudaDriverEntryPointVersionNotSufficent: 2>#
Search for symbol was found but version wasn’t great enough
- class cuda.bindings.runtime.cudaGraphDebugDotFlags(value: int)#
CUDA Graph debug write options
- cudaGraphDebugDotFlagsVerbose = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsVerbose: 1>#
Output all debug data as if every debug flag is enabled
- cudaGraphDebugDotFlagsKernelNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeParams: 4>#
Adds
cudaKernelNodeParamsto output
- cudaGraphDebugDotFlagsMemcpyNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemcpyNodeParams: 8>#
Adds
cudaMemcpy3DParmsto output
- cudaGraphDebugDotFlagsMemsetNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemsetNodeParams: 16>#
Adds
cudaMemsetParamsto output
- cudaGraphDebugDotFlagsHostNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHostNodeParams: 32>#
Adds
cudaHostNodeParamsto output
- cudaGraphDebugDotFlagsEventNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsEventNodeParams: 64>#
Adds cudaEvent_t handle from record and wait nodes to output
- cudaGraphDebugDotFlagsExtSemasSignalNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasSignalNodeParams: 128>#
Adds
cudaExternalSemaphoreSignalNodeParamsvalues to output
- cudaGraphDebugDotFlagsExtSemasWaitNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasWaitNodeParams: 256>#
Adds
cudaExternalSemaphoreWaitNodeParamsto output
- cudaGraphDebugDotFlagsKernelNodeAttributes = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeAttributes: 512>#
Adds cudaKernelNodeAttrID values to output
- cudaGraphDebugDotFlagsHandles = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHandles: 1024>#
Adds node handles and every kernel function handle to output
- cudaGraphDebugDotFlagsConditionalNodeParams = <cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsConditionalNodeParams: 32768>#
Adds
cudaConditionalNodeParamsto output
- class cuda.bindings.runtime.cudaGraphInstantiateFlags(value: int)#
Flags for instantiating a graph
- cudaGraphInstantiateFlagAutoFreeOnLaunch = <cudaGraphInstantiateFlags.cudaGraphInstantiateFlagAutoFreeOnLaunch: 1>#
Automatically free memory allocated in a graph before relaunching.
- cudaGraphInstantiateFlagUpload = <cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUpload: 2>#
Automatically upload the graph after instantiation. Only supported by
cudaGraphInstantiateWithParams. The upload will be performed using thestream provided in instantiateParams.
- cudaGraphInstantiateFlagDeviceLaunch = <cudaGraphInstantiateFlags.cudaGraphInstantiateFlagDeviceLaunch: 4>#
Instantiate the graph to be launchable from the device. This flag can only
be used on platforms which support unified addressing. This flag cannot be
used in conjunction with cudaGraphInstantiateFlagAutoFreeOnLaunch.
- cudaGraphInstantiateFlagUseNodePriority = <cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUseNodePriority: 8>#
Run the graph using the per-node priority attributes rather than the priority of the stream it is launched into.
- class cuda.bindings.runtime.cudaLaunchMemSyncDomain(value: int)#
Memory Synchronization Domain A kernel can be launched in a specified memory synchronization domain that affects all memory operations issued by that kernel. A memory barrier issued in one domain will only order memory operations in that domain, thus eliminating latency increase from memory barriers ordering unrelated traffic. By default, kernels are launched in domain 0. Kernel launched with :py:obj:`~.cudaLaunchMemSyncDomainRemote` will have a different domain ID. User may also alter the domain ID with :py:obj:`~.cudaLaunchMemSyncDomainMap` for a specific stream / graph node / kernel launch. See :py:obj:`~.cudaLaunchAttributeMemSyncDomain`, :py:obj:`~.cudaStreamSetAttribute`, :py:obj:`~.cudaLaunchKernelEx`, :py:obj:`~.cudaGraphKernelNodeSetAttribute`. Memory operations done in kernels launched in different domains are considered system-scope distanced. In other words, a GPU scoped memory synchronization is not sufficient for memory order to be observed by kernels in another memory synchronization domain even if they are on the same GPU.
- cudaLaunchMemSyncDomainDefault = <cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainDefault: 0>#
Launch kernels in the default domain
- cudaLaunchMemSyncDomainRemote = <cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainRemote: 1>#
Launch kernels in the remote domain
- class cuda.bindings.runtime.cudaLaunchAttributePortableClusterMode(value: int)#
Enum for defining applicability of portable cluster size, used with :py:obj:`~.cudaLaunchKernelEx`
- cudaLaunchPortableClusterModeDefault = <cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeDefault: 0>#
The default to use for allowing non-portable cluster size on launch - uses current function attribute for
cudaFuncAttributeNonPortableClusterSizeAllowed
- cudaLaunchPortableClusterModeRequirePortable = <cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeRequirePortable: 1>#
Specifies that the cluster size requested must be a portable size
- cudaLaunchPortableClusterModeAllowNonPortable = <cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeAllowNonPortable: 2>#
Specifies that the cluster size requested may be a non-portable size
Shared memory related attributes for use with :py:obj:`~.cuLaunchKernelEx`
The default to use for allowing non-portable shared memory size on launch - uses current function attributes for
cudaFuncAttributeMaxDynamicSharedMemorySize
Specifies that the shared memory size requested must be a portable size within
cudaDevAttrMaxSharedMemoryPerBlock
Specifies that the shared memory size requested may be a non-portable size up to
cudaDevAttrMaxSharedMemoryPerBlockOptin
- class cuda.bindings.runtime.cudaLaunchAttributeID(value: int)#
Launch attributes enum; used as id field of :py:obj:`~.cudaLaunchAttribute`
- cudaLaunchAttributeIgnore = <cudaLaunchAttributeID.cudaLaunchAttributeIgnore: 0>#
Ignored entry, for convenient composition
- cudaLaunchAttributeAccessPolicyWindow = <cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow: 1>#
Valid for streams, graph nodes, launches. See
cudaLaunchAttributeValue::accessPolicyWindow.
- cudaLaunchAttributeCooperative = <cudaLaunchAttributeID.cudaLaunchAttributeCooperative: 2>#
Valid for graph nodes, launches. See
cudaLaunchAttributeValue::cooperative.
- cudaLaunchAttributeSynchronizationPolicy = <cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy: 3>#
Valid for streams. See
cudaLaunchAttributeValue::syncPolicy.
- cudaLaunchAttributeClusterDimension = <cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension: 4>#
Valid for graph nodes, launches. See
cudaLaunchAttributeValue::clusterDim.
- cudaLaunchAttributeClusterSchedulingPolicyPreference = <cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference: 5>#
Valid for graph nodes, launches. See
cudaLaunchAttributeValue::clusterSchedulingPolicyPreference.
- cudaLaunchAttributeProgrammaticStreamSerialization = <cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization: 6>#
Valid for launches. Setting
cudaLaunchAttributeValue::programmaticStreamSerializationAllowed to non-0 signals that the kernel will use programmatic means to resolve its stream dependency, so that the CUDA runtime should opportunistically allow the grid’s execution to overlap with the previous kernel in the stream, if that kernel requests the overlap. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions).
- cudaLaunchAttributeProgrammaticEvent = <cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent: 7>#
Valid for launches. Set
cudaLaunchAttributeValue::programmaticEvent to record the event. Event recorded through this launch attribute is guaranteed to only trigger after all block in the associated kernel trigger the event. A block can trigger the event programmatically in a future CUDA release. A trigger can also be inserted at the beginning of each block’s execution if triggerAtBlockStart is set to non-0. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions). Note that dependents (including the CPU thread callingcudaEventSynchronize()) are not guaranteed to observe the release precisely when it is released. For example,cudaEventSynchronize()may only observe the event trigger long after the associated kernel has completed. This recording type is primarily meant for establishing programmatic dependency between device tasks. Note also this type of dependency allows, but does not guarantee, concurrent execution of tasks.The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the
cudaEventDisableTimingflag set).
- cudaLaunchAttributePriority = <cudaLaunchAttributeID.cudaLaunchAttributePriority: 8>#
Valid for streams, graph nodes, launches. See
cudaLaunchAttributeValue::priority.
- cudaLaunchAttributeMemSyncDomainMap = <cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap: 9>#
Valid for streams, graph nodes, launches. See
cudaLaunchAttributeValue::memSyncDomainMap.
- cudaLaunchAttributeMemSyncDomain = <cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain: 10>#
Valid for streams, graph nodes, launches. See
cudaLaunchAttributeValue::memSyncDomain.
- cudaLaunchAttributePreferredClusterDimension = <cudaLaunchAttributeID.cudaLaunchAttributePreferredClusterDimension: 11>#
Valid for graph nodes and launches. Set
cudaLaunchAttributeValue::preferredClusterDim to allow the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either the dimensions specified with this attribute (grouped into a “preferred substitute cluster”), or the one specified withcudaLaunchAttributeClusterDimensionattribute (grouped into a “regular cluster”). The cluster dimensions of a “preferred substitute cluster” shall be an integer multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch the regular clusters instead to attempt to utilize as much of the physical device resources as possible.Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks.
This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute cluster dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide the grid. It must also be no more than maxBlocksPerCluster, if it is set in the kernel’s __launch_bounds__. Otherwise it must be less than the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable to fit on any particular device is permitted.
- cudaLaunchAttributeLaunchCompletionEvent = <cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent: 12>#
Valid for launches. Set
cudaLaunchAttributeValue::launchCompletionEvent to record the event.Nominally, the event is triggered once all blocks of the kernel have begun execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example if B can claim execution resources unavailable to A (e.g. they run on different GPUs) or if B is a higher priority than A. Exercise caution if such an ordering inversion could lead to deadlock.
A launch completion event is nominally similar to a programmatic event with triggerAtBlockStart set except that it is not visible to cudaGridDependencySynchronize() and can be used with compute capability less than 9.0.
The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the
cudaEventDisableTimingflag set).
- cudaLaunchAttributeDeviceUpdatableKernelNode = <cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode: 13>#
Valid for graph nodes, launches. This attribute is graphs-only, and passing it to a launch in a non-capturing stream will result in an error.
:cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can only be set to 0 or 1. Setting the field to 1 indicates that the corresponding kernel node should be device-updatable. On success, a handle will be returned via
cudaLaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be passed to the various device-side update functions to update the node’s kernel parameters from within another kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof, seecudaGraphKernelNodeUpdatesApply.Nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable nodes cannot be removed from their graph via
cudaGraphDestroyNode. Additionally, once opted-in to this functionality, a node cannot opt out, and any attempt to set the deviceUpdatable attribute to 0 will result in an error. Device-updatable kernel nodes also cannot have their attributes copied to/from another kernel node viacudaGraphKernelNodeCopyAttributes. Graphs containing one or more device-updatable nodes also do not allow multiple instantiation, and neither the graph nor its instantiated version can be passed tocudaGraphExecUpdate.If a graph contains device-updatable nodes and updates those nodes from the device from within the graph, the graph must be uploaded with
cuGraphUploadbefore it is launched. For such a graph, if host-side executable graph updates are made to the device-updatable nodes, the graph must be uploaded before it is launched again.
Valid for launches. On devices where the L1 cache and shared memory use the same hardware resources, setting
cudaLaunchAttributeValue::sharedMemCarveout to a percentage between 0-100 signals sets the shared memory carveout preference in percent of the total shared memory for that kernel launch. This attribute takes precedence overcudaFuncAttributePreferredSharedMemoryCarveout. This is only a hint, and the driver can choose a different configuration if required for the launch.
- cudaLaunchAttributeNvlinkUtilCentricScheduling = <cudaLaunchAttributeID.cudaLaunchAttributeNvlinkUtilCentricScheduling: 16>#
Valid for streams, graph nodes, launches. This attribute is a hint to the CUDA runtime that the launch should attempt to make the kernel maximize its NVLINK utilization.
When possible to honor this hint, CUDA will assume each block in the grid launch will carry out an even amount of NVLINK traffic, and make a best-effort attempt to adjust the kernel launch based on that assumption.
This attribute is a hint only. CUDA makes no functional or performance guarantee. Its applicability can be affected by many different factors, including driver version (i.e. CUDA doesn’t guarantee the performance characteristics will be maintained between driver versions or a driver update could alter or regress previously observed perf characteristics.) It also doesn’t guarantee a successful result, i.e. applying the attribute may not improve the performance of either the targeted kernel or the encapsulating application.
Valid values for
cudaLaunchAttributeValue::nvlinkUtilCentricScheduling are 0 (disabled) and 1 (enabled).
- cudaLaunchAttributePortableClusterSizeMode = <cudaLaunchAttributeID.cudaLaunchAttributePortableClusterSizeMode: 17>#
Valid for graph nodes, launches. This indicates whether the kernel launch is allowed to use a non-portable cluster size. Valid values for
cudaLaunchAttributeValue::portableClusterSizeMode are values forcudaLaunchAttributePortableClusterModeAny other value will returncudaErrorInvalidValue
Valid for graph nodes, launches. This indicates that the kernel launch is allowed to use a non-portable shared memory mode.
- class cuda.bindings.runtime.cudaDeviceNumaConfig(value: int)#
CUDA device NUMA config
- cudaDeviceNumaConfigNone = <cudaDeviceNumaConfig.cudaDeviceNumaConfigNone: 0>#
The GPU is not a NUMA node
- cudaDeviceNumaConfigNumaNode = <cudaDeviceNumaConfig.cudaDeviceNumaConfigNumaNode: 1>#
The GPU is a NUMA node, cudaDevAttrNumaId contains its NUMA ID
- class cuda.bindings.runtime.cudaAsyncNotificationType(value: int)#
Types of async notification that can occur
- cudaAsyncNotificationTypeOverBudget = <cudaAsyncNotificationType.cudaAsyncNotificationTypeOverBudget: 1>#
Sent when the process has exceeded its device memory budget
- class cuda.bindings.runtime.cudaLogLevel(value: int)#
- cudaLogLevelError = <cudaLogLevel.cudaLogLevelError: 0>#
- cudaLogLevelWarning = <cudaLogLevel.cudaLogLevelWarning: 1>#
- class cuda.bindings.runtime.cudaSurfaceBoundaryMode(value: int)#
CUDA Surface boundary modes
- cudaBoundaryModeZero = <cudaSurfaceBoundaryMode.cudaBoundaryModeZero: 0>#
Zero boundary mode
- cudaBoundaryModeClamp = <cudaSurfaceBoundaryMode.cudaBoundaryModeClamp: 1>#
Clamp boundary mode
- cudaBoundaryModeTrap = <cudaSurfaceBoundaryMode.cudaBoundaryModeTrap: 2>#
Trap boundary mode
- class cuda.bindings.runtime.cudaSurfaceFormatMode(value: int)#
CUDA Surface format modes
- cudaFormatModeForced = <cudaSurfaceFormatMode.cudaFormatModeForced: 0>#
Forced format mode
- cudaFormatModeAuto = <cudaSurfaceFormatMode.cudaFormatModeAuto: 1>#
Auto format mode
- class cuda.bindings.runtime.cudaTextureAddressMode(value: int)#
CUDA texture address modes
- cudaAddressModeWrap = <cudaTextureAddressMode.cudaAddressModeWrap: 0>#
Wrapping address mode
- cudaAddressModeClamp = <cudaTextureAddressMode.cudaAddressModeClamp: 1>#
Clamp to edge address mode
- cudaAddressModeMirror = <cudaTextureAddressMode.cudaAddressModeMirror: 2>#
Mirror address mode
- cudaAddressModeBorder = <cudaTextureAddressMode.cudaAddressModeBorder: 3>#
Border address mode
- class cuda.bindings.runtime.cudaTextureFilterMode(value: int)#
CUDA texture filter modes
- cudaFilterModePoint = <cudaTextureFilterMode.cudaFilterModePoint: 0>#
Point filter mode
- cudaFilterModeLinear = <cudaTextureFilterMode.cudaFilterModeLinear: 1>#
Linear filter mode
- class cuda.bindings.runtime.cudaTextureReadMode(value: int)#
CUDA texture read modes
- cudaReadModeElementType = <cudaTextureReadMode.cudaReadModeElementType: 0>#
Read texture as specified element type
- cudaReadModeNormalizedFloat = <cudaTextureReadMode.cudaReadModeNormalizedFloat: 1>#
Read texture as normalized float
- class cuda.bindings.runtime.cudaEglFrameType(value: int)#
CUDA EglFrame type - array or pointer
- cudaEglFrameTypeArray = <cudaEglFrameType.cudaEglFrameTypeArray: 0>#
Frame type CUDA array
- cudaEglFrameTypePitch = <cudaEglFrameType.cudaEglFrameTypePitch: 1>#
Frame type CUDA pointer
- class cuda.bindings.runtime.cudaEglResourceLocationFlags(value: int)#
Resource location flags- sysmem or vidmem For CUDA context on iGPU, since video and system memory are equivalent - these flags will not have an effect on the execution. For CUDA context on dGPU, applications can use the flag :py:obj:`~.cudaEglResourceLocationFlags` to give a hint about the desired location. :py:obj:`~.cudaEglResourceLocationSysmem` - the frame data is made resident on the system memory to be accessed by CUDA. :py:obj:`~.cudaEglResourceLocationVidmem` - the frame data is made resident on the dedicated video memory to be accessed by CUDA. There may be an additional latency due to new allocation and data migration, if the frame is produced on a different memory.
- cudaEglResourceLocationSysmem = <cudaEglResourceLocationFlags.cudaEglResourceLocationSysmem: 0>#
Resource location sysmem
- cudaEglResourceLocationVidmem = <cudaEglResourceLocationFlags.cudaEglResourceLocationVidmem: 1>#
Resource location vidmem
- class cuda.bindings.runtime.cudaEglColorFormat(value: int)#
CUDA EGL Color Format - The different planar and multiplanar formats currently supported for CUDA_EGL interops.
- cudaEglColorFormatYUV420Planar = <cudaEglColorFormat.cudaEglColorFormatYUV420Planar: 0>#
Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYUV420SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar: 1>#
Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar.
- cudaEglColorFormatYUV422Planar = <cudaEglColorFormat.cudaEglColorFormatYUV422Planar: 2>#
Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYUV422SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYUV422SemiPlanar: 3>#
Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar.
- cudaEglColorFormatARGB = <cudaEglColorFormat.cudaEglColorFormatARGB: 6>#
R/G/B/A four channels in one surface with BGRA byte ordering.
- cudaEglColorFormatRGBA = <cudaEglColorFormat.cudaEglColorFormatRGBA: 7>#
R/G/B/A four channels in one surface with ABGR byte ordering.
- cudaEglColorFormatL = <cudaEglColorFormat.cudaEglColorFormatL: 8>#
single luminance channel in one surface.
- cudaEglColorFormatR = <cudaEglColorFormat.cudaEglColorFormatR: 9>#
single color channel in one surface.
- cudaEglColorFormatYUV444Planar = <cudaEglColorFormat.cudaEglColorFormatYUV444Planar: 10>#
Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYUV444SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYUV444SemiPlanar: 11>#
Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar.
- cudaEglColorFormatYUYV422 = <cudaEglColorFormat.cudaEglColorFormatYUYV422: 12>#
Y, U, V in one surface, interleaved as UYVY in one channel.
- cudaEglColorFormatUYVY422 = <cudaEglColorFormat.cudaEglColorFormatUYVY422: 13>#
Y, U, V in one surface, interleaved as YUYV in one channel.
- cudaEglColorFormatABGR = <cudaEglColorFormat.cudaEglColorFormatABGR: 14>#
R/G/B/A four channels in one surface with RGBA byte ordering.
- cudaEglColorFormatBGRA = <cudaEglColorFormat.cudaEglColorFormatBGRA: 15>#
R/G/B/A four channels in one surface with ARGB byte ordering.
- cudaEglColorFormatA = <cudaEglColorFormat.cudaEglColorFormatA: 16>#
Alpha color format - one channel in one surface.
- cudaEglColorFormatRG = <cudaEglColorFormat.cudaEglColorFormatRG: 17>#
R/G color format - two channels in one surface with GR byte ordering
- cudaEglColorFormatAYUV = <cudaEglColorFormat.cudaEglColorFormatAYUV: 18>#
Y, U, V, A four channels in one surface, interleaved as VUYA.
- cudaEglColorFormatYVU444SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYVU444SemiPlanar: 19>#
Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYVU422SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYVU422SemiPlanar: 20>#
Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYVU420SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar: 21>#
Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_444SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar: 22>#
Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatY10V10U10_420SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar: 23>#
Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY12V12U12_444SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar: 24>#
Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatY12V12U12_420SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar: 25>#
Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatVYUY_ER = <cudaEglColorFormat.cudaEglColorFormatVYUY_ER: 26>#
Extended Range Y, U, V in one surface, interleaved as YVYU in one channel.
- cudaEglColorFormatUYVY_ER = <cudaEglColorFormat.cudaEglColorFormatUYVY_ER: 27>#
Extended Range Y, U, V in one surface, interleaved as YUYV in one channel.
- cudaEglColorFormatYUYV_ER = <cudaEglColorFormat.cudaEglColorFormatYUYV_ER: 28>#
Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.
- cudaEglColorFormatYVYU_ER = <cudaEglColorFormat.cudaEglColorFormatYVYU_ER: 29>#
Extended Range Y, U, V in one surface, interleaved as VYUY in one channel.
- cudaEglColorFormatYUVA_ER = <cudaEglColorFormat.cudaEglColorFormatYUVA_ER: 31>#
Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY.
- cudaEglColorFormatAYUV_ER = <cudaEglColorFormat.cudaEglColorFormatAYUV_ER: 32>#
Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA.
- cudaEglColorFormatYUV444Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV444Planar_ER: 33>#
Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYUV422Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV422Planar_ER: 34>#
Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYUV420Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV420Planar_ER: 35>#
Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYUV444SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV444SemiPlanar_ER: 36>#
Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYUV422SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV422SemiPlanar_ER: 37>#
Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYUV420SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_ER: 38>#
Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU444Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU444Planar_ER: 39>#
Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYVU422Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU422Planar_ER: 40>#
Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYVU420Planar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU420Planar_ER: 41>#
Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU444SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU444SemiPlanar_ER: 42>#
Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYVU422SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU422SemiPlanar_ER: 43>#
Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYVU420SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_ER: 44>#
Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatBayerRGGB = <cudaEglColorFormat.cudaEglColorFormatBayerRGGB: 45>#
Bayer format - one channel in one surface with interleaved RGGB ordering.
- cudaEglColorFormatBayerBGGR = <cudaEglColorFormat.cudaEglColorFormatBayerBGGR: 46>#
Bayer format - one channel in one surface with interleaved BGGR ordering.
- cudaEglColorFormatBayerGRBG = <cudaEglColorFormat.cudaEglColorFormatBayerGRBG: 47>#
Bayer format - one channel in one surface with interleaved GRBG ordering.
- cudaEglColorFormatBayerGBRG = <cudaEglColorFormat.cudaEglColorFormatBayerGBRG: 48>#
Bayer format - one channel in one surface with interleaved GBRG ordering.
- cudaEglColorFormatBayer10RGGB = <cudaEglColorFormat.cudaEglColorFormatBayer10RGGB: 49>#
Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op.
- cudaEglColorFormatBayer10BGGR = <cudaEglColorFormat.cudaEglColorFormatBayer10BGGR: 50>#
Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op.
- cudaEglColorFormatBayer10GRBG = <cudaEglColorFormat.cudaEglColorFormatBayer10GRBG: 51>#
Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op.
- cudaEglColorFormatBayer10GBRG = <cudaEglColorFormat.cudaEglColorFormatBayer10GBRG: 52>#
Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op.
- cudaEglColorFormatBayer12RGGB = <cudaEglColorFormat.cudaEglColorFormatBayer12RGGB: 53>#
Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12BGGR = <cudaEglColorFormat.cudaEglColorFormatBayer12BGGR: 54>#
Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12GRBG = <cudaEglColorFormat.cudaEglColorFormatBayer12GRBG: 55>#
Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12GBRG = <cudaEglColorFormat.cudaEglColorFormatBayer12GBRG: 56>#
Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer14RGGB = <cudaEglColorFormat.cudaEglColorFormatBayer14RGGB: 57>#
Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op.
- cudaEglColorFormatBayer14BGGR = <cudaEglColorFormat.cudaEglColorFormatBayer14BGGR: 58>#
Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op.
- cudaEglColorFormatBayer14GRBG = <cudaEglColorFormat.cudaEglColorFormatBayer14GRBG: 59>#
Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op.
- cudaEglColorFormatBayer14GBRG = <cudaEglColorFormat.cudaEglColorFormatBayer14GBRG: 60>#
Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op.
- cudaEglColorFormatBayer20RGGB = <cudaEglColorFormat.cudaEglColorFormatBayer20RGGB: 61>#
Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op.
- cudaEglColorFormatBayer20BGGR = <cudaEglColorFormat.cudaEglColorFormatBayer20BGGR: 62>#
Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op.
- cudaEglColorFormatBayer20GRBG = <cudaEglColorFormat.cudaEglColorFormatBayer20GRBG: 63>#
Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op.
- cudaEglColorFormatBayer20GBRG = <cudaEglColorFormat.cudaEglColorFormatBayer20GBRG: 64>#
Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op.
- cudaEglColorFormatYVU444Planar = <cudaEglColorFormat.cudaEglColorFormatYVU444Planar: 65>#
Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatYVU422Planar = <cudaEglColorFormat.cudaEglColorFormatYVU422Planar: 66>#
Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatYVU420Planar = <cudaEglColorFormat.cudaEglColorFormatYVU420Planar: 67>#
Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatBayerIspRGGB = <cudaEglColorFormat.cudaEglColorFormatBayerIspRGGB: 68>#
Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype.
- cudaEglColorFormatBayerIspBGGR = <cudaEglColorFormat.cudaEglColorFormatBayerIspBGGR: 69>#
Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype.
- cudaEglColorFormatBayerIspGRBG = <cudaEglColorFormat.cudaEglColorFormatBayerIspGRBG: 70>#
Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype.
- cudaEglColorFormatBayerIspGBRG = <cudaEglColorFormat.cudaEglColorFormatBayerIspGBRG: 71>#
Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype.
- cudaEglColorFormatBayerBCCR = <cudaEglColorFormat.cudaEglColorFormatBayerBCCR: 72>#
Bayer format - one channel in one surface with interleaved BCCR ordering.
- cudaEglColorFormatBayerRCCB = <cudaEglColorFormat.cudaEglColorFormatBayerRCCB: 73>#
Bayer format - one channel in one surface with interleaved RCCB ordering.
- cudaEglColorFormatBayerCRBC = <cudaEglColorFormat.cudaEglColorFormatBayerCRBC: 74>#
Bayer format - one channel in one surface with interleaved CRBC ordering.
- cudaEglColorFormatBayerCBRC = <cudaEglColorFormat.cudaEglColorFormatBayerCBRC: 75>#
Bayer format - one channel in one surface with interleaved CBRC ordering.
- cudaEglColorFormatBayer10CCCC = <cudaEglColorFormat.cudaEglColorFormatBayer10CCCC: 76>#
Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op.
- cudaEglColorFormatBayer12BCCR = <cudaEglColorFormat.cudaEglColorFormatBayer12BCCR: 77>#
Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12RCCB = <cudaEglColorFormat.cudaEglColorFormatBayer12RCCB: 78>#
Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12CRBC = <cudaEglColorFormat.cudaEglColorFormatBayer12CRBC: 79>#
Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12CBRC = <cudaEglColorFormat.cudaEglColorFormatBayer12CBRC: 80>#
Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatBayer12CCCC = <cudaEglColorFormat.cudaEglColorFormatBayer12CCCC: 81>#
Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op.
- cudaEglColorFormatY = <cudaEglColorFormat.cudaEglColorFormatY: 82>#
Color format for single Y plane.
- cudaEglColorFormatYUV420SemiPlanar_2020 = <cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_2020: 83>#
Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU420SemiPlanar_2020 = <cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_2020: 84>#
Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYUV420Planar_2020 = <cudaEglColorFormat.cudaEglColorFormatYUV420Planar_2020: 85>#
Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU420Planar_2020 = <cudaEglColorFormat.cudaEglColorFormatYVU420Planar_2020: 86>#
Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYUV420SemiPlanar_709 = <cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_709: 87>#
Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU420SemiPlanar_709 = <cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_709: 88>#
Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYUV420Planar_709 = <cudaEglColorFormat.cudaEglColorFormatYUV420Planar_709: 89>#
Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatYVU420Planar_709 = <cudaEglColorFormat.cudaEglColorFormatYVU420Planar_709: 90>#
Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_420SemiPlanar_709 = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_709: 91>#
Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_2020: 92>#
Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar_2020: 93>#
Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatY10V10U10_422SemiPlanar = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar: 94>#
Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatY10V10U10_422SemiPlanar_709 = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar_709: 95>#
Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height.
- cudaEglColorFormatY_ER = <cudaEglColorFormat.cudaEglColorFormatY_ER: 96>#
Extended Range Color format for single Y plane.
- cudaEglColorFormatY_709_ER = <cudaEglColorFormat.cudaEglColorFormatY_709_ER: 97>#
Extended Range Color format for single Y plane.
- cudaEglColorFormatY10_ER = <cudaEglColorFormat.cudaEglColorFormatY10_ER: 98>#
Extended Range Color format for single Y10 plane.
- cudaEglColorFormatY10_709_ER = <cudaEglColorFormat.cudaEglColorFormatY10_709_ER: 99>#
Extended Range Color format for single Y10 plane.
- cudaEglColorFormatY12_ER = <cudaEglColorFormat.cudaEglColorFormatY12_ER: 100>#
Extended Range Color format for single Y12 plane.
- cudaEglColorFormatY12_709_ER = <cudaEglColorFormat.cudaEglColorFormatY12_709_ER: 101>#
Extended Range Color format for single Y12 plane.
- cudaEglColorFormatYUVA = <cudaEglColorFormat.cudaEglColorFormatYUVA: 102>#
Y, U, V, A four channels in one surface, interleaved as AVUY.
- cudaEglColorFormatYVYU = <cudaEglColorFormat.cudaEglColorFormatYVYU: 104>#
Y, U, V in one surface, interleaved as YVYU in one channel.
- cudaEglColorFormatVYUY = <cudaEglColorFormat.cudaEglColorFormatVYUY: 105>#
Y, U, V in one surface, interleaved as VYUY in one channel.
- cudaEglColorFormatY10V10U10_420SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_ER: 106>#
Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER: 107>#
Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY10V10U10_444SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar_ER: 108>#
Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = <cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER: 109>#
Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatY12V12U12_420SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar_ER: 110>#
Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER: 111>#
Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height.
- cudaEglColorFormatY12V12U12_444SemiPlanar_ER = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar_ER: 112>#
Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = <cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER: 113>#
Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height.
- cudaEglColorFormatUYVY709 = <cudaEglColorFormat.cudaEglColorFormatUYVY709: 114>#
Y, U, V in one surface, interleaved as UYVY in one channel.
- cudaEglColorFormatUYVY709_ER = <cudaEglColorFormat.cudaEglColorFormatUYVY709_ER: 115>#
Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.
- cudaEglColorFormatUYVY2020 = <cudaEglColorFormat.cudaEglColorFormatUYVY2020: 116>#
Y, U, V in one surface, interleaved as UYVY in one channel.
- class cuda.bindings.runtime.cudaDevResourceDesc_t(*args, **kwargs)#
An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via ::cudaDeviceResourceGenerateDesc .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExecutionContext_t(*args, **kwargs)#
An opaque handle to a CUDA execution context. It represents an execution context created via CUDA Runtime APIs such as cudaGreenCtxCreate. .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaArray_t(*args, **kwargs)#
CUDA array .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaArray_const_t(*args, **kwargs)#
.. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMipmappedArray_t(*args, **kwargs)#
CUDA mipmapped array .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMipmappedArray_const_t(*args, **kwargs)#
.. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaHostFn_t(*args, **kwargs)#
Get memory address of class instance
- class cuda.bindings.runtime.CUuuid#
.. attribute:: bytes < CUDA definition of UUID :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaUUID_t#
.. attribute:: bytes < CUDA definition of UUID :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaIpcEventHandle_t#
CUDA IPC event handle .. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaIpcMemHandle_t#
CUDA IPC memory handle .. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemFabricHandle_t#
.. attribute:: reserved :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevSmResourceGroupParams#
Input data for splitting SMs .. attribute:: smCount The amount of SMs available in this resource. :type: unsigned int .. attribute:: coscheduledSmCount The amount of co-scheduled SMs grouped together for locality purposes. :type: unsigned int .. attribute:: preferredCoscheduledSmCount When possible, combine co-scheduled groups together into larger groups of this size. :type: unsigned int .. attribute:: flags Combination of `cudaDevSmResourceGroup_flags` values to indicate this this group is created. :type: unsigned int .. attribute:: reserved Reserved for future use - ensure this is is zero initialized. :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaDevResource#
A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it. struct enumcudaDevResourceTypetype; union structcudaDevSmResourcesm; structcudaDevWorkqueueConfigResourcewqConfig; structcudaDevWorkqueueResourcewq; ; ; - If `typename` is `cudaDevResourceTypeInvalid`, this resoure is not valid and cannot be further accessed. - If `typename` is `cudaDevResourceTypeSm`, the cudaDevSmResource structure `sm` is filled in. For example, `sm.smCount` will reflect the amount of streaming multiprocessors available in this resource. - If `typename` is `cudaDevResourceTypeWorkqueueConfig`, the cudaDevWorkqueueConfigResource structure `wqConfig` is filled in. - If `typename` is `cudaDevResourceTypeWorkqueue`, the cudaDevWorkqueueResource structure `wq` is filled in. .. attribute:: type Type of resource, dictates which union field was last set :type: cudaDevResourceType .. attribute:: _internal_padding :type: bytes .. attribute:: sm Resource corresponding to cudaDevResourceTypeSm `typename`. :type: cudaDevSmResource .. attribute:: wqConfig Resource corresponding to cudaDevResourceTypeWorkqueueConfig `typename`. :type: cudaDevWorkqueueConfigResource .. attribute:: wq Resource corresponding to cudaDevResourceTypeWorkqueue `typename`. :type: cudaDevWorkqueueResource .. attribute:: _oversize :type: bytes .. attribute:: nextResource :type: cudaDevResource_st .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaStream_t#
CUDA stream .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEvent_t#
CUDA event types .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphicsResource_t(*args, **kwargs)#
CUDA graphics resource types .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalMemory_t(*args, **kwargs)#
CUDA external memory .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaExternalSemaphore_t(*args, **kwargs)#
CUDA external semaphore .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraph_t#
CUDA graph .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphNode_t#
CUDA graph node. .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaUserObject_t#
CUDA user object for graphs .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphConditionalHandle#
CUDA handle for conditional graph nodes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaFunction_t#
CUDA function .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaKernel_t(*args, **kwargs)#
CUDA kernel .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLibrary_t(*args, **kwargs)#
CUDA library .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaMemPool_t#
CUDA memory pool .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphEdgeData#
Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and default to a zero-initialized value if not specified. A zero-initialized struct indicates a standard full serialization of two nodes with memory visibility. .. attribute:: from_port This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value of 0 in all cases means full completion of the upstream node, with memory visibility to the downstream node or portion thereof (indicated by `to_port`). Only kernel nodes define non-zero ports. A kernel node can use the following output port types: cudaGraphKernelNodePortDefault, cudaGraphKernelNodePortProgrammatic, or cudaGraphKernelNodePortLaunchCompletion. :type: bytes .. attribute:: to_port This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). The meaning is specific to the node type. A value of 0 in all cases means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. :type: bytes .. attribute:: type This should be populated with a value from cudaGraphDependencyType. (It is typed as char due to compiler-specific layout of bitfields.) See cudaGraphDependencyType. :type: bytes .. attribute:: reserved These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphExec_t#
.. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphInstantiateParams#
Graph instantiation parameters .. attribute:: flags Instantiation flags :type: unsigned long long .. attribute:: uploadStream Upload stream :type: cudaStream_t .. attribute:: errNode_out The node which caused instantiation to fail, if any :type: cudaGraphNode_t .. attribute:: result_out Whether instantiation was successful. If it failed, the reason why :type: cudaGraphInstantiateResult .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphExecUpdateResultInfo#
Result information returned by cudaGraphExecUpdate .. attribute:: result Gives more specific detail when a cuda graph update fails. :type: cudaGraphExecUpdateResult .. attribute:: errorNode The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. :type: cudaGraphNode_t .. attribute:: errorFromNode The from node of error edge when the topologies do not match. Otherwise NULL. :type: cudaGraphNode_t .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaGraphDeviceNode_t(*args, **kwargs)#
CUDA device node handle for device-side node update .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchMemSyncDomainMap#
Memory Synchronization Domain map See cudaLaunchMemSyncDomain. By default, kernels are launched in domain 0. Kernel launched with cudaLaunchMemSyncDomainRemote will have a different domain ID. User may also alter the domain ID with cudaLaunchMemSyncDomainMap for a specific stream / graph node / kernel launch. See cudaLaunchAttributeMemSyncDomainMap. Domain ID range is available through cudaDevAttrMemSyncDomainCount. .. attribute:: default_ The default domain ID to use for designated kernels :type: bytes .. attribute:: remote The remote domain ID to use for designated kernels :type: bytes .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchAttributeValue(void_ptr _ptr=0)#
Launch attributes union; used as value field of cudaLaunchAttribute .. attribute:: pad :type: bytes .. attribute:: accessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. :type: cudaAccessPolicyWindow .. attribute:: cooperative Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). :type: int .. attribute:: syncPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. cudaSynchronizationPolicy for work queued up in this stream. :type: cudaSynchronizationPolicy .. attribute:: clusterDim Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the cluster, in blocks. Must be a divisor of the grid X dimension. - `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. :type: anon_struct17 .. attribute:: clusterSchedulingPolicyPreference Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. :type: cudaClusterSchedulingPolicy .. attribute:: programmaticStreamSerializationAllowed Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. :type: int .. attribute:: programmaticEvent Value of launch attribute cudaLaunchAttributeProgrammaticEvent with the following fields: - `cudaEvent_t` event - Event to fire when all blocks trigger it. - `int` flags; - Event record flags, see ::cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. - `int` triggerAtBlockStart - If this is set to non-0, each block launch will automatically trigger the event. :type: anon_struct18 .. attribute:: priority Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. :type: int .. attribute:: memSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See cudaLaunchMemSyncDomainMap. :type: cudaLaunchMemSyncDomainMap .. attribute:: memSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. :type: cudaLaunchMemSyncDomain .. attribute:: preferredClusterDim Value of launch attribute cudaLaunchAttributePreferredClusterDimension that represents the desired preferred cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the preferred cluster, in blocks. Must be a divisor of the grid X dimension, and must be a multiple of the `x` field of ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension of the preferred cluster, in blocks. Must be a divisor of the grid Y dimension, and must be a multiple of the `y` field of ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension of the preferred cluster, in blocks. Must be equal to the `z` field of ::cudaLaunchAttributeValue::clusterDim. :type: anon_struct19 .. attribute:: launchCompletionEvent Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent with the following fields: - `cudaEvent_t` event - Event to fire when the last block launches. - `int` flags - Event record flags, see ::cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. :type: anon_struct20 .. attribute:: deviceUpdatableKernelNode Value of launch attribute cudaLaunchAttributeDeviceUpdatableKernelNode with the following fields: - `int` deviceUpdatable - Whether or not the resulting kernel node should be device-updatable. - `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the various device-side update functions. :type: anon_struct21 .. attribute:: sharedMemCarveout Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. :type: unsigned int .. attribute:: nvlinkUtilCentricScheduling Value of launch attribute cudaLaunchAttributeNvlinkUtilCentricScheduling. :type: unsigned int .. attribute:: portableClusterSizeMode Value of launch attribute cudaLaunchAttributePortableClusterSizeMode :type: cudaLaunchAttributePortableClusterMode .. attribute:: sharedMemoryMode Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See cudaSharedMemoryMode for acceptable values. :type: cudaSharedMemoryMode .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaLaunchAttribute#
Launch attribute .. attribute:: id Attribute to set :type: cudaLaunchAttributeID .. attribute:: val Value of the attribute :type: cudaLaunchAttributeValue .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaAsyncCallbackHandle_t(*args, **kwargs)#
CUDA async callback handle .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaAsyncNotificationInfo_t#
Information describing an async notification event .. attribute:: type The type of notification being sent :type: cudaAsyncNotificationType .. attribute:: info Information about the notification. `typename` must be checked in order to interpret this field. :type: anon_union10 .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaAsyncCallback(*args, **kwargs)#
Get memory address of class instance
- class cuda.bindings.runtime.cudaLogsCallbackHandle(*args, **kwargs)#
Get memory address of class instance
- class cuda.bindings.runtime.cudaLogIterator#
Get memory address of class instance
- class cuda.bindings.runtime.cudaSurfaceObject_t#
An opaque value that represents a CUDA Surface object .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaTextureObject_t#
An opaque value that represents a CUDA texture object .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEglPlaneDesc#
CUDA EGL Plane Descriptor - structure defining each plane of a CUDA EGLFrame .. attribute:: width Width of plane :type: unsigned int .. attribute:: height Height of plane :type: unsigned int .. attribute:: depth Depth of plane :type: unsigned int .. attribute:: pitch Pitch of plane :type: unsigned int .. attribute:: numChannels Number of channels for the plane :type: unsigned int .. attribute:: channelDesc Channel Format Descriptor :type: cudaChannelFormatDesc .. attribute:: reserved Reserved for future use :type: list[unsigned int] .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEglFrame#
CUDA EGLFrame Descriptor - structure defining one frame of EGL. Each frame may contain one or more planes depending on whether the surface is Multiplanar or not. Each plane of EGLFrame is represented by cudaEglPlaneDesc which is defined as: typedefstructcudaEglPlaneDesc_st unsignedintwidth; unsignedintheight; unsignedintdepth; unsignedintpitch; unsignedintnumChannels; structcudaChannelFormatDescchannelDesc; unsignedintreserved[4]; cudaEglPlaneDesc; .. attribute:: frame :type: anon_union11 .. attribute:: planeDesc CUDA EGL Plane Descriptor cudaEglPlaneDesc :type: list[cudaEglPlaneDesc] .. attribute:: planeCount Number of planes :type: unsigned int .. attribute:: frameType Array or Pitch :type: cudaEglFrameType .. attribute:: eglColorFormat CUDA EGL Color Format :type: cudaEglColorFormat .. method:: getPtr() Get memory address of class instance
- class cuda.bindings.runtime.cudaEglStreamConnection#
CUDA EGLSream Connection .. method:: getPtr() Get memory address of class instance
- runtime.cudaHostAllocDefault = 0#
Default page-locked allocation flag
- runtime.cudaHostAllocPortable = 1#
Pinned memory accessible by all CUDA contexts
- runtime.cudaHostAllocMapped = 2#
Map allocation into device space
- runtime.cudaHostAllocWriteCombined = 4#
Write-combined memory
- runtime.cudaHostRegisterDefault = 0#
Default host memory registration flag
- runtime.cudaHostRegisterPortable = 1#
Pinned memory accessible by all CUDA contexts
- runtime.cudaHostRegisterMapped = 2#
Map registered memory into device space
- runtime.cudaHostRegisterIoMemory = 4#
Memory-mapped I/O space
- runtime.cudaHostRegisterReadOnly = 8#
Memory-mapped read-only
- runtime.cudaPeerAccessDefault = 0#
Default peer addressing enable flag
- runtime.cudaStreamDefault = 0#
Default stream flag
- runtime.cudaStreamNonBlocking = 1#
Stream does not synchronize with stream 0 (the NULL stream)
- runtime.cudaStreamLegacy = 1#
Legacy stream handle
Stream handle that can be passed as a cudaStream_t to use an implicit stream with legacy synchronization behavior.
See details of the link_sync_behavior
- runtime.cudaStreamPerThread = 2#
Per-thread stream handle
Stream handle that can be passed as a cudaStream_t to use an implicit stream with per-thread synchronization behavior.
See details of the link_sync_behavior
- runtime.cudaEventDefault = 0#
Default event flag
- runtime.cudaEventBlockingSync = 1#
Event uses blocking synchronization
- runtime.cudaEventDisableTiming = 2#
Event will not record timing data
- runtime.cudaEventInterprocess = 4#
Event is suitable for interprocess use. cudaEventDisableTiming must be set
- runtime.cudaEventRecordDefault = 0#
Default event record flag
- runtime.cudaEventRecordExternal = 1#
Event is captured in the graph as an external event node when performing stream capture
- runtime.cudaEventWaitDefault = 0#
Default event wait flag
- runtime.cudaEventWaitExternal = 1#
Event is captured in the graph as an external event node when performing stream capture
- runtime.cudaDeviceScheduleAuto = 0#
Device flag - Automatic scheduling
- runtime.cudaDeviceScheduleSpin = 1#
Device flag - Spin default scheduling
- runtime.cudaDeviceScheduleYield = 2#
Device flag - Yield default scheduling
- runtime.cudaDeviceScheduleBlockingSync = 4#
Device flag - Use blocking synchronization
- runtime.cudaDeviceBlockingSync = 4#
Device flag - Use blocking synchronization [Deprecated]
- runtime.cudaDeviceScheduleMask = 7#
Device schedule flags mask
- runtime.cudaDeviceMapHost = 8#
Device flag - Support mapped pinned allocations
- runtime.cudaDeviceLmemResizeToMax = 16#
Device flag - Keep local memory allocation after launch
- runtime.cudaDeviceSyncMemops = 128#
Device flag - Ensure synchronous memory operations on this context will synchronize
- runtime.cudaDeviceMask = 255#
Device flags mask
- runtime.cudaArrayDefault = 0#
Default CUDA array allocation flag
- runtime.cudaArrayLayered = 1#
Must be set in cudaMalloc3DArray to create a layered CUDA array
- runtime.cudaArraySurfaceLoadStore = 2#
Must be set in cudaMallocArray or cudaMalloc3DArray in order to bind surfaces to the CUDA array
- runtime.cudaArrayCubemap = 4#
Must be set in cudaMalloc3DArray to create a cubemap CUDA array
- runtime.cudaArrayTextureGather = 8#
Must be set in cudaMallocArray or cudaMalloc3DArray in order to perform texture gather operations on the CUDA array
- runtime.cudaArrayColorAttachment = 32#
Must be set in cudaExternalMemoryGetMappedMipmappedArray if the mipmapped array is used as a color target in a graphics API
- runtime.cudaArraySparse = 64#
Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a sparse CUDA array or CUDA mipmapped array
- runtime.cudaArrayDeferredMapping = 128#
Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a deferred mapping CUDA array or CUDA mipmapped array
- runtime.cudaIpcMemLazyEnablePeerAccess = 1#
Automatically enable peer access between remote devices as needed
- runtime.cudaMemAttachGlobal = 1#
Memory can be accessed by any stream on any device
- runtime.cudaMemAttachHost = 2#
Memory cannot be accessed by any stream on any device
- runtime.cudaMemAttachSingle = 4#
Memory can only be accessed by a single stream on the associated device
- runtime.cudaOccupancyDefault = 0#
Default behavior
- runtime.cudaOccupancyDisableCachingOverride = 1#
Assume global caching is enabled and cannot be automatically turned off
- runtime.cudaCpuDeviceId = -1#
Device id that represents the CPU
- runtime.cudaInvalidDeviceId = -2#
Device id that represents an invalid device
- runtime.cudaInitDeviceFlagsAreValid = 1#
Tell the CUDA runtime that DeviceFlags is being set in cudaInitDevice call
- runtime.cudaArraySparsePropertiesSingleMipTail = 1#
Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers
- runtime.cudaMemPoolCreateUsageHwDecompress = 2#
This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression.
- runtime.CUDA_IPC_HANDLE_SIZE = 64#
CUDA IPC Handle Size
- runtime.cudaExternalMemoryDedicated = 1#
Indicates that the external memory object is a dedicated resource
- runtime.cudaExternalSemaphoreSignalSkipNvSciBufMemSync = 1#
When the /p flags parameter of
cudaExternalSemaphoreSignalParamscontains this flag, it indicates that signaling an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported ascudaExternalMemoryHandleTypeNvSciBuf, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects.
- runtime.cudaExternalSemaphoreWaitSkipNvSciBufMemSync = 2#
When the /p flags parameter of
cudaExternalSemaphoreWaitParamscontains this flag, it indicates that waiting an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported ascudaExternalMemoryHandleTypeNvSciBuf, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects.
- runtime.cudaNvSciSyncAttrSignal = 1#
When /p flags of
cudaDeviceGetNvSciSyncAttributesis set to this, it indicates that application need signaler specific NvSciSyncAttr to be filled bycudaDeviceGetNvSciSyncAttributes.
- runtime.cudaNvSciSyncAttrWait = 2#
When /p flags of
cudaDeviceGetNvSciSyncAttributesis set to this, it indicates that application need waiter specific NvSciSyncAttr to be filled bycudaDeviceGetNvSciSyncAttributes.
- runtime.cudaGraphKernelNodePortDefault = 0#
This port activates when the kernel has finished executing.
- runtime.cudaGraphKernelNodePortProgrammatic = 1#
This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() or have terminated. It must be used with edge type
cudaGraphDependencyTypeProgrammatic. See alsocudaLaunchAttributeProgrammaticEvent.
- runtime.cudaGraphKernelNodePortLaunchCompletion = 2#
This port activates when all blocks of the kernel have begun execution. See also
cudaLaunchAttributeLaunchCompletionEvent.
- runtime.cudaStreamAttrID = <enum 'cudaStreamAttrID'>#
- runtime.cudaStreamAttributeAccessPolicyWindow = 1#
- runtime.cudaStreamAttributeSynchronizationPolicy = 3#
- runtime.cudaStreamAttributeMemSyncDomainMap = 9#
- runtime.cudaStreamAttributeMemSyncDomain = 10#
- runtime.cudaStreamAttributePriority = 8#
- runtime.cudaStreamAttrValue = <class 'cuda.bindings.runtime.cudaStreamAttrValue'>#
- runtime.cudaKernelNodeAttrID = <enum 'cudaKernelNodeAttrID'>#
- runtime.cudaKernelNodeAttributeAccessPolicyWindow = 1#
- runtime.cudaKernelNodeAttributeCooperative = 2#
- runtime.cudaKernelNodeAttributePriority = 8#
- runtime.cudaKernelNodeAttributeClusterDimension = 4#
- runtime.cudaKernelNodeAttributeClusterSchedulingPolicyPreference = 5#
- runtime.cudaKernelNodeAttributeMemSyncDomainMap = 9#
- runtime.cudaKernelNodeAttributeMemSyncDomain = 10#
- runtime.cudaKernelNodeAttributeDeviceUpdatableKernelNode = 13#
- runtime.cudaKernelNodeAttributeNvlinkUtilCentricScheduling = 16#
- runtime.cudaKernelNodeAttrValue = <class 'cuda.bindings.runtime.cudaKernelNodeAttrValue'>#
- runtime.cudaSurfaceType1D = 1#
- runtime.cudaSurfaceType2D = 2#
- runtime.cudaSurfaceType3D = 3#
- runtime.cudaSurfaceTypeCubemap = 12#
- runtime.cudaSurfaceType1DLayered = 241#
- runtime.cudaSurfaceType2DLayered = 242#
- runtime.cudaSurfaceTypeCubemapLayered = 252#
- runtime.cudaTextureType1D = 1#
- runtime.cudaTextureType2D = 2#
- runtime.cudaTextureType3D = 3#
- runtime.cudaTextureTypeCubemap = 12#
- runtime.cudaTextureType1DLayered = 241#
- runtime.cudaTextureType2DLayered = 242#
- runtime.cudaTextureTypeCubemapLayered = 252#
- runtime.CUDA_EGL_MAX_PLANES = 3#
Maximum number of planes per frame
Device Management#
impl_private
This section describes the device management functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaDeviceReset()#
Destroy all allocations and reset all state on the current device in the current process. Explicitly destroys and cleans up all resources associated with the current device in the current process. It is the caller's responsibility to ensure that the resources are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. These resources include CUDA types :py:obj:`~.cudaStream_t`, :py:obj:`~.cudaEvent_t`, :py:obj:`~.cudaArray_t`, :py:obj:`~.cudaMipmappedArray_t`, :py:obj:`~.cudaPitchedPtr`, :py:obj:`~.cudaTextureObject_t`, :py:obj:`~.cudaSurfaceObject_t`, :py:obj:`~.textureReference`, :py:obj:`~.surfaceReference`, :py:obj:`~.cudaExternalMemory_t`, :py:obj:`~.cudaExternalSemaphore_t` and :py:obj:`~.cudaGraphicsResource_t`. These resources also include memory allocations by :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocHost`, :py:obj:`~.cudaMallocManaged` and :py:obj:`~.cudaMallocPitch`. Any subsequent API call to this device will reinitialize the device. Note that this function will reset the device immediately. It is the caller's responsibility to ensure that the device is not being accessed by any other host threads from the process when this function is called. :returns: :py:obj:`~.cudaSuccess` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceSynchronize` .. rubric:: Notes :py:obj:`~.cudaDeviceReset()` will not destroy memory allocations by :py:obj:`~.cudaMallocAsync()` and :py:obj:`~.cudaMallocFromPoolAsync()`. These memory allocations need to be destroyed explicitly. If a non-primary :py:obj:`~.CUcontext` is current to the thread, :py:obj:`~.cudaDeviceReset()` will destroy only the internal CUDA RT state for that :py:obj:`~.CUcontext`.
- cuda.bindings.runtime.cudaDeviceSynchronize()#
Wait for compute device to finish. Blocks until the device has completed all preceding requested tasks. :py:obj:`~.cudaDeviceSynchronize()` returns an error if one of the preceding tasks has failed. If the :py:obj:`~.cudaDeviceScheduleBlockingSync` flag was set for this device, the host thread will block until the device has finished its work. :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceReset`, :py:obj:`~.cuCtxSynchronize`
- cuda.bindings.runtime.cudaDeviceSetLimit(limit: cudaLimit, size_t value)#
Set resource limits. Setting `limit` to `value` is a request by the application to update the current limit maintained by the device. The driver is free to modify the requested value to meet h/w requirements (this could be clamping to minimum or maximum values, rounding up to nearest element size, etc). The application can use :py:obj:`~.cudaDeviceGetLimit()` to find out exactly what the limit has been set to. Setting each :py:obj:`~.cudaLimit` has its own specific restrictions, so each is discussed here. - :py:obj:`~.cudaLimitStackSize` controls the stack size in bytes of each GPU thread. - :py:obj:`~.cudaLimitPrintfFifoSize` controls the size in bytes of the shared FIFO used by the :py:obj:`~.printf()` device system call. Setting :py:obj:`~.cudaLimitPrintfFifoSize` must not be performed after launching any kernel that uses the :py:obj:`~.printf()` device system call - in such case :py:obj:`~.cudaErrorInvalidValue` will be returned. - :py:obj:`~.cudaLimitMallocHeapSize` controls the size in bytes of the heap used by the :py:obj:`~.malloc()` and :py:obj:`~.free()` device system calls. Setting :py:obj:`~.cudaLimitMallocHeapSize` must not be performed after launching any kernel that uses the :py:obj:`~.malloc()` or :py:obj:`~.free()` device system calls - in such case :py:obj:`~.cudaErrorInvalidValue` will be returned. - :py:obj:`~.cudaLimitDevRuntimeSyncDepth` controls the maximum nesting depth of a grid at which a thread can safely call :py:obj:`~.cudaDeviceSynchronize()`. Setting this limit must be performed before any launch of a kernel that uses the device runtime and calls :py:obj:`~.cudaDeviceSynchronize()` above the default sync depth, two levels of grids. Calls to :py:obj:`~.cudaDeviceSynchronize()` will fail with error code :py:obj:`~.cudaErrorSyncDepthExceeded` if the limitation is violated. This limit can be set smaller than the default or up the maximum launch depth of 24. When setting this limit, keep in mind that additional levels of sync depth require the runtime to reserve large amounts of device memory which can no longer be used for user allocations. If these reservations of device memory fail, :py:obj:`~.cudaDeviceSetLimit` will return :py:obj:`~.cudaErrorMemoryAllocation`, and the limit can be reset to a lower value. This limit is only applicable to devices of compute capability < 9.0. Attempting to set this limit on devices of other compute capability will results in error :py:obj:`~.cudaErrorUnsupportedLimit` being returned. - :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount` controls the maximum number of outstanding device runtime launches that can be made from the current device. A grid is outstanding from the point of launch up until the grid is known to have been completed. Device runtime launches which violate this limitation fail and return :py:obj:`~.cudaErrorLaunchPendingCountExceeded` when :py:obj:`~.cudaGetLastError()` is called after launch. If more pending launches than the default (2048 launches) are needed for a module using the device runtime, this limit can be increased. Keep in mind that being able to sustain additional pending launches will require the runtime to reserve larger amounts of device memory upfront which can no longer be used for allocations. If these reservations fail, :py:obj:`~.cudaDeviceSetLimit` will return :py:obj:`~.cudaErrorMemoryAllocation`, and the limit can be reset to a lower value. This limit is only applicable to devices of compute capability 3.5 and higher. Attempting to set this limit on devices of compute capability less than 3.5 will result in the error :py:obj:`~.cudaErrorUnsupportedLimit` being returned. - :py:obj:`~.cudaLimitMaxL2FetchGranularity` controls the L2 cache fetch granularity. Values can range from 0B to 128B. This is purely a performance hint and it can be ignored or clamped depending on the platform. - :py:obj:`~.cudaLimitPersistingL2CacheSize` controls size in bytes available for persisting L2 cache. This is purely a performance hint and it can be ignored or clamped depending on the platform. :param limit: Limit to set :type limit: :py:obj:`~.cudaLimit` :param value: Size of limit :type value: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorUnsupportedLimit`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceGetLimit`, :py:obj:`~.cuCtxSetLimit`
- cuda.bindings.runtime.cudaDeviceGetLimit(limit: cudaLimit)#
Return resource limits. Returns in `*pValue` the current size of `limit`. The following :py:obj:`~.cudaLimit` values are supported. - :py:obj:`~.cudaLimitStackSize` is the stack size in bytes of each GPU thread. - :py:obj:`~.cudaLimitPrintfFifoSize` is the size in bytes of the shared FIFO used by the :py:obj:`~.printf()` device system call. - :py:obj:`~.cudaLimitMallocHeapSize` is the size in bytes of the heap used by the :py:obj:`~.malloc()` and :py:obj:`~.free()` device system calls. - :py:obj:`~.cudaLimitDevRuntimeSyncDepth` is the maximum grid depth at which a thread can isssue the device runtime call :py:obj:`~.cudaDeviceSynchronize()` to wait on child grid launches to complete. This functionality is removed for devices of compute capability >= 9.0, and hence will return error :py:obj:`~.cudaErrorUnsupportedLimit` on such devices. - :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount` is the maximum number of outstanding device runtime launches. - :py:obj:`~.cudaLimitMaxL2FetchGranularity` is the L2 cache fetch granularity. - :py:obj:`~.cudaLimitPersistingL2CacheSize` is the persisting L2 cache size in bytes. :param limit: Limit to query :type limit: :py:obj:`~.cudaLimit` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorUnsupportedLimit`, :py:obj:`~.cudaErrorInvalidValue` * **pValue** (*int*) -- Returned size of the limit .. seealso:: :py:obj:`~.cudaDeviceSetLimit`, :py:obj:`~.cuCtxGetLimit`
- cuda.bindings.runtime.cudaDeviceGetCacheConfig()#
Returns the maximum number of elements allocatable in a 1D linear texture for a given element size. Returns in `maxWidthInElements` the maximum number of elements allocatable in a 1D linear texture for given format descriptor `fmtDesc`. Returns the preferred cache configuration for the current device. On devices where the L1 cache and shared memory use the same hardware resources, this returns through `pCacheConfig` the preferred cache configuration for the current device. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute functions. This will return a `pCacheConfig` of :py:obj:`~.cudaFuncCachePreferNone` on devices where the size of the L1 cache and shared memory are fixed. The supported cache configurations are: - :py:obj:`~.cudaFuncCachePreferNone`: no preference for shared memory or L1 (default) - :py:obj:`~.cudaFuncCachePreferShared`: prefer larger shared memory and smaller L1 cache - :py:obj:`~.cudaFuncCachePreferL1`: prefer larger L1 cache and smaller shared memory - :py:obj:`~.cudaFuncCachePreferEqual`: prefer equal size L1 cache and shared memory :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorUnsupportedLimit`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess` * **maxWidthInElements** (:py:obj:`~.cudaFuncCache`) -- Returns maximum number of texture elements allocatable for given `fmtDesc`. .. seealso:: :py:obj:`~.cuDeviceGetTexture1DLinearMaxWidth` :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cuCtxGetCacheConfig`
- cuda.bindings.runtime.cudaDeviceGetStreamPriorityRange()#
Returns numerical values that correspond to the least and greatest stream priorities. Returns in `*leastPriority` and `*greatestPriority` the numerical values that correspond to the least and greatest stream priorities respectively. Stream priorities follow a convention where lower numbers imply greater priorities. The range of meaningful stream priorities is given by [`*greatestPriority`, `*leastPriority`]. If the user attempts to create a stream with a priority value that is outside the the meaningful range as specified by this API, the priority is automatically clamped down or up to either `*leastPriority` or `*greatestPriority` respectively. See :py:obj:`~.cudaStreamCreateWithPriority` for details on creating a priority stream. A NULL may be passed in for `*leastPriority` or `*greatestPriority` if the value is not desired. This function will return '0' in both `*leastPriority` and `*greatestPriority` if the current context's device does not support stream priorities (see :py:obj:`~.cudaDeviceGetAttribute`). :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` * **leastPriority** (*int*) -- Pointer to an int in which the numerical value for least stream priority is returned * **greatestPriority** (*int*) -- Pointer to an int in which the numerical value for greatest stream priority is returned .. seealso:: :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cuCtxGetStreamPriorityRange`
- cuda.bindings.runtime.cudaDeviceSetCacheConfig(cacheConfig: cudaFuncCache)#
Sets the preferred cache configuration for the current device. On devices where the L1 cache and shared memory use the same hardware resources, this sets through `cacheConfig` the preferred cache configuration for the current device. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute the function. Any function preference set via :py:obj:`~.cudaFuncSetCacheConfig (C API)` or cudaFuncSetCacheConfig (C++ API) will be preferred over this device-wide setting. Setting the device-wide cache configuration to :py:obj:`~.cudaFuncCachePreferNone` will cause subsequent kernel launches to prefer to not change the cache configuration unless required to launch the kernel. This setting does nothing on devices where the size of the L1 cache and shared memory are fixed. Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point. The supported cache configurations are: - :py:obj:`~.cudaFuncCachePreferNone`: no preference for shared memory or L1 (default) - :py:obj:`~.cudaFuncCachePreferShared`: prefer larger shared memory and smaller L1 cache - :py:obj:`~.cudaFuncCachePreferL1`: prefer larger L1 cache and smaller shared memory - :py:obj:`~.cudaFuncCachePreferEqual`: prefer equal size L1 cache and shared memory :param cacheConfig: Requested cache configuration :type cacheConfig: :py:obj:`~.cudaFuncCache` :returns: :py:obj:`~.cudaSuccess` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cuCtxSetCacheConfig`
- cuda.bindings.runtime.cudaDeviceGetByPCIBusId(char *pciBusId)#
Returns a handle to a compute device. Returns in `*device` a device ordinal given a PCI bus ID string. where `domain`, `bus`, `device`, and `function` are all hexadecimal values :param pciBusId: String in one of the following forms: :type pciBusId: bytes :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` * **device** (*int*) -- Returned device ordinal .. seealso:: :py:obj:`~.cudaDeviceGetPCIBusId`, :py:obj:`~.cuDeviceGetByPCIBusId`
- cuda.bindings.runtime.cudaDeviceGetPCIBusId(int length, int device)#
Returns a PCI Bus Id string for the device. Returns an ASCII string identifying the device `dev` in the NULL- terminated string pointed to by `pciBusId`. `length` specifies the maximum length of the string that may be returned. where `domain`, `bus`, `device`, and `function` are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator. :param length: Maximum length of string to store in `name` :type length: int :param device: Device to get identifier string for :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` * **pciBusId** (*bytes*) -- Returned identifier string for the device in the following format .. seealso:: :py:obj:`~.cudaDeviceGetByPCIBusId`, :py:obj:`~.cuDeviceGetPCIBusId`
- cuda.bindings.runtime.cudaIpcGetEventHandle(event)#
Gets an interprocess handle for a previously allocated event. Takes as input a previously allocated event. This event must have been created with the :py:obj:`~.cudaEventInterprocess` and :py:obj:`~.cudaEventDisableTiming` flags set. This opaque handle may be copied into other processes and opened with :py:obj:`~.cudaIpcOpenEventHandle` to allow efficient hardware synchronization between GPU work in different processes. After the event has been been opened in the importing process, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaStreamWaitEvent` and :py:obj:`~.cudaEventQuery` may be used in either process. Performing operations on the imported event after the exported event has been freed with :py:obj:`~.cudaEventDestroy` will result in undefined behavior. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling :py:obj:`~.cudaDeviceGetAttribute` with :py:obj:`~.cudaDevAttrIpcEventSupport` :param event: Event allocated with :py:obj:`~.cudaEventInterprocess` and :py:obj:`~.cudaEventDisableTiming` flags. :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorMapBufferObjectFailed`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` * **handle** (:py:obj:`~.cudaIpcEventHandle_t`) -- Pointer to a user allocated cudaIpcEventHandle in which to return the opaque event handle .. seealso:: :py:obj:`~.cudaEventCreate`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcGetEventHandle`
- cuda.bindings.runtime.cudaIpcOpenEventHandle(
- cudaIpcEventHandle_t handle: cudaIpcEventHandle_t,
Opens an interprocess event handle for use in the current process. Opens an interprocess event handle exported from another process with :py:obj:`~.cudaIpcGetEventHandle`. This function returns a :py:obj:`~.cudaEvent_t` that behaves like a locally created event with the :py:obj:`~.cudaEventDisableTiming` flag specified. This event must be freed with :py:obj:`~.cudaEventDestroy`. Performing operations on the imported event after the exported event has been freed with :py:obj:`~.cudaEventDestroy` will result in undefined behavior. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling :py:obj:`~.cudaDeviceGetAttribute` with :py:obj:`~.cudaDevAttrIpcEventSupport` :param handle: Interprocess handle to open :type handle: :py:obj:`~.cudaIpcEventHandle_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMapBufferObjectFailed`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUninitialized` * **event** (:py:obj:`~.cudaEvent_t`) -- Returns the imported event .. seealso:: :py:obj:`~.cudaEventCreate`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcOpenEventHandle`
- cuda.bindings.runtime.cudaIpcGetMemHandle(devPtr)#
Gets an interprocess memory handle for an existing device memory allocation. Takes a pointer to the base of an existing device memory allocation created with :py:obj:`~.cudaMalloc` and exports it for use in another process. This is a lightweight operation and may be called multiple times on an allocation without adverse effects. If a region of memory is freed with :py:obj:`~.cudaFree` and a subsequent call to :py:obj:`~.cudaMalloc` returns memory with the same device address, :py:obj:`~.cudaIpcGetMemHandle` will return a unique handle for the new memory. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling :py:obj:`~.cudaDeviceGetAttribute` with :py:obj:`~.cudaDevAttrIpcEventSupport` :param devPtr: Base pointer to previously allocated device memory :type devPtr: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorMapBufferObjectFailed`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` * **handle** (:py:obj:`~.cudaIpcMemHandle_t`) -- Pointer to user allocated :py:obj:`~.cudaIpcMemHandle` to return the handle in. .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcGetMemHandle`
- cuda.bindings.runtime.cudaIpcOpenMemHandle(
- cudaIpcMemHandle_t handle: cudaIpcMemHandle_t,
- unsigned int flags,
Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process. Maps memory exported from another process with :py:obj:`~.cudaIpcGetMemHandle` into the current device address space. For contexts on different devices :py:obj:`~.cudaIpcOpenMemHandle` can attempt to enable peer access between the devices as if the user called :py:obj:`~.cudaDeviceEnablePeerAccess`. This behavior is controlled by the :py:obj:`~.cudaIpcMemLazyEnablePeerAccess` flag. :py:obj:`~.cudaDeviceCanAccessPeer` can determine if a mapping is possible. :py:obj:`~.cudaIpcOpenMemHandle` can open handles to devices that may not be visible in the process calling the API. Contexts that may open :py:obj:`~.cudaIpcMemHandles` are restricted in the following way. :py:obj:`~.cudaIpcMemHandles` from each device in a given process may only be opened by one context per device per other process. If the memory handle has already been opened by the current context, the reference count on the handle is incremented by 1 and the existing device pointer is returned. Memory returned from :py:obj:`~.cudaIpcOpenMemHandle` must be freed with :py:obj:`~.cudaIpcCloseMemHandle`. Calling :py:obj:`~.cudaFree` on an exported memory region before calling :py:obj:`~.cudaIpcCloseMemHandle` in the importing context will result in undefined behavior. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling :py:obj:`~.cudaDeviceGetAttribute` with :py:obj:`~.cudaDevAttrIpcEventSupport` :param handle: :py:obj:`~.cudaIpcMemHandle` to open :type handle: :py:obj:`~.cudaIpcMemHandle_t` :param flags: Flags for this operation. Must be specified as :py:obj:`~.cudaIpcMemLazyEnablePeerAccess` :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMapBufferObjectFailed`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorTooManyPeers`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` * **devPtr** (*Any*) -- Returned device pointer .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cuIpcOpenMemHandle` .. rubric:: Notes No guarantees are made about the address returned in `*devPtr`. In particular, multiple processes may not receive the same address for the same `handle`.
- cuda.bindings.runtime.cudaIpcCloseMemHandle(devPtr)#
Attempts to close memory mapped with cudaIpcOpenMemHandle. Decrements the reference count of the memory returnd by :py:obj:`~.cudaIpcOpenMemHandle` by 1. When the reference count reaches 0, this API unmaps the memory. The original allocation in the exporting process as well as imported mappings in other processes will be unaffected. Any resources used to enable peer access will be freed if this is the last mapping using them. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by calling :py:obj:`~.cudaDeviceGetAttribute` with :py:obj:`~.cudaDevAttrIpcEventSupport` :param devPtr: Device pointer returned by :py:obj:`~.cudaIpcOpenMemHandle` :type devPtr: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMapBufferObjectFailed`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cuIpcCloseMemHandle`
- cuda.bindings.runtime.cudaDeviceRegisterAsyncNotification(
- int device,
- callbackFunc,
- userData,
Blocks until remote writes are visible to the specified scope. Blocks until remote writes to the target context via mappings created through GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information), are visible to the specified scope. If the scope equals or lies within the scope indicated by :py:obj:`~.cudaDevAttrGPUDirectRDMAWritesOrdering`, the call will be a no-op and can be safely omitted for performance. This can be determined by comparing the numerical values between the two enums, with smaller scopes having smaller values. Users may query support for this API via :py:obj:`~.cudaDevAttrGPUDirectRDMAFlushWritesOptions`. Registers a callback function to receive async notifications Registers `callbackFunc` to receive async notifications. The `userData` parameter is passed to the callback function at async notification time. Likewise, `callback` is also passed to the callback function to distinguish between multiple registered callbacks. The callback function being registered should be designed to return quickly (~10ms). Any long running tasks should be queued for execution on an application thread. Callbacks may not call cudaDeviceRegisterAsyncNotification or cudaDeviceUnregisterAsyncNotification. Doing so will result in :py:obj:`~.cudaErrorNotPermitted`. Async notification callbacks execute in an undefined order and may be serialized. Returns in `*callback` a handle representing the registered callback instance. :param target: The target of the operation, see cudaFlushGPUDirectRDMAWritesTarget :type target: int :param scope: The scope of the operation, see cudaFlushGPUDirectRDMAWritesScope :type scope: :py:obj:`~.cudaAsyncCallback` :param device: The device on which to register the callback :type device: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorNotSupported` :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotPermitted` :py:obj:`~.cudaErrorUnknown` * **callbackFunc** (:py:obj:`~.cudaAsyncCallbackHandle_t`) -- The function to register as a callback .. seealso:: :py:obj:`~.cuFlushGPUDirectRDMAWrites`, :py:obj:`~.cudaDeviceUnregisterAsyncNotification`
- cuda.bindings.runtime.cudaDeviceUnregisterAsyncNotification(int device, callback)#
Unregisters an async notification callback. Unregisters `callback` so that the corresponding callback function will stop receiving async notifications. :param device: The device from which to remove `callback`. :type device: int :param callback: The callback instance to unregister from receiving async notifications. :type callback: :py:obj:`~.cudaAsyncCallbackHandle_t` :returns: :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorNotSupported` :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotPermitted` :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceRegisterAsyncNotification`
- cuda.bindings.runtime.cudaGetDeviceCount()#
Returns the number of compute-capable devices. Returns in `*count` the number of devices with compute capability greater or equal to 2.0 that are available for execution. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` * **count** (*int*) -- Returns the number of devices with compute capability greater or equal to 2.0 .. seealso:: :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetCount`
- cuda.bindings.runtime.cudaGetDeviceProperties(int device)#
Returns information about the compute-device. Returns in `*prop` the properties of device `dev`. :param device: Device number to get properties for :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` * **prop** (:py:obj:`~.cudaDeviceProp`) -- Properties for the specified device .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetName`
- cuda.bindings.runtime.cudaDeviceGetAttribute(attr: cudaDeviceAttr, int device)#
Returns information about the device. Returns in `*value` the integer value of the attribute `attr` on device `device`. :param attr: Device attribute to query :type attr: :py:obj:`~.cudaDeviceAttr` :param device: Device number to query :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` * **value** (*int*) -- Returned device attribute value .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute`
- cuda.bindings.runtime.cudaDeviceGetHostAtomicCapabilities(operations: Optional[tuple[cudaAtomicOperation] | list[cudaAtomicOperation]], unsigned int count, int device)#
Queries details about atomic operations supported between the device and host. Returns in `*capabilities` the details about requested atomic `*operations` over the the link between `dev` and the host. The allocated size of `*operations` and `*capabilities` must be `count`. For each :py:obj:`~.cudaAtomicOperation` in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of :py:obj:`~.cudaAtomicOperationCapability` the link supports natively. Returns :py:obj:`~.cudaErrorInvalidDevice` if `dev` is not valid. Returns :py:obj:`~.cudaErrorInvalidValue` if `*capabilities` or `*operations` is NULL, if `count` is 0, or if any of `*operations` is not valid. :param operations: Requested operations :type operations: list[:py:obj:`~.cudaAtomicOperation`] :param count: Count of requested operations and size of capabilities :type count: unsigned int :param dev: Device handle :type dev: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` * **capabilities** (*list[unsigned int]*) -- Returned capability details of each requested operation .. seealso:: :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities`, :py:obj:`~.cuDeviceGeHostAtomicCapabilities`
- cuda.bindings.runtime.cudaDeviceGetDefaultMemPool(int device)#
Returns the default mempool of a device. The default mempool of a device contains device memory from that device. :param device: None :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` * **memPool** (:py:obj:`~.cudaMemPool_t`) -- None .. seealso:: :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMemPoolTrimTo`, :py:obj:`~.cudaMemPoolGetAttribute`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolSetAccess`
- cuda.bindings.runtime.cudaDeviceSetMemPool(int device, memPool)#
Sets the current memory pool of a device. The memory pool must be local to the specified device. Unless a mempool is specified in the :py:obj:`~.cudaMallocAsync` call, :py:obj:`~.cudaMallocAsync` allocates from the current mempool of the provided stream's device. By default, a device's current memory pool is its default memory pool. :param device: None :type device: int :param memPool: None :type memPool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolDestroy`, :py:obj:`~.cudaMallocFromPoolAsync` .. rubric:: Notes Use :py:obj:`~.cudaMallocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on.
- cuda.bindings.runtime.cudaDeviceGetMemPool(int device)#
Gets the current mempool for a device. Returns the last pool provided to :py:obj:`~.cudaDeviceSetMemPool` for this device or the device's default memory pool if :py:obj:`~.cudaDeviceSetMemPool` has never been called. By default the current mempool is the default mempool for a device, otherwise the returned pool must have been set with :py:obj:`~.cuDeviceSetMemPool` or :py:obj:`~.cudaDeviceSetMemPool`. :param device: None :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` * **memPool** (:py:obj:`~.cudaMemPool_t`) -- None .. seealso:: :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceSetMemPool`
- cuda.bindings.runtime.cudaDeviceGetNvSciSyncAttributes(
- nvSciSyncAttrList,
- int device,
- int flags,
Return NvSciSync attributes that this device can support. Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this CUDA device, `dev` can support. The returned `nvSciSyncAttrList` can be used to create an NvSciSync that matches this device's capabilities. If NvSciSyncAttrKey_RequiredPerm field in `nvSciSyncAttrList` is already set this API will return :py:obj:`~.cudaErrorInvalidValue`. The applications should set `nvSciSyncAttrList` to a valid NvSciSyncAttrList failing which this API will return :py:obj:`~.cudaErrorInvalidHandle`. The `flags` controls how applications intends to use the NvSciSync created from the `nvSciSyncAttrList`. The valid flags are: - :py:obj:`~.cudaNvSciSyncAttrSignal`, specifies that the applications intends to signal an NvSciSync on this CUDA device. - :py:obj:`~.cudaNvSciSyncAttrWait`, specifies that the applications intends to wait on an NvSciSync on this CUDA device. At least one of these flags must be set, failing which the API returns :py:obj:`~.cudaErrorInvalidValue`. Both the flags are orthogonal to one another: a developer may set both these flags that allows to set both wait and signal specific attributes in the same `nvSciSyncAttrList`. Note that this API updates the input `nvSciSyncAttrList` with values equivalent to the following public attribute key-values: NvSciSyncAttrKey_RequiredPerm is set to - NvSciSyncAccessPerm_SignalOnly if :py:obj:`~.cudaNvSciSyncAttrSignal` is set in `flags`. - NvSciSyncAccessPerm_WaitOnly if :py:obj:`~.cudaNvSciSyncAttrWait` is set in `flags`. - NvSciSyncAccessPerm_WaitSignal if both :py:obj:`~.cudaNvSciSyncAttrWait` and :py:obj:`~.cudaNvSciSyncAttrSignal` are set in `flags`. NvSciSyncAttrKey_PrimitiveInfo is set to - NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid `device`. - NvSciSyncAttrValPrimitiveType_Syncpoint if `device` is a Tegra device. - NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if `device` is GA10X+. NvSciSyncAttrKey_GpuId is set to the same UUID that is returned in `cudaDeviceProp.uuid` from :py:obj:`~.cudaDeviceGetProperties` for this `device`. :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorMemoryAllocation` :param nvSciSyncAttrList: Return NvSciSync attributes supported. :type nvSciSyncAttrList: Any :param device: Valid Cuda Device to get NvSciSync attributes for. :type device: int :param flags: flags describing NvSciSync usage. :type flags: int :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`
- cuda.bindings.runtime.cudaDeviceGetP2PAttribute(
- attr: cudaDeviceP2PAttr,
- int srcDevice,
- int dstDevice,
Queries attributes of the link between two devices. Returns in `*value` the value of the requested attribute `attrib` of the link between `srcDevice` and `dstDevice`. The supported attributes are: - :py:obj:`~.cudaDevP2PAttrPerformanceRank`: A relative value indicating the performance of the link between two devices. Lower value means better performance (0 being the value used for most performant link). - :py:obj:`~.cudaDevP2PAttrAccessSupported`: 1 if peer access is enabled. - :py:obj:`~.cudaDevP2PAttrNativeAtomicSupported`: 1 if all native atomic operations over the link are supported. - :py:obj:`~.cudaDevP2PAttrCudaArrayAccessSupported`: 1 if accessing CUDA arrays over the link is supported. - :py:obj:`~.cudaDevP2PAttrOnlyPartialNativeAtomicSupported`: 1 if some CUDA-valid atomic operations over the link are supported. Information about specific operations can be retrieved with :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities`. Returns :py:obj:`~.cudaErrorInvalidDevice` if `srcDevice` or `dstDevice` are not valid or if they represent the same device. Returns :py:obj:`~.cudaErrorInvalidValue` if `attrib` is not valid or if `value` is a null pointer. :param attrib: The requested attribute of the link between `srcDevice` and `dstDevice`. :type attrib: :py:obj:`~.cudaDeviceP2PAttr` :param srcDevice: The source device of the target link. :type srcDevice: int :param dstDevice: The destination device of the target link. :type dstDevice: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` * **value** (*int*) -- Returned value of the requested attribute .. seealso:: :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cuDeviceGetP2PAttribute`
- cuda.bindings.runtime.cudaDeviceGetP2PAtomicCapabilities(operations: Optional[tuple[cudaAtomicOperation] | list[cudaAtomicOperation]], unsigned int count, int srcDevice, int dstDevice)#
Queries details about atomic operations supported between two devices. Returns in `*capabilities` the details about requested atomic `*operations` over the the link between `srcDevice` and `dstDevice`. The allocated size of `*operations` and `*capabilities` must be `count`. For each :py:obj:`~.cudaAtomicOperation` in `*operations`, the corresponding result in `*capabilities` will be a bitmask indicating which of :py:obj:`~.cudaAtomicOperationCapability` the link supports natively. Returns :py:obj:`~.cudaErrorInvalidDevice` if `srcDevice` or `dstDevice` are not valid or if they represent the same device. Returns :py:obj:`~.cudaErrorInvalidValue` if `*capabilities` or `*operations` is NULL, if `count` is 0, or if any of `*operations` is not valid. :param operations: Requested operations :type operations: list[:py:obj:`~.cudaAtomicOperation`] :param count: Count of requested operations and size of capabilities :type count: unsigned int :param srcDevice: The source device of the target link :type srcDevice: int :param dstDevice: The destination device of the target link :type dstDevice: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` * **capabilities** (*list[unsigned int]*) -- Returned capability details of each requested operation .. seealso:: :py:obj:`~.cudaDeviceGetP2PAttribute`, :py:obj:`~.cuDeviceGetP2PAttribute`, :py:obj:`~.cuDeviceGetP2PAtomicCapabilities`
- cuda.bindings.runtime.cudaChooseDevice(cudaDeviceProp prop: Optional[cudaDeviceProp])#
Select compute-device which best matches criteria. Returns in `*device` the device which has properties that best match `*prop`. :param prop: Desired device properties :type prop: :py:obj:`~.cudaDeviceProp` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **device** (*int*) -- Device with best match .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice`
- cuda.bindings.runtime.cudaInitDevice(
- int device,
- unsigned int deviceFlags,
- unsigned int flags,
Initialize device to be used for GPU executions. This function will initialize the CUDA Runtime structures and primary context on `device` when called, but the context will not be made current to `device`. When :py:obj:`~.cudaInitDeviceFlagsAreValid` is set in `flags`, deviceFlags are applied to the requested device. The values of deviceFlags match those of the flags parameters in :py:obj:`~.cudaSetDeviceFlags`. The effect may be verified by :py:obj:`~.cudaGetDeviceFlags`. This function will return an error if the device is in :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. :param device: Device on which the runtime will initialize itself. :type device: int :param deviceFlags: Parameters for device operation. :type deviceFlags: unsigned int :param flags: Flags for controlling the device initialization. :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaSetDevice`
- cuda.bindings.runtime.cudaSetDevice(int device)#
Set device to be used for GPU executions. Sets `device` as the current device for the calling host thread. Valid device id's are 0 to (:py:obj:`~.cudaGetDeviceCount()` - 1). Any device memory subsequently allocated from this host thread using :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()` or :py:obj:`~.cudaMallocArray()` will be physically resident on `device`. Any host memory allocated from this host thread using :py:obj:`~.cudaMallocHost()` or :py:obj:`~.cudaHostAlloc()` or :py:obj:`~.cudaHostRegister()` will have its lifetime associated with `device`. Any streams or events created from this host thread will be associated with `device`. Any kernels launched from this host thread using the <<<>>> operator or :py:obj:`~.cudaLaunchKernel()` will be executed on `device`. This call may be made from any host thread, to any device, and at any time. This function will do no synchronization with the previous or new device, and should only take significant time when it initializes the runtime's context state. This call will bind the primary context of the specified device to the calling thread and all the subsequent memory allocations, stream and event creations, and kernel launches will be associated with the primary context. This function will also immediately initialize the runtime state on the primary context, and the context will be current on `device` immediately. This function will return an error if the device is in :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. It is not required to call :py:obj:`~.cudaInitDevice` before using this function. :param device: Device on which the active host thread should execute the device code. :type device: int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorDeviceUnavailable`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxSetCurrent`
- cuda.bindings.runtime.cudaGetDevice()#
Returns which device is currently being used. Returns in `*device` the current device for the calling host thread. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUnavailable`, * **device** (*int*) -- Returns the device on which the active host thread executes the device code. .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuCtxGetCurrent`
- cuda.bindings.runtime.cudaSetDeviceFlags(unsigned int flags)#
Sets flags to be used for device executions. Records `flags` as the flags for the current device. If the current device has been set and that device has already been initialized, the previous flags are overwritten. If the current device has not been initialized, it is initialized with the provided flags. If no device has been made current to the calling thread, a default device is selected and initialized with the provided flags. The three LSBs of the `flags` parameter can be used to control how the CPU thread interacts with the OS scheduler when waiting for results from the device. - :py:obj:`~.cudaDeviceScheduleAuto`: The default value if the `flags` parameter is zero, uses a heuristic based on the number of active CUDA contexts in the process `C` and the number of logical processors in the system `P`. If `C` > `P`, then CUDA will yield to other OS threads when waiting for the device, otherwise CUDA will not yield while waiting for results and actively spin on the processor. Additionally, on Tegra devices, :py:obj:`~.cudaDeviceScheduleAuto` uses a heuristic based on the power profile of the platform and may choose :py:obj:`~.cudaDeviceScheduleBlockingSync` for low-powered devices. - :py:obj:`~.cudaDeviceScheduleSpin`: Instruct CUDA to actively spin when waiting for results from the device. This can decrease latency when waiting for the device, but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread. - :py:obj:`~.cudaDeviceScheduleYield`: Instruct CUDA to yield its thread when waiting for results from the device. This can increase latency when waiting for the device, but can increase the performance of CPU threads performing work in parallel with the device. - :py:obj:`~.cudaDeviceScheduleBlockingSync`: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the device to finish work. - :py:obj:`~.cudaDeviceBlockingSync`: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the device to finish work. :py:obj:`~.Deprecated:` This flag was deprecated as of CUDA 4.0 and replaced with :py:obj:`~.cudaDeviceScheduleBlockingSync`. - :py:obj:`~.cudaDeviceMapHost`: This flag enables allocating pinned host memory that is accessible to the device. It is implicit for the runtime but may be absent if a context is created using the driver API. If this flag is not set, :py:obj:`~.cudaHostGetDevicePointer()` will always return a failure code. - :py:obj:`~.cudaDeviceLmemResizeToMax`: Instruct CUDA to not reduce local memory after resizing local memory for a kernel. This can prevent thrashing by local memory allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage. :py:obj:`~.Deprecated:` This flag is deprecated and the behavior enabled by this flag is now the default and cannot be disabled. - :py:obj:`~.cudaDeviceSyncMemops`: Ensures that synchronous memory operations initiated on this context will always synchronize. See further documentation in the section titled "API Synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior. :param flags: Parameters for device operation :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetValidDevices`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuDevicePrimaryCtxSetFlags`
- cuda.bindings.runtime.cudaGetDeviceFlags()#
Gets the flags for the current device. Returns in `flags` the flags for the current device. If there is a current device for the calling thread, the flags for the device are returned. If there is no current device, the flags for the first device are returned, which may be the default flags. Compare to the behavior of :py:obj:`~.cudaSetDeviceFlags`. Typically, the flags returned should match the behavior that will be seen if the calling thread uses a device after this call, without any change to the flags or current device inbetween by this or another thread. Note that if the device is not initialized, it is possible for another thread to change the flags for the current device before it is initialized. Additionally, when using exclusive mode, if this thread has not requested a specific device, it may use a device other than the first device, contrary to the assumption made by this function. If a context has been created via the driver API and is current to the calling thread, the flags for that context are always returned. Flags returned by this function may specifically include :py:obj:`~.cudaDeviceMapHost` even though it is not accepted by :py:obj:`~.cudaSetDeviceFlags` because it is implicit in runtime API flags. The reason for this is that the current context may have been created via the driver API in which case the flag is not implicit and may be unset. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` * **flags** (*unsigned int*) -- Pointer to store the device flags .. seealso:: :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuDevicePrimaryCtxGetState`
Error Handling#
This section describes the error handling functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaGetLastError()#
Returns the last error from a runtime call. Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread and resets it to :py:obj:`~.cudaSuccess`. Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime. :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMissingConfiguration`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorLaunchTimeout`, :py:obj:`~.cudaErrorLaunchOutOfResources`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidConfiguration`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidSymbol`, :py:obj:`~.cudaErrorUnmapBufferObjectFailed`, :py:obj:`~.cudaErrorInvalidDevicePointer`, :py:obj:`~.cudaErrorInvalidTexture`, :py:obj:`~.cudaErrorInvalidTextureBinding`, :py:obj:`~.cudaErrorInvalidChannelDescriptor`, :py:obj:`~.cudaErrorInvalidMemcpyDirection`, :py:obj:`~.cudaErrorInvalidFilterSetting`, :py:obj:`~.cudaErrorInvalidNormSetting`, :py:obj:`~.cudaErrorUnknown`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInsufficientDriver`, :py:obj:`~.cudaErrorNoDevice`, :py:obj:`~.cudaErrorSetOnActiveProcess`, :py:obj:`~.cudaErrorStartupFailure`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorJitCompilerNotFound`, :py:obj:`~.cudaErrorJitCompilationDisabled` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaError`
- cuda.bindings.runtime.cudaPeekAtLastError()#
Returns the last error from a runtime call. Returns the last error that has been produced by any of the runtime calls in the same instance of the CUDA Runtime library in the host thread. This call does not reset the error to :py:obj:`~.cudaSuccess` like :py:obj:`~.cudaGetLastError()`. Note: Multiple instances of the CUDA Runtime library can be present in an application when using a library that statically links the CUDA Runtime. :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMissingConfiguration`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorLaunchTimeout`, :py:obj:`~.cudaErrorLaunchOutOfResources`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidConfiguration`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidSymbol`, :py:obj:`~.cudaErrorUnmapBufferObjectFailed`, :py:obj:`~.cudaErrorInvalidDevicePointer`, :py:obj:`~.cudaErrorInvalidTexture`, :py:obj:`~.cudaErrorInvalidTextureBinding`, :py:obj:`~.cudaErrorInvalidChannelDescriptor`, :py:obj:`~.cudaErrorInvalidMemcpyDirection`, :py:obj:`~.cudaErrorInvalidFilterSetting`, :py:obj:`~.cudaErrorInvalidNormSetting`, :py:obj:`~.cudaErrorUnknown`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInsufficientDriver`, :py:obj:`~.cudaErrorNoDevice`, :py:obj:`~.cudaErrorSetOnActiveProcess`, :py:obj:`~.cudaErrorStartupFailure`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorJitCompilerNotFound`, :py:obj:`~.cudaErrorJitCompilationDisabled` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaError`
- cuda.bindings.runtime.cudaGetErrorName(error: cudaError_t)#
Returns the string representation of an error code enum name. Returns a string containing the name of an error code in the enum. If the error code is not recognized, "unrecognized error code" is returned. :param error: Error code to convert to string :type error: :py:obj:`~.cudaError_t` :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * *bytes* -- `char*` pointer to a NULL-terminated string .. seealso:: :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaError`, :py:obj:`~.cuGetErrorName`
- cuda.bindings.runtime.cudaGetErrorString(error: cudaError_t)#
Returns the description string for an error code. Returns the description string for an error code. If the error code is not recognized, "unrecognized error code" is returned. :param error: Error code to convert to string :type error: :py:obj:`~.cudaError_t` :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * *bytes* -- `char*` pointer to a NULL-terminated string .. seealso:: :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaError`, :py:obj:`~.cuGetErrorString`
Stream Management#
This section describes the stream management functions of the CUDA runtime application programming interface.
- class cuda.bindings.runtime.cudaStreamCallback_t(*args, **kwargs)#
Get memory address of class instance
- cuda.bindings.runtime.cudaStreamCreate()#
Create an asynchronous stream. Creates a new asynchronous stream on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` * **pStream** (:py:obj:`~.cudaStream_t`) -- Pointer to new stream identifier .. seealso:: :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate`
- cuda.bindings.runtime.cudaStreamCreateWithFlags(unsigned int flags)#
Create an asynchronous stream. Creates a new asynchronous stream on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it. The `flags` argument determines the behaviors of the stream. Valid values for `flags` are - :py:obj:`~.cudaStreamDefault`: Default stream creation flag. - :py:obj:`~.cudaStreamNonBlocking`: Specifies that work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and that the created stream should perform no implicit synchronization with stream 0. :param flags: Parameters for stream creation :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` * **pStream** (:py:obj:`~.cudaStream_t`) -- Pointer to new stream identifier .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate`
- cuda.bindings.runtime.cudaStreamCreateWithPriority(unsigned int flags, int priority)#
Create an asynchronous stream with the specified priority. Creates a stream with the specified priority and returns a handle in `pStream`. The stream is created on the context that is current to the calling host thread. If no context is current to the calling host thread, then the primary context for a device is selected, made current to the calling thread, and initialized before creating a stream on it. This affects the scheduling priority of work in the stream. Priorities provide a hint to preferentially run work with higher priority when possible, but do not preempt already-running work or provide any other functional guarantee on execution order. `priority` follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful numerical priorities can be queried using :py:obj:`~.cudaDeviceGetStreamPriorityRange`. If the specified priority is outside the numerical range returned by :py:obj:`~.cudaDeviceGetStreamPriorityRange`, it will automatically be clamped to the lowest or the highest number in the range. :param flags: Flags for stream creation. See :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags that can be passed :type flags: unsigned int :param priority: Priority of the stream. Lower numbers represent higher priorities. See :py:obj:`~.cudaDeviceGetStreamPriorityRange` for more information about the meaningful stream priorities that can be passed. :type priority: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` * **pStream** (:py:obj:`~.cudaStream_t`) -- Pointer to new stream identifier .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority` .. rubric:: Notes Stream priorities are supported only on GPUs with compute capability 3.5 or higher. In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations.
- cuda.bindings.runtime.cudaStreamGetPriority(hStream)#
Query the priority of a stream. Query the priority of a stream. The priority is returned in in `priority`. Note that if the stream was created with a priority outside the meaningful numerical range returned by :py:obj:`~.cudaDeviceGetStreamPriorityRange`, this function returns the clamped priority. See :py:obj:`~.cudaStreamCreateWithPriority` for details about priority clamping. :param hStream: Handle to the stream to be queried :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **priority** (*int*) -- Pointer to a signed integer in which the stream's priority is returned .. seealso:: :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cuStreamGetPriority`
- cuda.bindings.runtime.cudaStreamGetFlags(hStream)#
Query the flags of a stream. Query the flags of a stream. The flags are returned in `flags`. See :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags. :param hStream: Handle to the stream to be queried :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **flags** (*unsigned int*) -- Pointer to an unsigned integer in which the stream's flags are returned .. seealso:: :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cuStreamGetFlags`
- cuda.bindings.runtime.cudaStreamGetId(hStream)#
Query the Id of a stream. Query the Id of a stream. The Id is returned in `streamId`. The Id is unique for the life of the program. The stream handle `hStream` can refer to any of the following: - a stream created via any of the CUDA runtime APIs such as :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` and :py:obj:`~.cudaStreamCreateWithPriority`, or their driver API equivalents such as :py:obj:`~.cuStreamCreate` or :py:obj:`~.cuStreamCreateWithPriority`. Passing an invalid handle will result in undefined behavior. - any of the special streams such as the NULL stream, :py:obj:`~.cudaStreamLegacy` and :py:obj:`~.cudaStreamPerThread` respectively. The driver API equivalents of these are also accepted which are NULL, :py:obj:`~.CU_STREAM_LEGACY` and :py:obj:`~.CU_STREAM_PER_THREAD`. :param hStream: Handle to the stream to be queried :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **streamId** (*unsigned long long*) -- Pointer to an unsigned long long in which the stream Id is returned .. seealso:: :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetId`
- cuda.bindings.runtime.cudaStreamGetDevice(hStream)#
Query the device of a stream. Returns in `*device` the device of the stream. :param hStream: Handle to the stream to be queried :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUnavailable`, * **device** (*int*) -- Returns the device to which the stream belongs .. seealso:: :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetId`
- cuda.bindings.runtime.cudaCtxResetPersistingL2Cache()#
Resets all persisting lines in cache to normal status. Resets all persisting lines in cache to normal status. Takes effect on function return. :returns: :py:obj:`~.cudaSuccess`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaStreamCopyAttributes(dst, src)#
Copies attributes from source stream to destination stream. Copies attributes from source stream `src` to destination stream `dst`. Both streams must have the same context. :param dst: Destination stream :type dst: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param src: Source stream For attributes see :py:obj:`~.cudaStreamAttrID` :type src: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaStreamGetAttribute(hStream, attr: cudaStreamAttrID)#
Queries stream attribute. Queries attribute `attr` from `hStream` and stores it in corresponding member of `value_out`. :param hStream: :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param attr: :type attr: :py:obj:`~.cudaStreamAttrID` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **value_out** (:py:obj:`~.cudaStreamAttrValue`) .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaStreamSetAttribute(hStream, attr: cudaStreamAttrID, cudaStreamAttrValue value: Optional[cudaStreamAttrValue])#
Sets stream attribute. Sets attribute `attr` on `hStream` from corresponding attribute of `value`. The updated attribute will be applied to subsequent work submitted to the stream. It will not affect previously submitted work. :param hStream: :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param attr: :type attr: :py:obj:`~.cudaStreamAttrID` :param value: :type value: :py:obj:`~.cudaStreamAttrValue` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaStreamDestroy(stream)#
Destroys and cleans up an asynchronous stream. Destroys and cleans up the asynchronous stream specified by `stream`. In case the device is still doing work in the stream `stream` when :py:obj:`~.cudaStreamDestroy()` is called, the function will return immediately and the resources associated with `stream` will be released automatically once the device has completed all work in `stream`. :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :py:obj:`~.cudaErrorExternalDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuStreamDestroy`
- cuda.bindings.runtime.cudaStreamWaitEvent(stream, event, unsigned int flags)#
Make a compute stream wait on an event. Makes all future work submitted to `stream` wait for all work captured in `event`. See :py:obj:`~.cudaEventRecord()` 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 device than `stream`. flags include: - :py:obj:`~.cudaEventWaitDefault`: Default event creation flag. - :py:obj:`~.cudaEventWaitExternal`: Event is captured in the graph as an external event node when performing stream capture. :param stream: Stream to wait :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param event: Event to wait on :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :param flags: Parameters for the operation(See above) :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamWaitEvent`
- cuda.bindings.runtime.cudaStreamAddCallback(stream, callback, userData, unsigned int flags)#
Add a callback to a compute stream. Adds a callback to be called on the host after all currently enqueued items in the stream have completed. For each cudaStreamAddCallback call, a callback will be executed exactly once. The callback will block later work in the stream until it is finished. The callback may be passed :py:obj:`~.cudaSuccess` or an error code. In the event of a device error, all subsequently executed callbacks will receive an appropriate :py:obj:`~.cudaError_t`. Callbacks must not make any CUDA API calls. Attempting to use CUDA APIs may result in :py:obj:`~.cudaErrorNotPermitted`. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized. For the purposes of Unified Memory, callback execution makes a number of guarantees: - The callback stream is considered idle for the duration of the callback. Thus, for example, a callback may always use memory attached to the callback stream. - The start of execution of a callback has the same effect as synchronizing an event recorded in the same stream immediately prior to the callback. It thus synchronizes streams which have been "joined" prior to the callback. - Adding device work to any stream does not have the effect of making the stream active until all preceding callbacks have executed. Thus, for example, a callback might use global attached memory even if work has been added to another stream, if it has been properly ordered with an event. - Completion of a callback does not cause a stream to become active except as described above. The callback stream will remain idle if no device work follows the callback, and will remain idle across consecutive callbacks without device work in between. Thus, for example, stream synchronization can be done by signaling from a callback at the end of the stream. :param stream: Stream to add callback to :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param callback: The function to call once preceding stream operations are complete :type callback: :py:obj:`~.cudaStreamCallback_t` :param userData: User specified data to be passed to the callback function :type userData: Any :param flags: Reserved for future use, must be 0 :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cuStreamAddCallback` .. rubric:: Notes This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device error, consider using :py:obj:`~.cudaLaunchHostFunc`. Additionally, this function is not supported with :py:obj:`~.cudaStreamBeginCapture` and :py:obj:`~.cudaStreamEndCapture`, unlike :py:obj:`~.cudaLaunchHostFunc`.
- cuda.bindings.runtime.cudaStreamSynchronize(stream)#
Waits for stream tasks to complete. Blocks until `stream` has completed all operations. If the :py:obj:`~.cudaDeviceScheduleBlockingSync` flag was set for this device, the host thread will block until the stream is finished with all of its tasks. :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamSynchronize`
- cuda.bindings.runtime.cudaStreamQuery(stream)#
Queries an asynchronous stream for completion status. Returns :py:obj:`~.cudaSuccess` if all operations in `stream` have completed, or :py:obj:`~.cudaErrorNotReady` if not. For the purposes of Unified Memory, a return value of :py:obj:`~.cudaSuccess` is equivalent to having called :py:obj:`~.cudaStreamSynchronize()`. :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamQuery`
- cuda.bindings.runtime.cudaStreamAttachMemAsync(
- stream,
- devPtr,
- size_t length,
- unsigned int flags,
Attach memory to a stream asynchronously. Enqueues an operation in `stream` to specify stream association of `length` bytes of memory starting from `devPtr`. This function is a stream-ordered operation, meaning that it is dependent on, and will only take effect when, previous work in stream has completed. Any previous association is automatically replaced. `devPtr` must point to an one of the following types of memories: - managed memory declared using the managed keyword or allocated with :py:obj:`~.cudaMallocManaged`. - a valid host-accessible region of system-allocated pageable memory. This type of memory may only be specified if the device associated with the stream reports a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. For managed allocations, `length` must be either zero or the entire allocation's size. Both indicate that the entire allocation's stream association is being changed. Currently, it is not possible to change stream association for a portion of a managed allocation. For pageable allocations, `length` must be non-zero. The stream association is specified using `flags` which must be one of :py:obj:`~.cudaMemAttachGlobal`, :py:obj:`~.cudaMemAttachHost` or :py:obj:`~.cudaMemAttachSingle`. The default value for `flags` is :py:obj:`~.cudaMemAttachSingle` If the :py:obj:`~.cudaMemAttachGlobal` flag is specified, the memory can be accessed by any stream on any device. If the :py:obj:`~.cudaMemAttachHost` flag is specified, the program makes a guarantee that it won't access the memory on the device from any stream on a device that has a zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If the :py:obj:`~.cudaMemAttachSingle` flag is specified and `stream` is associated with a device that has a zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, the program makes a guarantee that it will only access the memory on the device from `stream`. It is illegal to attach singly to the NULL stream, because the NULL stream is a virtual global stream and not a specific stream. An error will be returned in this case. When memory is associated with a single stream, the Unified Memory system will allow CPU access to this memory region so long as all operations in `stream` have completed, regardless of whether other streams are active. In effect, this constrains exclusive ownership of the managed memory region by an active GPU to per-stream activity instead of whole-GPU activity. Accessing memory on the device from streams that are not associated with it will produce undefined results. No error checking is performed by the Unified Memory system to ensure that kernels launched into other streams do not access this region. It is a program's responsibility to order calls to :py:obj:`~.cudaStreamAttachMemAsync` via events, synchronization or other means to ensure legal access to memory at all times. Data visibility and coherency will be changed appropriately for all kernels which follow a stream-association change. If `stream` is destroyed while data is associated with it, the association is removed and the association reverts to the default visibility of the allocation as specified at :py:obj:`~.cudaMallocManaged`. For managed variables, the default association is always :py:obj:`~.cudaMemAttachGlobal`. Note that destroying a stream is an asynchronous operation, and as a result, the change to default association won't happen until all work in the stream has completed. :param stream: Stream in which to enqueue the attach operation :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param devPtr: Pointer to memory (must be a pointer to managed memory or to a valid host-accessible region of system-allocated memory) :type devPtr: Any :param length: Length of memory (defaults to zero) :type length: size_t :param flags: Must be one of :py:obj:`~.cudaMemAttachGlobal`, :py:obj:`~.cudaMemAttachHost` or :py:obj:`~.cudaMemAttachSingle` (defaults to :py:obj:`~.cudaMemAttachSingle`) :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cuStreamAttachMemAsync`
- cuda.bindings.runtime.cudaStreamBeginCapture(stream, mode: cudaStreamCaptureMode)#
Begins graph capture on a stream. Begin graph capture on `stream`. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into a graph, which will be returned via :py:obj:`~.cudaStreamEndCapture`. Capture may not be initiated if `stream` is :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode. The capture mode may be queried via :py:obj:`~.cudaStreamIsCapturing`. A unique id representing the capture sequence may be queried via :py:obj:`~.cudaStreamGetCaptureInfo`. If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the same thread. :param stream: Stream in which to initiate capture :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param mode: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. :type mode: :py:obj:`~.cudaStreamCaptureMode` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` .. rubric:: Notes Kernels captured using this API 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.
- cuda.bindings.runtime.cudaStreamBeginCaptureToGraph(stream, graph, dependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData: Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, mode: cudaStreamCaptureMode)#
Begins graph capture on a stream to an existing graph. Begin graph capture on `stream`. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into `graph`, which will be returned via :py:obj:`~.cudaStreamEndCapture`. Capture may not be initiated if `stream` is :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode. The capture mode may be queried via :py:obj:`~.cudaStreamIsCapturing`. A unique id representing the capture sequence may be queried via :py:obj:`~.cudaStreamGetCaptureInfo`. If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the same thread. :param stream: Stream in which to initiate capture. :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param graph: Graph to capture into. :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param dependencies: Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0. :type dependencies: list[:py:obj:`~.cudaGraphNode_t`] :param dependencyData: Optional array of data associated with each dependency. :type dependencyData: list[:py:obj:`~.cudaGraphEdgeData`] :param numDependencies: Number of dependencies. :type numDependencies: size_t :param mode: Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. :type mode: :py:obj:`~.cudaStreamCaptureMode` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` .. rubric:: Notes Kernels captured using this API 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.
- cuda.bindings.runtime.cudaThreadExchangeStreamCaptureMode(mode: cudaStreamCaptureMode)#
Swaps the stream capture interaction mode for a thread. Sets the calling thread's stream capture interaction mode to the value contained in `*mode`, and overwrites `*mode` with the previous mode for the thread. To facilitate deterministic behavior across function or module boundaries, callers are encouraged to use this API in a push-pop fashion: **View CUDA Toolkit Documentation for a C++ code example** During stream capture (see :py:obj:`~.cudaStreamBeginCapture`), some actions, such as a call to :py:obj:`~.cudaMalloc`, may be unsafe. In the case of :py:obj:`~.cudaMalloc`, the operation is not enqueued asynchronously to a stream, and is not observed by stream capture. Therefore, if the sequence of operations captured via :py:obj:`~.cudaStreamBeginCapture` depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid. Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a :py:obj:`~.cudaStreamBeginCapture`-:py:obj:`~.cudaStreamEndCapture` sequence. This behavior can be controlled via this API and flags to :py:obj:`~.cudaStreamBeginCapture`. A thread's mode is one of the following: - `cudaStreamCaptureModeGlobal:` This is the default mode. If the local thread has an ongoing capture sequence that was not initiated with `cudaStreamCaptureModeRelaxed` at `cuStreamBeginCapture`, or if any other thread has a concurrent capture sequence initiated with `cudaStreamCaptureModeGlobal`, this thread is prohibited from potentially unsafe API calls. - `cudaStreamCaptureModeThreadLocal:` If the local thread has an ongoing capture sequence not initiated with `cudaStreamCaptureModeRelaxed`, it is prohibited from potentially unsafe API calls. Concurrent capture sequences in other threads are ignored. - `cudaStreamCaptureModeRelaxed:` The local thread is not prohibited from potentially unsafe API calls. Note that the thread is still prohibited from API calls which necessarily conflict with stream capture, for example, attempting :py:obj:`~.cudaEventQuery` on an event that was last recorded inside a capture sequence. :param mode: Pointer to mode value to swap with the current mode :type mode: :py:obj:`~.cudaStreamCaptureMode` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **mode** (:py:obj:`~.cudaStreamCaptureMode`) -- Pointer to mode value to swap with the current mode .. seealso:: :py:obj:`~.cudaStreamBeginCapture`
- cuda.bindings.runtime.cudaStreamEndCapture(stream)#
Ends capture on a stream, returning the captured graph. End capture on `stream`, returning the captured graph via `pGraph`. Capture must have been initiated on `stream` via a call to :py:obj:`~.cudaStreamBeginCapture`. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned. If the `mode` argument to :py:obj:`~.cudaStreamBeginCapture` was not :py:obj:`~.cudaStreamCaptureModeRelaxed`, this call must be from the same thread as :py:obj:`~.cudaStreamBeginCapture`. :param stream: Stream to query :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureWrongThread` * **pGraph** (:py:obj:`~.cudaGraph_t`) -- The captured graph .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaGraphDestroy`
- cuda.bindings.runtime.cudaStreamIsCapturing(stream)#
Returns a stream's capture status. Return the capture status of `stream` via `pCaptureStatus`. After a successful call, `*pCaptureStatus` will contain one of the following: - :py:obj:`~.cudaStreamCaptureStatusNone`: The stream is not capturing. - :py:obj:`~.cudaStreamCaptureStatusActive`: The stream is capturing. - :py:obj:`~.cudaStreamCaptureStatusInvalidated`: The stream was capturing but an error has invalidated the capture sequence. The capture sequence must be terminated with :py:obj:`~.cudaStreamEndCapture` on the stream where it was initiated in order to continue using `stream`. Note that, if this is called on :py:obj:`~.cudaStreamLegacy` (the "null stream") while a blocking stream on the same device is capturing, it will return :py:obj:`~.cudaErrorStreamCaptureImplicit` and `*pCaptureStatus` is unspecified after the call. The blocking stream capture is not invalidated. When a blocking stream is capturing, the legacy stream is in an unusable state until the blocking stream capture is terminated. The legacy stream is not supported for stream capture, but attempted use would have an implicit dependency on the capturing stream(s). :param stream: Stream to query :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit` * **pCaptureStatus** (:py:obj:`~.cudaStreamCaptureStatus`) -- Returns the stream's capture status .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamEndCapture`
- cuda.bindings.runtime.cudaStreamGetCaptureInfo(stream)#
Query a stream's capture state. Query stream state related to stream capture. If called on :py:obj:`~.cudaStreamLegacy` (the "null stream") while a stream not created with :py:obj:`~.cudaStreamNonBlocking` is capturing, returns :py:obj:`~.cudaErrorStreamCaptureImplicit`. Valid data (other than capture status) is returned only if both of the following are true: - the call returns cudaSuccess - the returned capture status is :py:obj:`~.cudaStreamCaptureStatusActive` If `edgeData_out` is non-NULL then `dependencies_out` must be as well. If `dependencies_out` is non-NULL and `edgeData_out` is NULL, but there is non-zero edge data for one or more of the current stream dependencies, the call will return :py:obj:`~.cudaErrorLossyQuery`. :param stream: The stream to query :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit`, :py:obj:`~.cudaErrorLossyQuery` * **captureStatus_out** (:py:obj:`~.cudaStreamCaptureStatus`) -- Location to return the capture status of the stream; required * **id_out** (*unsigned long long*) -- Optional location to return an id for the capture sequence, which is unique over the lifetime of the process * **graph_out** (:py:obj:`~.cudaGraph_t`) -- Optional location to return the graph being captured into. All operations other than destroy and node removal are permitted on the graph while the capture sequence is in progress. This API does not transfer ownership of the graph, which is transferred or destroyed at :py:obj:`~.cudaStreamEndCapture`. Note that the graph handle may be invalidated before end of capture for certain errors. Nodes that are or become unreachable from the original stream at :py:obj:`~.cudaStreamEndCapture` due to direct actions on the graph do not trigger :py:obj:`~.cudaErrorStreamCaptureUnjoined`. * **dependencies_out** (list[:py:obj:`~.cudaGraphNode_t`]) -- Optional location to store a pointer to an array of nodes. The next node to be captured in the stream will depend on this set of nodes, absent operations such as event wait which modify this set. The array pointer is valid until the next API call which operates on the stream or until the capture is terminated. The node handles may be copied out and are valid until they or the graph is destroyed. The driver-owned array may also be passed directly to APIs that operate on the graph (not the stream) without copying. * **edgeData_out** (list[:py:obj:`~.cudaGraphEdgeData`]) -- Optional location to store a pointer to an array of graph edge data. This array parallels `dependencies_out`; the next node to be added has an edge to `dependencies_out`[i] with annotation `edgeData_out`[i] for each `i`. The array pointer is valid until the next API call which operates on the stream or until the capture is terminated. * **numDependencies_out** (*int*) -- Optional location to store the size of the array returned in dependencies_out. .. seealso:: :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamUpdateCaptureDependencies`
- cuda.bindings.runtime.cudaStreamUpdateCaptureDependencies(stream, dependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData: Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, unsigned int flags)#
Update the set of dependencies in a capturing stream. Modifies the dependency set of a capturing stream. The dependency set is the set of nodes that the next captured node in the stream will depend on. Valid flags are :py:obj:`~.cudaStreamAddCaptureDependencies` and :py:obj:`~.cudaStreamSetCaptureDependencies`. These control whether the set passed to the API is added to the existing set or replaces it. A flags value of 0 defaults to :py:obj:`~.cudaStreamAddCaptureDependencies`. Nodes that are removed from the dependency set via this API do not result in :py:obj:`~.cudaErrorStreamCaptureUnjoined` if they are unreachable from the stream at :py:obj:`~.cudaStreamEndCapture`. Returns :py:obj:`~.cudaErrorIllegalState` if the stream is not capturing. :param stream: The stream to update :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param dependencies: The set of dependencies to add :type dependencies: list[:py:obj:`~.cudaGraphNode_t`] :param dependencyData: Optional array of data associated with each dependency. :type dependencyData: list[:py:obj:`~.cudaGraphEdgeData`] :param numDependencies: The size of the dependencies array :type numDependencies: size_t :param flags: See above :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorIllegalState` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamGetCaptureInfo`
Event Management#
This section describes the event management functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaEventCreate()#
Creates an event object. Creates an event object for the current device using :py:obj:`~.cudaEventDefault`. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` * **event** (:py:obj:`~.cudaEvent_t`) -- Newly created event .. seealso:: :obj:`cudaEventCreate`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate`
- cuda.bindings.runtime.cudaEventCreateWithFlags(unsigned int flags)#
Creates an event object with the specified flags. Creates an event object for the current device with the specified flags. Valid flags include: - :py:obj:`~.cudaEventDefault`: Default event creation flag. - :py:obj:`~.cudaEventBlockingSync`: Specifies that event should use blocking synchronization. A host thread that uses :py:obj:`~.cudaEventSynchronize()` to wait on an event created with this flag will block until the event actually completes. - :py:obj:`~.cudaEventDisableTiming`: Specifies that the created event does not need to record timing data. Events created with this flag specified and the :py:obj:`~.cudaEventBlockingSync` flag not specified will provide the best performance when used with :py:obj:`~.cudaStreamWaitEvent()` and :py:obj:`~.cudaEventQuery()`. - :py:obj:`~.cudaEventInterprocess`: Specifies that the created event may be used as an interprocess event by :py:obj:`~.cudaIpcGetEventHandle()`. :py:obj:`~.cudaEventInterprocess` must be specified along with :py:obj:`~.cudaEventDisableTiming`. :param flags: Flags for new event :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` * **event** (:py:obj:`~.cudaEvent_t`) -- Newly created event .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate`
- cuda.bindings.runtime.cudaEventRecord(event, stream)#
Records an event. Captures in `event` the contents of `stream` at the time of this call. `event` and `stream` must be on the same CUDA context. Calls such as :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will then examine or wait for completion of the work that was captured. Uses of `stream` after this call do not modify `event`. See note on default stream behavior for what is captured in the default case. :py:obj:`~.cudaEventRecord()` can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as :py:obj:`~.cudaStreamWaitEvent()` use the most recently captured state at the time of the API call, and are not affected by later calls to :py:obj:`~.cudaEventRecord()`. Before the first call to :py:obj:`~.cudaEventRecord()`, an event represents an empty set of work, so for example :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaSuccess`. :param event: Event to record :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :param stream: Stream in which to record event :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cuEventRecord`
- cuda.bindings.runtime.cudaEventQuery(event)#
Records an event. Captures in `event` the contents of `stream` at the time of this call. `event` and `stream` must be on the same CUDA context. Calls such as :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will then examine or wait for completion of the work that was captured. Uses of `stream` after this call do not modify `event`. See note on default stream behavior for what is captured in the default case. :py:obj:`~.cudaEventRecordWithFlags()` can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as :py:obj:`~.cudaStreamWaitEvent()` use the most recently captured state at the time of the API call, and are not affected by later calls to :py:obj:`~.cudaEventRecordWithFlags()`. Before the first call to :py:obj:`~.cudaEventRecordWithFlags()`, an event represents an empty set of work, so for example :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaSuccess`. flags include: - :py:obj:`~.cudaEventRecordDefault`: Default event creation flag. - :py:obj:`~.cudaEventRecordExternal`: Event is captured in the graph as an external event node when performing stream capture. Queries an event's status Queries the status of all work currently captured by `event`. See :py:obj:`~.cudaEventRecord()` for details on what is captured by an event. Returns :py:obj:`~.cudaSuccess` if all captured work has been completed, or :py:obj:`~.cudaErrorNotReady` if any captured work is incomplete. For the purposes of Unified Memory, a return value of :py:obj:`~.cudaSuccess` is equivalent to having called :py:obj:`~.cudaEventSynchronize()`. :param event: Event to record :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventQuery`
- cuda.bindings.runtime.cudaEventSynchronize(event)#
Waits for an event to complete. Waits until the completion of all work currently captured in `event`. See :py:obj:`~.cudaEventRecord()` for details on what is captured by an event. Waiting for an event that was created with the :py:obj:`~.cudaEventBlockingSync` flag will cause the calling CPU thread to block until the event has been completed by the device. If the :py:obj:`~.cudaEventBlockingSync` flag has not been set, then the CPU thread will busy-wait until the event has been completed by the device. :param event: Event to wait for :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventSynchronize`
- cuda.bindings.runtime.cudaEventDestroy(event)#
Destroys an event object. Destroys the event specified by `event`. An event may be destroyed before it is complete (i.e., while :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaErrorNotReady`). In this case, the call does not block on completion of the event, and any associated resources will automatically be released asynchronously at completion. :param event: Event to destroy :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventDestroy`
- cuda.bindings.runtime.cudaEventElapsedTime(start, end)#
Computes the elapsed time between events. Computes the elapsed time between two events (in milliseconds with a resolution of around 0.5 microseconds). Note this API is not guaranteed to return the latest errors for pending work. As such this API is intended to serve as a elapsed time calculation only and polling for completion on the events to be compared should be done with :py:obj:`~.cudaEventQuery` instead. If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used the same stream handle). This happens because the :py:obj:`~.cudaEventRecord()` operation takes place asynchronously and there is no guarantee that the measured latency is actually just between the two events. Any number of other different stream operations could execute in between the two measured events, thus altering the timing in a significant way. If :py:obj:`~.cudaEventRecord()` has not been called on either event, then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If :py:obj:`~.cudaEventRecord()` has been called on both events but one or both of them has not yet been completed (that is, :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaErrorNotReady` on at least one of the events), :py:obj:`~.cudaErrorNotReady` is returned. If either event was created with the :py:obj:`~.cudaEventDisableTiming` flag, then this function will return :py:obj:`~.cudaErrorInvalidResourceHandle`. :param start: Starting event :type start: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :param end: Ending event :type end: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorUnknown` * **ms** (*float*) -- Time between `start` and `end` in ms .. seealso:: :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventElapsedTime`
External Resource Interoperability#
This section describes the external resource interoperability functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaImportExternalMemory(cudaExternalMemoryHandleDesc memHandleDesc: Optional[cudaExternalMemoryHandleDesc])#
Imports an external memory object. Imports an externally allocated memory object and returns a handle to that in `extMem_out`. The properties of the handle being imported must be described in `memHandleDesc`. The :py:obj:`~.cudaExternalMemoryHandleDesc` structure is defined as follows: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaExternalMemoryHandleDesc.type` specifies the type of handle being imported. :py:obj:`~.cudaExternalMemoryHandleType` is defined as: **View CUDA Toolkit Documentation for a C++ code example** If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueFd`, then :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::fd must be a valid file descriptor referencing a memory object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32`, then exactly one of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that references a memory object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a memory object. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32Kmt`, then :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle must be non-NULL and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying object, and thus will be invalid when all references to the memory object are destroyed. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Heap`, then exactly one of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Heap object. This handle holds a reference to the underlying object. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Heap object. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource`, then exactly one of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Resource object. This handle holds a reference to the underlying object. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Resource object. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource`,then exactly one of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a ID3D11Resource object. If :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D11Resource object. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt`, then :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle must be non-NULL and :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must be NULL. The handle specified must be a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a ID3D11Resource object. If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::nvSciBufObject must be NON-NULL and reference a valid NvSciBuf object. If the NvSciBuf object imported into CUDA is also mapped by other drivers, then the application must use :py:obj:`~.cudaWaitExternalSemaphoresAsync` or :py:obj:`~.cudaSignalExternalSemaphoresAsync` as approprriate barriers to maintain coherence between CUDA and the other drivers. See :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync` and :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync` for memory synchronization. The size of the memory object must be specified in :py:obj:`~.cudaExternalMemoryHandleDesc.size`. Specifying the flag :py:obj:`~.cudaExternalMemoryDedicated` in :py:obj:`~.cudaExternalMemoryHandleDesc.flags` indicates that the resource is a dedicated resource. The definition of what a dedicated resource is outside the scope of this extension. This flag must be set if :py:obj:`~.cudaExternalMemoryHandleDesc.type` is one of the following: :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource` :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource` :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt` :param memHandleDesc: Memory import handle descriptor :type memHandleDesc: :py:obj:`~.cudaExternalMemoryHandleDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` * **extMem_out** (:py:obj:`~.cudaExternalMemory_t`) -- Returned handle to an external memory object .. seealso:: :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` .. rubric:: Notes If the Vulkan memory imported into CUDA is mapped on the CPU then the application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges as well as appropriate Vulkan pipeline barriers to maintain coherence between CPU and GPU. For more information on these APIs, please refer to "Synchronization and Cache Control" chapter from Vulkan specification.
- cuda.bindings.runtime.cudaExternalMemoryGetMappedBuffer(extMem, cudaExternalMemoryBufferDesc bufferDesc: Optional[cudaExternalMemoryBufferDesc])#
Maps a buffer onto an imported memory object. Maps a buffer onto an imported memory object and returns a device pointer in `devPtr`. The properties of the buffer being mapped must be described in `bufferDesc`. The :py:obj:`~.cudaExternalMemoryBufferDesc` structure is defined as follows: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaExternalMemoryBufferDesc.offset` is the offset in the memory object where the buffer's base address is. :py:obj:`~.cudaExternalMemoryBufferDesc.size` is the size of the buffer. :py:obj:`~.cudaExternalMemoryBufferDesc.flags` must be zero. The offset and size have to be suitably aligned to match the requirements of the external API. Mapping two buffers whose ranges overlap may or may not result in the same virtual address being returned for the overlapped portion. In such cases, the application must ensure that all accesses to that region from the GPU are volatile. Otherwise writes made via one address are not guaranteed to be visible via the other address, even if they're issued by the same thread. It is recommended that applications map the combined range instead of mapping separate buffers and then apply the appropriate offsets to the returned pointer to derive the individual buffers. The returned pointer `devPtr` must be freed using :py:obj:`~.cudaFree`. :param extMem: Handle to external memory object :type extMem: :py:obj:`~.cudaExternalMemory_t` :param bufferDesc: Buffer descriptor :type bufferDesc: :py:obj:`~.cudaExternalMemoryBufferDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **devPtr** (*Any*) -- Returned device pointer to buffer .. seealso:: :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray`
- cuda.bindings.runtime.cudaExternalMemoryGetMappedMipmappedArray(extMem, cudaExternalMemoryMipmappedArrayDesc mipmapDesc: Optional[cudaExternalMemoryMipmappedArrayDesc])#
Maps a CUDA mipmapped array onto an external memory object. Maps a CUDA mipmapped array onto an external object and returns a handle to it in `mipmap`. The properties of the CUDA mipmapped array being mapped must be described in `mipmapDesc`. The structure :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` is defined as follows: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.offset` is the offset in the memory object where the base level of the mipmap chain is. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.formatDesc` describes the format of the data. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.extent` specifies the dimensions of the base level of the mipmap chain. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags` are flags associated with CUDA mipmapped arrays. For further details, please refer to the documentation for :py:obj:`~.cudaMalloc3DArray`. Note that if the mipmapped array is bound as a color target in the graphics API, then the flag :py:obj:`~.cudaArrayColorAttachment` must be specified in :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags`. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` specifies the total number of levels in the mipmap chain. The returned CUDA mipmapped array must be freed using :py:obj:`~.cudaFreeMipmappedArray`. :param extMem: Handle to external memory object :type extMem: :py:obj:`~.cudaExternalMemory_t` :param mipmapDesc: CUDA array descriptor :type mipmapDesc: :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **mipmap** (:py:obj:`~.cudaMipmappedArray_t`) -- Returned CUDA mipmapped array .. seealso:: :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer` .. rubric:: Notes If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` must not be greater than 1.
- cuda.bindings.runtime.cudaDestroyExternalMemory(extMem)#
Destroys an external memory object. Destroys the specified external memory object. Any existing buffers and CUDA mipmapped arrays mapped onto this object must no longer be used and must be explicitly freed using :py:obj:`~.cudaFree` and :py:obj:`~.cudaFreeMipmappedArray` respectively. :param extMem: External memory object to be destroyed :type extMem: :py:obj:`~.cudaExternalMemory_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray`
- cuda.bindings.runtime.cudaImportExternalSemaphore(cudaExternalSemaphoreHandleDesc semHandleDesc: Optional[cudaExternalSemaphoreHandleDesc])#
Imports an external semaphore. Imports an externally allocated synchronization object and returns a handle to that in `extSem_out`. The properties of the handle being imported must be described in `semHandleDesc`. The :py:obj:`~.cudaExternalSemaphoreHandleDesc` is defined as follows: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` specifies the type of handle being imported. :py:obj:`~.cudaExternalSemaphoreHandleType` is defined as: **View CUDA Toolkit Documentation for a C++ code example** If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, then :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::fd must be a valid file descriptor referencing a synchronization object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, then exactly one of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not NULL, then it must name a valid synchronization object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`, then :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle must be non-NULL and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must be NULL. The handle specified must be a globally shared KMT handle. This handle does not hold a reference to the underlying object, and thus will be invalid when all references to the synchronization object are destroyed. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, then exactly one of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Fence object. This handle holds a reference to the underlying object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not NULL, then it must name a valid synchronization object that refers to a valid ID3D12Fence object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, then exactly one of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that is returned by ID3D11Fence::CreateSharedHandle. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not NULL, then it must name a valid synchronization object that refers to a valid ID3D11Fence object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, then :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::nvSciSyncObj represents a valid NvSciSyncObj. :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, then exactly one of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is not NULL, then it represent a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle must be non-NULL and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must be NULL. The handle specified must represent a valid KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, then :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::fd must be a valid file descriptor referencing a synchronization object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior. If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`, then exactly one of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must not be NULL. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not NULL, then it must name a valid synchronization object. :param semHandleDesc: Semaphore import handle descriptor :type semHandleDesc: :py:obj:`~.cudaExternalSemaphoreHandleDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` * **extSem_out** (:py:obj:`~.cudaExternalSemaphore_t`) -- Returned handle to an external semaphore .. seealso:: :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`
- cuda.bindings.runtime.cudaSignalExternalSemaphoresAsync(extSemArray: Optional[tuple[cudaExternalSemaphore_t] | list[cudaExternalSemaphore_t]], paramsArray: Optional[tuple[cudaExternalSemaphoreSignalParams] | list[cudaExternalSemaphoreSignalParams]], unsigned int numExtSems, stream)#
Signals a set of external semaphore objects. Enqueues a signal operation on a set of externally allocated semaphore object in the specified stream. The operations will be executed when all prior operations in the stream complete. The exact semantics of signaling a semaphore depends on the type of the object. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then signaling the semaphore will set it to the signaled state. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then the semaphore will be set to the value specified in :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::fence::value. If the semaphore object is of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` this API sets :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence to a value that can be used by subsequent waiters of the same NvSciSync object to order operations with those currently submitted in `stream`. Such an update will overwrite previous contents of :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence. By default, signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all the external memory objects that are imported as :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any subsequent accesses made by other importers of the same set of NvSciBuf memory object(s) are coherent. These operations can be skipped by specifying the flag :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync`, which can be used as a performance optimization when data coherency is not required. But specifying this flag in scenarios where data coherency is required results in undefined behavior. Also, for semaphore object of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to cudaNvSciSyncAttrSignal, this API will return cudaErrorNotSupported. :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence associated with semaphore object of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` can be deterministic. For this the NvSciSyncAttrList used to create the semaphore object must have value of NvSciSyncAttrKey_RequireDeterministicFences key set to true. Deterministic fences allow users to enqueue a wait over the semaphore object even before corresponding signal is enqueued. For such a semaphore object, CUDA guarantees that each signal operation will increment the fence value by '1'. Users are expected to track count of signals enqueued on the semaphore object and insert waits accordingly. When such a semaphore object is signaled from multiple streams, due to concurrent stream execution, it is possible that the order in which the semaphore gets signaled is indeterministic. This could lead to waiters of the semaphore getting unblocked incorrectly. Users are expected to handle such situations, either by not using the same semaphore object with deterministic fence support enabled in different streams or by adding explicit dependency amongst such streams so that the semaphore is signaled in order. :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence associated with semaphore object of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` can be timestamp enabled. For this the NvSciSyncAttrList used to create the object must have the value of NvSciSyncAttrKey_WaiterRequireTimestamps key set to true. Timestamps are emitted asynchronously by the GPU and CUDA saves the GPU timestamp in the corresponding NvSciSyncFence at the time of signal on GPU. Users are expected to convert GPU clocks to CPU clocks using appropriate scaling functions. Users are expected to wait for the completion of the fence before extracting timestamp using appropriate NvSciSync APIs. Users are expected to ensure that there is only one outstanding timestamp enabled fence per Cuda-NvSciSync object at any point of time, failing which leads to undefined behavior. Extracting the timestamp before the corresponding fence is signalled could lead to undefined behaviour. Timestamp extracted via appropriate NvSciSync API would be in microseconds. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the keyed mutex will be released with the key specified in :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::key. :param extSemArray: Set of external semaphores to be signaled :type extSemArray: list[:py:obj:`~.cudaExternalSemaphore_t`] :param paramsArray: Array of semaphore parameters :type paramsArray: list[:py:obj:`~.cudaExternalSemaphoreSignalParams`] :param numExtSems: Number of semaphores to signal :type numExtSems: unsigned int :param stream: Stream to enqueue the signal operations in :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`
- cuda.bindings.runtime.cudaWaitExternalSemaphoresAsync(extSemArray: Optional[tuple[cudaExternalSemaphore_t] | list[cudaExternalSemaphore_t]], paramsArray: Optional[tuple[cudaExternalSemaphoreWaitParams] | list[cudaExternalSemaphoreWaitParams]], unsigned int numExtSems, stream)#
Waits on a set of external semaphore objects. Enqueues a wait operation on a set of externally allocated semaphore object in the specified stream. The operations will be executed when all prior operations in the stream complete. The exact semantics of waiting on a semaphore depends on the type of the object. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then waiting on the semaphore will wait until the semaphore reaches the signaled state. The semaphore will then be reset to the unsignaled state. Therefore for every signal operation, there can only be one wait operation. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then waiting on the semaphore will wait until the value of the semaphore is greater than or equal to :py:obj:`~.cudaExternalSemaphoreWaitParams`::params::fence::value. If the semaphore object is of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` then, waiting on the semaphore will wait until the :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence is signaled by the signaler of the NvSciSyncObj that was associated with this semaphore object. By default, waiting on such an external semaphore object causes appropriate memory synchronization operations to be performed over all external memory objects that are imported as :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any subsequent accesses made by other importers of the same set of NvSciBuf memory object(s) are coherent. These operations can be skipped by specifying the flag :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync`, which can be used as a performance optimization when data coherency is not required. But specifying this flag in scenarios where data coherency is required results in undefined behavior. Also, for semaphore object of the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to cudaNvSciSyncAttrWait, this API will return cudaErrorNotSupported. If the semaphore object is any one of the following types: :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the keyed mutex will be acquired when it is released with the key specified in :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::key or until the timeout specified by :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::timeoutMs has lapsed. The timeout interval can either be a finite value specified in milliseconds or an infinite value. In case an infinite value is specified the timeout never elapses. The windows INFINITE macro must be used to specify infinite timeout :param extSemArray: External semaphores to be waited on :type extSemArray: list[:py:obj:`~.cudaExternalSemaphore_t`] :param paramsArray: Array of semaphore parameters :type paramsArray: list[:py:obj:`~.cudaExternalSemaphoreWaitParams`] :param numExtSems: Number of semaphores to wait on :type numExtSems: unsigned int :param stream: Stream to enqueue the wait operations in :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :py:obj:`~.cudaErrorTimeout` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`
- cuda.bindings.runtime.cudaDestroyExternalSemaphore(extSem)#
Destroys an external semaphore. Destroys an external semaphore object and releases any references to the underlying resource. Any outstanding signals or waits must have completed before the semaphore is destroyed. :param extSem: External semaphore to be destroyed :type extSem: :py:obj:`~.cudaExternalSemaphore_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`
Execution Control#
This section describes the execution control functions of the CUDA runtime application programming interface.
Some functions have overloaded C++ API template versions documented separately in the C++ API Routines module.
- cuda.bindings.runtime.cudaFuncSetCacheConfig(func, cacheConfig: cudaFuncCache)#
Sets the preferred cache configuration for a device function. On devices where the L1 cache and shared memory use the same hardware resources, this sets through `cacheConfig` the preferred cache configuration for the function specified via `func`. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute `func`. `func` is a device function symbol and must be declared as a `__global__` function. If the specified function does not exist, then :py:obj:`~.cudaErrorInvalidDeviceFunction` is returned. For templated functions, pass the function symbol as follows: func_name<template_arg_0,...,template_arg_N> This setting does nothing on devices where the size of the L1 cache and shared memory are fixed. Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point. The supported cache configurations are: - :py:obj:`~.cudaFuncCachePreferNone`: no preference for shared memory or L1 (default) - :py:obj:`~.cudaFuncCachePreferShared`: prefer larger shared memory and smaller L1 cache - :py:obj:`~.cudaFuncCachePreferL1`: prefer larger L1 cache and smaller shared memory - :py:obj:`~.cudaFuncCachePreferEqual`: prefer equal size L1 cache and shared memory :param func: Device function symbol :type func: Any :param cacheConfig: Requested cache configuration :type cacheConfig: :py:obj:`~.cudaFuncCache` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 :rtype: cudaError_t .. seealso:: cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cudaFuncGetAttributes (C API)`, :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncSetCacheConfig` .. rubric:: Notes This API does not accept a :py:obj:`~.cudaKernel_t` casted as void*. If cache config modification is required for a :py:obj:`~.cudaKernel_t` (or a global function), it can be replaced with a call to :py:obj:`~.cudaFuncSetAttributes` with the attribute :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` to specify a more granular L1 cache and shared memory split configuration.
- cuda.bindings.runtime.cudaFuncGetAttributes(func)#
Find out attributes for a given function. This function obtains the attributes of a function specified via `func`. `func` is a device function symbol and must be declared as a `__global__` function. The fetched attributes are placed in `attr`. If the specified function does not exist, then it is assumed to be a :py:obj:`~.cudaKernel_t` and used as is. For templated functions, pass the function symbol as follows: func_name<template_arg_0,...,template_arg_N> Note that some function attributes such as :py:obj:`~.maxThreadsPerBlock` may vary based on the device that is currently being used. :param func: Device function symbol :type func: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 * **attr** (:py:obj:`~.cudaFuncAttributes`) -- Return pointer to function's attributes .. seealso:: :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncGetAttributes (C++ API), :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncGetAttribute`
- cuda.bindings.runtime.cudaFuncSetAttribute(func, attr: cudaFuncAttribute, int value)#
Set attributes for a given function. This function sets the attributes of a function specified via `func`. The parameter `func` must be a pointer to a function that executes on the device. The parameter specified by `func` must be declared as a `__global__` function. The enumeration defined by `attr` is set to the value defined by `value`. If the specified function does not exist, then it is assumed to be a :py:obj:`~.cudaKernel_t` and used as is. If the specified attribute cannot be written, or if the value is incorrect, then :py:obj:`~.cudaErrorInvalidValue` is returned. Valid values for `attr` are: - :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` - The requested maximum size in bytes of dynamically-allocated shared memory. The sum of this value and the function attribute :py:obj:`~.sharedSizeBytes` cannot exceed the device attribute :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`. The maximal size of requestable dynamic shared memory may differ by GPU architecture. - :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` - On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory. See :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`. This is only a hint, and the driver can choose a different ratio if required to execute the function. - :py:obj:`~.cudaFuncAttributeRequiredClusterWidth`: The required cluster width in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeRequiredClusterHeight`: The required cluster height in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeRequiredClusterDepth`: The required cluster depth in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. - :py:obj:`~.cudaFuncAttributeClusterSchedulingPolicyPreference`: The block scheduling policy of a function. The value type is cudaClusterSchedulingPolicy. cudaLaunchKernel (C++ API), cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cudaFuncGetAttributes (C API)`, :param func: Function to get attributes of :type func: Any :param attr: Attribute to set :type attr: :py:obj:`~.cudaFuncAttribute` :param value: Value to set :type value: int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t
- cuda.bindings.runtime.cudaFuncGetParamCount(func)#
Returns the number of parameters used by the function. Queries the number of kernel parameters used by `func` and returns it in `paramCount`. :param func: The function to query :type func: Any :returns: * *cudaError_t* -- :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, * **paramCount** (*int*) -- Returns the number of parameters used by the function
- cuda.bindings.runtime.cudaLaunchHostFunc(stream, fn, userData)#
Enqueues a host function call in a stream. Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work added after it. The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in :py:obj:`~.cudaErrorNotPermitted`, but this is not required. The host function must not perform any synchronization that may depend on outstanding CUDA work not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined order and may be serialized. For the purposes of Unified Memory, execution makes a number of guarantees: - The stream is considered idle for the duration of the function's execution. Thus, for example, the function may always use memory attached to the stream it was enqueued in. - The start of execution of the function has the same effect as synchronizing an event recorded in the same stream immediately prior to the function. It thus synchronizes streams which have been "joined" prior to the function. - Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and stream callbacks have executed. Thus, for example, a function might use global attached memory even if work has been added to another stream, if the work has been ordered behind the function call with an event. - Completion of the function does not cause a stream to become active except as described above. The stream will remain idle if no device work follows the function, and will remain idle across consecutive host functions or stream callbacks without device work in between. Thus, for example, stream synchronization can be done by signaling from a host function at the end of the stream. Note that, in constrast to :py:obj:`~.cuStreamAddCallback`, the function will not be called in the event of an error in the CUDA context. :param hStream: Stream to enqueue function call in :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param fn: The function to call once preceding stream operations are complete :type fn: :py:obj:`~.cudaHostFn_t` :param userData: User-specified data to be passed to the function :type userData: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuLaunchHostFunc`
- cuda.bindings.runtime.cudaLaunchHostFunc_v2(stream, fn, userData, unsigned int syncMode)#
Enqueues a host function call in a stream. Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work added after it. The host function must not make any CUDA API calls. Attempting to use a CUDA API may result in :py:obj:`~.cudaErrorNotPermitted`, but this is not required. The host function must not perform any synchronization that may depend on outstanding CUDA work not mandated to run earlier. Host functions without a mandated order (such as in independent streams) execute in undefined order and may be serialized. For the purposes of Unified Memory, execution makes a number of guarantees: - The stream is considered idle for the duration of the function's execution. Thus, for example, the function may always use memory attached to the stream it was enqueued in. - The start of execution of the function has the same effect as synchronizing an event recorded in the same stream immediately prior to the function. It thus synchronizes streams which have been "joined" prior to the function. - Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and stream callbacks have executed. Thus, for example, a function might use global attached memory even if work has been added to another stream, if the work has been ordered behind the function call with an event. - Completion of the function does not cause a stream to become active except as described above. The stream will remain idle if no device work follows the function, and will remain idle across consecutive host functions or stream callbacks without device work in between. Thus, for example, stream synchronization can be done by signaling from a host function at the end of the stream. Note that, in constrast to :py:obj:`~.cuStreamAddCallback`, the function will not be called in the event of an error in the CUDA context. :param hStream: Stream to enqueue function call in :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param fn: The function to call once preceding stream operations are complete :type fn: :py:obj:`~.cudaHostFn_t` :param userData: User-specified data to be passed to the function :type userData: Any :param syncMode: Sync mode for the host function :type syncMode: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuLaunchHostFunc`
Occupancy#
This section describes the occupancy calculation functions of the CUDA runtime application programming interface.
Besides the occupancy calculator functions (cudaOccupancyMaxActiveBlocksPerMultiprocessor and cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags), there are also C++ only occupancy-based launch configuration functions documented in C++ API Routines module.
See cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API) cudaOccupancyAvailableDynamicSMemPerBlock (C++ API),
- cuda.bindings.runtime.cudaOccupancyMaxActiveBlocksPerMultiprocessor(
- func,
- int blockSize,
- size_t dynamicSMemSize,
Returns occupancy for a device function. Returns in `*numBlocks` the maximum number of active blocks per streaming multiprocessor for the device function. :param func: Kernel function for which occupancy is calculated :type func: Any :param blockSize: Block size the kernel is intended to be launched with :type blockSize: int :param dynamicSMemSize: Per-block dynamic shared memory usage intended, in bytes :type dynamicSMemSize: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, * **numBlocks** (*int*) -- Returned occupancy .. seealso:: :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, :obj:`cudaOccupancyMaxPotentialBlockSize`, :obj:`cudaOccupancyMaxPotentialBlockSizeWithFlags`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMem`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags`, :obj:`cudaOccupancyAvailableDynamicSMemPerBlock`, :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor`
- cuda.bindings.runtime.cudaOccupancyAvailableDynamicSMemPerBlock(
- func,
- int numBlocks,
- int blockSize,
Returns dynamic shared memory available per block when launching `numBlocks` blocks on SM. Returns in `*dynamicSmemSize` the maximum size of dynamic shared memory to allow `numBlocks` blocks per SM. :param func: Kernel function for which occupancy is calculated :type func: Any :param numBlocks: Number of blocks to fit on SM :type numBlocks: int :param blockSize: Size of the block :type blockSize: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, * **dynamicSmemSize** (*int*) -- Returned maximum dynamic shared memory .. seealso:: :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, :obj:`cudaOccupancyMaxPotentialBlockSize`, :obj:`cudaOccupancyMaxPotentialBlockSizeWithFlags`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMem`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags`, :py:obj:`~.cudaOccupancyAvailableDynamicSMemPerBlock`
- cuda.bindings.runtime.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
- func,
- int blockSize,
- size_t dynamicSMemSize,
- unsigned int flags,
Returns occupancy for a device function with the specified flags. Returns in `*numBlocks` the maximum number of active blocks per streaming multiprocessor for the device function. The `flags` parameter controls how special cases are handled. Valid flags include: - :py:obj:`~.cudaOccupancyDefault`: keeps the default behavior as :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` - :py:obj:`~.cudaOccupancyDisableCachingOverride`: This flag suppresses the default behavior on platform where global caching affects occupancy. On such platforms, if caching is enabled, but per-block SM resource usage would result in zero occupancy, the occupancy calculator will calculate the occupancy as if caching is disabled. Setting this flag makes the occupancy calculator to return 0 in such cases. More information can be found about this feature in the "Unified L1/Texture Cache" section of the Maxwell tuning guide. :param func: Kernel function for which occupancy is calculated :type func: Any :param blockSize: Block size the kernel is intended to be launched with :type blockSize: int :param dynamicSMemSize: Per-block dynamic shared memory usage intended, in bytes :type dynamicSMemSize: size_t :param flags: Requested behavior for the occupancy calculator :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, * **numBlocks** (*int*) -- Returned occupancy .. seealso:: :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor`, :obj:`cudaOccupancyMaxPotentialBlockSize`, :obj:`cudaOccupancyMaxPotentialBlockSizeWithFlags`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMem`, :obj:`cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags`, :obj:`cudaOccupancyAvailableDynamicSMemPerBlock`, :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`
Memory Management#
This section describes the memory management functions of the CUDA runtime application programming interface.
Some functions have overloaded C++ API template versions documented separately in the C++ API Routines module.
- cuda.bindings.runtime.cudaMallocManaged(size_t size, unsigned int flags)#
Allocates memory that will be automatically managed by the Unified Memory system. Allocates `size` bytes of managed memory on the device and returns in `*devPtr` a pointer to the allocated memory. If the device doesn't support allocating managed memory, :py:obj:`~.cudaErrorNotSupported` is returned. Support for managed memory can be queried using the device attribute :py:obj:`~.cudaDevAttrManagedMemory`. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. If `size` is 0, :py:obj:`~.cudaMallocManaged` returns :py:obj:`~.cudaErrorInvalidValue`. The pointer is valid on the CPU and on all GPUs in the system that support managed memory. All accesses to this pointer must obey the Unified Memory programming model. `flags` specifies the default stream association for this allocation. `flags` must be one of :py:obj:`~.cudaMemAttachGlobal` or :py:obj:`~.cudaMemAttachHost`. The default value for `flags` is :py:obj:`~.cudaMemAttachGlobal`. If :py:obj:`~.cudaMemAttachGlobal` is specified, then this memory is accessible from any stream on any device. If :py:obj:`~.cudaMemAttachHost` is specified, then the allocation should not be accessed from devices that have a zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`; an explicit call to :py:obj:`~.cudaStreamAttachMemAsync` will be required to enable access on such devices. If the association is later changed via :py:obj:`~.cudaStreamAttachMemAsync` to a single stream, the default association, as specifed during :py:obj:`~.cudaMallocManaged`, is restored when that stream is destroyed. For managed variables, the default association is always :py:obj:`~.cudaMemAttachGlobal`. Note that destroying a stream is an asynchronous operation, and as a result, the change to default association won't happen until all work in the stream has completed. Memory allocated with :py:obj:`~.cudaMallocManaged` should be released with :py:obj:`~.cudaFree`. Device memory oversubscription is possible for GPUs that have a non- zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Managed memory on such GPUs may be evicted from device memory to host memory at any time by the Unified Memory driver in order to make room for other allocations. In a system where all GPUs have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, managed memory may not be populated when this API returns and instead may be populated on access. In such systems, managed memory can migrate to any processor's memory at any time. The Unified Memory driver will employ heuristics to maintain data locality and prevent excessive page faults to the extent possible. The application can also guide the driver about memory usage patterns via :py:obj:`~.cudaMemAdvise`. The application can also explicitly migrate memory to a desired processor's memory via :py:obj:`~.cudaMemPrefetchAsync`. In a multi-GPU system where all of the GPUs have a zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` and all the GPUs have peer-to-peer support with each other, the physical storage for managed memory is created on the GPU which is active at the time :py:obj:`~.cudaMallocManaged` is called. All other GPUs will reference the data at reduced bandwidth via peer mappings over the PCIe bus. The Unified Memory driver does not migrate memory among such GPUs. In a multi-GPU system where not all GPUs have peer-to-peer support with each other and where the value of the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is zero for at least one of those GPUs, the location chosen for physical storage of managed memory is system-dependent. - On Linux, the location chosen will be device memory as long as the current set of active contexts are on devices that either have peer- to-peer support with each other or have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If there is an active context on a GPU that does not have a non-zero value for that device attribute and it does not have peer-to-peer support with the other devices that have active contexts on them, then the location for physical storage will be 'zero-copy' or host memory. Note that this means that managed memory that is located in device memory is migrated to host memory if a new context is created on a GPU that doesn't have a non-zero value for the device attribute and does not support peer-to-peer with at least one of the other devices that has an active context. This in turn implies that context creation may fail if there is insufficient host memory to migrate all managed allocations. - On Windows, the physical storage is always created in 'zero-copy' or host memory. All GPUs will reference the data at reduced bandwidth over the PCIe bus. In these circumstances, use of the environment variable CUDA_VISIBLE_DEVICES is recommended to restrict CUDA to only use those GPUs that have peer-to-peer support. Alternatively, users can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a non-zero value to force the driver to always use device memory for physical storage. When this environment variable is set to a non-zero value, all devices used in that process that support managed memory have to be peer-to-peer compatible with each other. The error :py:obj:`~.cudaErrorInvalidDevice` will be returned if a device that supports managed memory is used and it is not peer-to-peer compatible with any of the other managed memory supporting devices that were previously used in that process, even if :py:obj:`~.cudaDeviceReset` has been called on those devices. These environment variables are described in the CUDA programming guide under the "CUDA environment variables" section. :param size: Requested allocation size in bytes :type size: size_t :param flags: Must be either :py:obj:`~.cudaMemAttachGlobal` or :py:obj:`~.cudaMemAttachHost` (defaults to :py:obj:`~.cudaMemAttachGlobal`) :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` * **devPtr** (*Any*) -- Pointer to allocated device memory .. seealso:: :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cuMemAllocManaged`
- cuda.bindings.runtime.cudaMalloc(size_t size)#
Allocate memory on the device. Allocates `size` bytes of linear memory on the device and returns in `*devPtr` a pointer to the allocated memory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. :py:obj:`~.cudaMalloc()` returns :py:obj:`~.cudaErrorMemoryAllocation` in case of failure. The device version of :py:obj:`~.cudaFree` cannot be used with a `*devPtr` allocated using the host API, and vice versa. :param size: Requested allocation size in bytes :type size: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` * **devPtr** (*Any*) -- Pointer to allocated device memory .. seealso:: :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAlloc`
- cuda.bindings.runtime.cudaMallocHost(size_t size)#
Allocates page-locked memory on the host. Allocates `size` bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated with this function and automatically accelerates calls to functions such as :py:obj:`~.cudaMemcpy`*(). Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory obtained with functions such as :py:obj:`~.malloc()`. On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is true, :py:obj:`~.cudaMallocHost` may not page-lock the allocated memory. Page-locking excessive amounts of memory with :py:obj:`~.cudaMallocHost()` may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between host and device. :param size: Requested allocation size in bytes :type size: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` * **ptr** (*Any*) -- Pointer to allocated host memory .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :obj:`cudaMallocHost`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocHost`
- cuda.bindings.runtime.cudaMallocPitch(size_t width, size_t height)#
Allocates pitched memory on the device. Allocates at least `width` (in bytes) * `height` bytes of linear memory on the device and returns in `*devPtr` a pointer to the allocated memory. The function may pad the allocation to ensure that corresponding pointers in any given row will continue to meet the alignment requirements for coalescing as the address is updated from row to row. The pitch returned in `*pitch` by :py:obj:`~.cudaMallocPitch()` is the width in bytes of the allocation. The intended usage of `pitch` is as a separate parameter of the allocation, used to compute addresses within the 2D array. Given the row and column of an array element of type `T`, the address is computed as: **View CUDA Toolkit Documentation for a C++ code example** For allocations of 2D arrays, it is recommended that programmers consider performing pitch allocations using :py:obj:`~.cudaMallocPitch()`. Due to pitch alignment restrictions in the hardware, this is especially true if the application will be performing 2D memory copies between different regions of device memory (whether linear memory or CUDA arrays). :param width: Requested pitched allocation width (in bytes) :type width: size_t :param height: Requested pitched allocation height :type height: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **devPtr** (*Any*) -- Pointer to allocated pitched device memory * **pitch** (*int*) -- Pitch for allocation .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocPitch`
- cuda.bindings.runtime.cudaMallocArray(cudaChannelFormatDesc desc: Optional[cudaChannelFormatDesc], size_t width, size_t height, unsigned int flags)#
Allocate an array on the device. Allocates a CUDA array according to the :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle to the new CUDA array in `*array`. The :py:obj:`~.cudaChannelFormatDesc` is defined as: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaChannelFormatKind` is one of :py:obj:`~.cudaChannelFormatKindSigned`, :py:obj:`~.cudaChannelFormatKindUnsigned`, or :py:obj:`~.cudaChannelFormatKindFloat`. The `flags` parameter enables different options to be specified that affect the allocation, as follows. - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 and provides default array allocation - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates an array that can be read from or written to using a surface reference - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture gather operations will be performed on the array. - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical backing memory. The subregions within this sparse array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without physical backing memory. The entire array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. `width` and `height` must meet certain size requirements. See :py:obj:`~.cudaMalloc3DArray()` for more details. :param desc: Requested channel format :type desc: :py:obj:`~.cudaChannelFormatDesc` :param width: Requested array allocation width :type width: size_t :param height: Requested array allocation height :type height: size_t :param flags: Requested properties of allocated array :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **array** (:py:obj:`~.cudaArray_t`) -- Pointer to allocated array in device memory .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayCreate`
- cuda.bindings.runtime.cudaFree(devPtr)#
Frees memory on the device. Frees the memory space pointed to by `devPtr`, which must have been returned by a previous call to one of the following memory allocation APIs - :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()`, :py:obj:`~.cudaMallocManaged()`, :py:obj:`~.cudaMallocAsync()`, :py:obj:`~.cudaMallocFromPoolAsync()`. Note - This API will not perform any implicit synchronization when the pointer was allocated with :py:obj:`~.cudaMallocAsync` or :py:obj:`~.cudaMallocFromPoolAsync`. Callers must ensure that all accesses to these pointer have completed before invoking :py:obj:`~.cudaFree`. For best performance and memory reuse, users should use :py:obj:`~.cudaFreeAsync` to free memory allocated via the stream ordered memory allocator. For all other pointers, this API may perform implicit synchronization. If :py:obj:`~.cudaFree`(`devPtr`) has already been called before, an error is returned. If `devPtr` is 0, no operation is performed. :py:obj:`~.cudaFree()` returns :py:obj:`~.cudaErrorValue` in case of failure. The device version of :py:obj:`~.cudaFree` cannot be used with a `*devPtr` allocated using the host API, and vice versa. :param devPtr: Device pointer to memory to free :type devPtr: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cuMemFree`
- cuda.bindings.runtime.cudaFreeHost(ptr)#
Frees page-locked memory. Frees the memory space pointed to by `hostPtr`, which must have been returned by a previous call to :py:obj:`~.cudaMallocHost()` or :py:obj:`~.cudaHostAlloc()`. :param ptr: Pointer to memory to free :type ptr: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemFreeHost`
- cuda.bindings.runtime.cudaFreeArray(array)#
Frees an array on the device. Frees the CUDA array `array`, which must have been returned by a previous call to :py:obj:`~.cudaMallocArray()`. If `devPtr` is 0, no operation is performed. :param array: Pointer to array to free :type array: :py:obj:`~.cudaArray_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayDestroy`
- cuda.bindings.runtime.cudaFreeMipmappedArray(mipmappedArray)#
Frees a mipmapped array on the device. Frees the CUDA mipmapped array `mipmappedArray`, which must have been returned by a previous call to :py:obj:`~.cudaMallocMipmappedArray()`. If `devPtr` is 0, no operation is performed. :param mipmappedArray: Pointer to mipmapped array to free :type mipmappedArray: :py:obj:`~.cudaMipmappedArray_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMipmappedArrayDestroy`
- cuda.bindings.runtime.cudaHostAlloc(size_t size, unsigned int flags)#
Allocates page-locked memory on the host. Allocates `size` bytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated with this function and automatically accelerates calls to functions such as :py:obj:`~.cudaMemcpy()`. Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory obtained with functions such as :py:obj:`~.malloc()`. Allocating excessive amounts of pinned memory may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between host and device. The `flags` parameter enables different options to be specified that affect the allocation, as follows. - :py:obj:`~.cudaHostAllocDefault`: This flag's value is defined to be 0 and causes :py:obj:`~.cudaHostAlloc()` to emulate :py:obj:`~.cudaMallocHost()`. - :py:obj:`~.cudaHostAllocPortable`: The memory returned by this call will be considered as pinned memory by all CUDA contexts, not just the one that performed the allocation. - :py:obj:`~.cudaHostAllocMapped`: Maps the allocation into the CUDA address space. The device pointer to the memory may be obtained by calling :py:obj:`~.cudaHostGetDevicePointer()`. - :py:obj:`~.cudaHostAllocWriteCombined`: Allocates the memory as write-combined (WC). WC memory can be transferred across the PCI Express bus more quickly on some system configurations, but cannot be read efficiently by most CPUs. WC memory is a good option for buffers that will be written by the CPU and read by the device via mapped pinned memory or host->device transfers. All of these flags are orthogonal to one another: a developer may allocate memory that is portable, mapped and/or write-combined with no restrictions. In order for the :py:obj:`~.cudaHostAllocMapped` flag to have any effect, the CUDA context must support the :py:obj:`~.cudaDeviceMapHost` flag, which can be checked via :py:obj:`~.cudaGetDeviceFlags()`. The :py:obj:`~.cudaDeviceMapHost` flag is implicitly set for contexts created via the runtime API. The :py:obj:`~.cudaHostAllocMapped` flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because the memory may be mapped into other CUDA contexts via the :py:obj:`~.cudaHostAllocPortable` flag. Memory allocated by this function must be freed with :py:obj:`~.cudaFreeHost()`. :param size: Requested allocation size in bytes :type size: size_t :param flags: Requested properties of allocated memory :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` * **pHost** (*Any*) -- Device pointer to allocated memory .. seealso:: :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cuMemHostAlloc`
- cuda.bindings.runtime.cudaHostRegister(ptr, size_t size, unsigned int flags)#
Registers an existing host memory range for use by CUDA. Page-locks the memory range specified by `ptr` and `size` and maps it for the device(s) as specified by `flags`. This memory range also is added to the same tracking mechanism as :py:obj:`~.cudaHostAlloc()` to automatically accelerate calls to functions such as :py:obj:`~.cudaMemcpy()`. Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory that has not been registered. Page-locking excessive amounts of memory may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to register staging areas for data exchange between host and device. On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is true, :py:obj:`~.cudaHostRegister` will not page-lock the memory range specified by `ptr` but only populate unpopulated pages. :py:obj:`~.cudaHostRegister` is supported only on I/O coherent devices that have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrHostRegisterSupported`. The `flags` parameter enables different options to be specified that affect the allocation, as follows. - :py:obj:`~.cudaHostRegisterDefault`: On a system with unified virtual addressing, the memory will be both mapped and portable. On a system with no unified virtual addressing, the memory will be neither mapped nor portable. - :py:obj:`~.cudaHostRegisterPortable`: The memory returned by this call will be considered as pinned memory by all CUDA contexts, not just the one that performed the allocation. - :py:obj:`~.cudaHostRegisterMapped`: Maps the allocation into the CUDA address space. The device pointer to the memory may be obtained by calling :py:obj:`~.cudaHostGetDevicePointer()`. - :py:obj:`~.cudaHostRegisterIoMemory`: The passed memory pointer is treated as pointing to some memory-mapped I/O space, e.g. belonging to a third-party PCIe device, and it will marked as non cache- coherent and contiguous. - :py:obj:`~.cudaHostRegisterReadOnly`: The passed memory pointer is treated as pointing to memory that is considered read-only by the device. On platforms without :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, this flag is required in order to register memory mapped to the CPU as read-only. Support for the use of this flag can be queried from the device attribute :py:obj:`~.cudaDevAttrHostRegisterReadOnlySupported`. Using this flag with a current context associated with a device that does not have this attribute set will cause :py:obj:`~.cudaHostRegister` to error with cudaErrorNotSupported. All of these flags are orthogonal to one another: a developer may page- lock memory that is portable or mapped with no restrictions. The CUDA context must have been created with the :py:obj:`~.cudaMapHost` flag in order for the :py:obj:`~.cudaHostRegisterMapped` flag to have any effect. The :py:obj:`~.cudaHostRegisterMapped` flag may be specified on CUDA contexts for devices that do not support mapped pinned memory. The failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because the memory may be mapped into other CUDA contexts via the :py:obj:`~.cudaHostRegisterPortable` flag. For devices that have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory can also be accessed from the device using the host pointer `ptr`. The device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` may or may not match the original host pointer `ptr` and depends on the devices visible to the application. If all devices visible to the application have a non-zero value for the device attribute, the device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match the original pointer `ptr`. If any device visible to the application has a zero value for the device attribute, the device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original host pointer `ptr`, but it will be suitable for use on all devices provided Unified Virtual Addressing is enabled. In such systems, it is valid to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that such devices should access the memory using only of the two pointers and not both. The memory page-locked by this function must be unregistered with :py:obj:`~.cudaHostUnregister()`. :param ptr: Host pointer to memory to page-lock :type ptr: Any :param size: Size in bytes of the address range to page-lock in bytes :type size: size_t :param flags: Flags for allocation request :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorHostMemoryAlreadyRegistered`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorExternalDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cudaHostGetFlags`, :py:obj:`~.cudaHostGetDevicePointer`, :py:obj:`~.cuMemHostRegister`
- cuda.bindings.runtime.cudaHostUnregister(ptr)#
Unregisters a memory range that was registered with cudaHostRegister. Unmaps the memory range whose base address is specified by `ptr`, and makes it pageable again. The base address must be the same one specified to :py:obj:`~.cudaHostRegister()`. :param ptr: Host pointer to memory to unregister :type ptr: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorHostMemoryNotRegistered` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cuMemHostUnregister`
- cuda.bindings.runtime.cudaHostGetDevicePointer(pHost, unsigned int flags)#
Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister. Passes back the device pointer corresponding to the mapped, pinned host buffer allocated by :py:obj:`~.cudaHostAlloc()` or registered by :py:obj:`~.cudaHostRegister()`. :py:obj:`~.cudaHostGetDevicePointer()` will fail if the :py:obj:`~.cudaDeviceMapHost` flag was not specified before deferred context creation occurred, or if called on a device that does not support mapped, pinned memory. For devices that have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory can also be accessed from the device using the host pointer `pHost`. The device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` may or may not match the original host pointer `pHost` and depends on the devices visible to the application. If all devices visible to the application have a non-zero value for the device attribute, the device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match the original pointer `pHost`. If any device visible to the application has a zero value for the device attribute, the device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original host pointer `pHost`, but it will be suitable for use on all devices provided Unified Virtual Addressing is enabled. In such systems, it is valid to access the memory using either pointer on devices that have a non-zero value for the device attribute. Note however that such devices should access the memory using only of the two pointers and not both. `flags` provides for future releases. For now, it must be set to 0. :param pHost: Requested host pointer mapping :type pHost: Any :param flags: Flags for extensions (must be 0 for now) :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **pDevice** (*Any*) -- Returned device pointer for mapped memory .. seealso:: :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`
- cuda.bindings.runtime.cudaHostGetFlags(pHost)#
Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc. :py:obj:`~.cudaHostGetFlags()` will fail if the input pointer does not reside in an address range allocated by :py:obj:`~.cudaHostAlloc()`. :param pHost: Host pointer :type pHost: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pFlags** (*unsigned int*) -- Returned flags word .. seealso:: :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetFlags`
- cuda.bindings.runtime.cudaMalloc3D(cudaExtent extent: cudaExtent)#
Allocates logical 1D, 2D, or 3D memory objects on the device. Allocates at least `width` * `height` * `depth` bytes of linear memory on the device and returns a :py:obj:`~.cudaPitchedPtr` in which `ptr` is a pointer to the allocated memory. The function may pad the allocation to ensure hardware alignment requirements are met. The pitch returned in the `pitch` field of `pitchedDevPtr` is the width in bytes of the allocation. The returned :py:obj:`~.cudaPitchedPtr` contains additional fields `xsize` and `ysize`, the logical width and height of the allocation, which are equivalent to the `width` and `height` `extent` parameters provided by the programmer during allocation. For allocations of 2D and 3D objects, it is highly recommended that programmers perform allocations using :py:obj:`~.cudaMalloc3D()` or :py:obj:`~.cudaMallocPitch()`. Due to alignment restrictions in the hardware, this is especially true if the application will be performing memory copies involving 2D or 3D objects (whether linear memory or CUDA arrays). :param extent: Requested allocation size (`width` field in bytes) :type extent: :py:obj:`~.cudaExtent` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **pitchedDevPtr** (:py:obj:`~.cudaPitchedPtr`) -- Pointer to allocated pitched device memory .. seealso:: :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, make_cudaPitchedPtr, make_cudaExtent, :py:obj:`~.cuMemAllocPitch`
- cuda.bindings.runtime.cudaMalloc3DArray(cudaChannelFormatDesc desc: Optional[cudaChannelFormatDesc], cudaExtent extent: cudaExtent, unsigned int flags)#
Allocate an array on the device. Allocates a CUDA array according to the :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle to the new CUDA array in `*array`. The :py:obj:`~.cudaChannelFormatDesc` is defined as: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaChannelFormatKind` is one of :py:obj:`~.cudaChannelFormatKindSigned`, :py:obj:`~.cudaChannelFormatKindUnsigned`, or :py:obj:`~.cudaChannelFormatKindFloat`. :py:obj:`~.cudaMalloc3DArray()` can allocate the following: - A 1D array is allocated if the height and depth extents are both zero. - A 2D array is allocated if only the depth extent is zero. - A 3D array is allocated if all three extents are non-zero. - A 1D layered CUDA array is allocated if only the height extent is zero and the cudaArrayLayered flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent. - A 2D layered CUDA array is allocated if all three extents are non- zero and the cudaArrayLayered flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent. - A cubemap CUDA array is allocated if all three extents are non-zero and the cudaArrayCubemap flag is set. Width must be equal to height, and depth must be six. A cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a cube. The order of the six layers in memory is the same as that listed in :py:obj:`~.cudaGraphicsCubeFace`. - A cubemap layered CUDA array is allocated if all three extents are non-zero, and both, cudaArrayCubemap and cudaArrayLayered flags are set. Width must be equal to height, and depth must be a multiple of six. A cubemap layered CUDA array is a special type of 2D layered CUDA array that consists of a collection of cubemaps. The first six layers represent the first cubemap, the next six layers form the second cubemap, and so on. The `flags` parameter enables different options to be specified that affect the allocation, as follows. - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 and provides default array allocation - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA array, with the depth extent indicating the number of layers - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA array. Width must be equal to height, and depth must be six. If the cudaArrayLayered flag is also set, depth must be a multiple of six. - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates a CUDA array that could be read from or written to using a surface reference. - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture gather operations will be performed on the CUDA array. Texture gather can only be performed on 2D CUDA arrays. - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical backing memory. The subregions within this sparse array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for creating 2D, 3D or 2D layered sparse CUDA arrays. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without physical backing memory. The entire array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. The width, height and depth extents must meet certain size requirements as listed in the following table. All values are specified in elements. Note that 2D CUDA arrays have different size requirements if the :py:obj:`~.cudaArrayTextureGather` flag is set. In that case, the valid range for (width, height, depth) is ((1,maxTexture2DGather[0]), (1,maxTexture2DGather[1]), 0). **View CUDA Toolkit Documentation for a table example** :param desc: Requested channel format :type desc: :py:obj:`~.cudaChannelFormatDesc` :param extent: Requested allocation size (`width` field in elements) :type extent: :py:obj:`~.cudaExtent` :param flags: Flags for extensions :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **array** (:py:obj:`~.cudaArray_t`) -- Pointer to allocated array in device memory .. seealso:: :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, make_cudaExtent, :py:obj:`~.cuArray3DCreate`
- cuda.bindings.runtime.cudaMallocMipmappedArray(cudaChannelFormatDesc desc: Optional[cudaChannelFormatDesc], cudaExtent extent: cudaExtent, unsigned int numLevels, unsigned int flags)#
Allocate a mipmapped array on the device. Allocates a CUDA mipmapped array according to the :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle to the new CUDA mipmapped array in `*mipmappedArray`. `numLevels` specifies the number of mipmap levels to be allocated. This value is clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. The :py:obj:`~.cudaChannelFormatDesc` is defined as: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaChannelFormatKind` is one of :py:obj:`~.cudaChannelFormatKindSigned`, :py:obj:`~.cudaChannelFormatKindUnsigned`, or :py:obj:`~.cudaChannelFormatKindFloat`. :py:obj:`~.cudaMallocMipmappedArray()` can allocate the following: - A 1D mipmapped array is allocated if the height and depth extents are both zero. - A 2D mipmapped array is allocated if only the depth extent is zero. - A 3D mipmapped array is allocated if all three extents are non-zero. - A 1D layered CUDA mipmapped array is allocated if only the height extent is zero and the cudaArrayLayered flag is set. Each layer is a 1D mipmapped array. The number of layers is determined by the depth extent. - A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and the cudaArrayLayered flag is set. Each layer is a 2D mipmapped array. The number of layers is determined by the depth extent. - A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the cudaArrayCubemap flag is set. Width must be equal to height, and depth must be six. The order of the six layers in memory is the same as that listed in :py:obj:`~.cudaGraphicsCubeFace`. - A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both, cudaArrayCubemap and cudaArrayLayered flags are set. Width must be equal to height, and depth must be a multiple of six. A cubemap layered CUDA mipmapped array is a special type of 2D layered CUDA mipmapped array that consists of a collection of cubemap mipmapped arrays. The first six layers represent the first cubemap mipmapped array, the next six layers form the second cubemap mipmapped array, and so on. The `flags` parameter enables different options to be specified that affect the allocation, as follows. - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 and provides default mipmapped array allocation - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA mipmapped array, with the depth extent indicating the number of layers - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA mipmapped array. Width must be equal to height, and depth must be six. If the cudaArrayLayered flag is also set, depth must be a multiple of six. - :py:obj:`~.cudaArraySurfaceLoadStore`: This flag indicates that individual mipmap levels of the CUDA mipmapped array will be read from or written to using a surface reference. - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture gather operations will be performed on the CUDA array. Texture gather can only be performed on 2D CUDA mipmapped arrays, and the gather operations are performed only on the most detailed mipmap level. - :py:obj:`~.cudaArraySparse`: Allocates a CUDA mipmapped array without physical backing memory. The subregions within this sparse array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for creating 2D, 3D or 2D layered sparse CUDA mipmapped arrays. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA mipmapped array without physical backing memory. The entire array can later be mapped onto a physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be allocated via :py:obj:`~.cuMemCreate`. The width, height and depth extents must meet certain size requirements as listed in the following table. All values are specified in elements. **View CUDA Toolkit Documentation for a table example** :param desc: Requested channel format :type desc: :py:obj:`~.cudaChannelFormatDesc` :param extent: Requested allocation size (`width` field in elements) :type extent: :py:obj:`~.cudaExtent` :param numLevels: Number of mipmap levels to allocate :type numLevels: unsigned int :param flags: Flags for extensions :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **mipmappedArray** (:py:obj:`~.cudaMipmappedArray_t`) -- Pointer to allocated mipmapped array in device memory .. seealso:: :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, make_cudaExtent, :py:obj:`~.cuMipmappedArrayCreate`
- cuda.bindings.runtime.cudaGetMipmappedArrayLevel(mipmappedArray, unsigned int level)#
Gets a mipmap level of a CUDA mipmapped array. Returns in `*levelArray` a CUDA array that represents a single mipmap level of the CUDA mipmapped array `mipmappedArray`. If `level` is greater than the maximum number of levels in this mipmapped array, :py:obj:`~.cudaErrorInvalidValue` is returned. If `mipmappedArray` is NULL, :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. :param mipmappedArray: CUDA mipmapped array :type mipmappedArray: :py:obj:`~.cudaMipmappedArray_const_t` :param level: Mipmap level :type level: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` * **levelArray** (:py:obj:`~.cudaArray_t`) -- Returned mipmap level CUDA array .. seealso:: :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, make_cudaExtent, :py:obj:`~.cuMipmappedArrayGetLevel`
- cuda.bindings.runtime.cudaMemcpy3D(cudaMemcpy3DParms p: Optional[cudaMemcpy3DParms])#
Copies data between 3D objects. **View CUDA Toolkit Documentation for a C++ code example** :py:obj:`~.cudaMemcpy3D()` copies data betwen two 3D objects. The source and destination objects may be in either host memory, device memory, or a CUDA array. The source, destination, extent, and kind of copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct which should be initialized to zero before use: **View CUDA Toolkit Documentation for a C++ code example** The struct passed to :py:obj:`~.cudaMemcpy3D()` must specify one of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more than one non-zero source or destination will cause :py:obj:`~.cudaMemcpy3D()` to return an error. The `srcPos` and `dstPos` fields are optional offsets into the source and destination objects and are defined in units of each object's elements. The element for a host or device pointer is assumed to be unsigned char. The `extent` field defines the dimensions of the transferred area in elements. If a CUDA array is participating in the copy, the extent is defined in terms of that array's elements. If no CUDA array is participating in the copy then the extents are defined in elements of unsigned char. The `kind` field defines the direction of the copy. It must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type passed as source or destination, if the kind implies cudaArray type to be present on the host, :py:obj:`~.cudaMemcpy3D()` will disregard that implication and silently correct the kind based on the fact that cudaArray type can only be present on the device. If the source and destination are both arrays, :py:obj:`~.cudaMemcpy3D()` will return an error if they do not have the same element size. The source and destination object may not overlap. If overlapping source and destination objects are specified, undefined behavior will result. The source object must entirely contain the region defined by `srcPos` and `extent`. The destination object must entirely contain the region defined by `dstPos` and `extent`. :py:obj:`~.cudaMemcpy3D()` returns an error if the pitch of `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` will always be valid. :param p: 3D memory copy parameters :type p: :py:obj:`~.cudaMemcpy3DParms` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3DAsync`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :obj:`make_cudaExtent`, :obj:`make_cudaPos`, :py:obj:`~.cuMemcpy3D`
- cuda.bindings.runtime.cudaMemcpy3DPeer(cudaMemcpy3DPeerParms p: Optional[cudaMemcpy3DPeerParms])#
Copies memory between devices. Perform a 3D memory copy according to the parameters specified in `p`. See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure for documentation of its parameters. Note that this function is synchronous with respect to the host only if the source or destination of the transfer is host memory. Note also that this copy is serialized with respect to all pending and future asynchronous work in to the current device, the copy's source device, and the copy's destination device (use :py:obj:`~.cudaMemcpy3DPeerAsync` to avoid this synchronization). :param p: Parameters for the memory copy :type p: :py:obj:`~.cudaMemcpy3DPeerParms` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeer`
- cuda.bindings.runtime.cudaMemcpy3DAsync(cudaMemcpy3DParms p: Optional[cudaMemcpy3DParms], stream)#
Copies data between 3D objects. **View CUDA Toolkit Documentation for a C++ code example** :py:obj:`~.cudaMemcpy3DAsync()` copies data betwen two 3D objects. The source and destination objects may be in either host memory, device memory, or a CUDA array. The source, destination, extent, and kind of copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct which should be initialized to zero before use: **View CUDA Toolkit Documentation for a C++ code example** The struct passed to :py:obj:`~.cudaMemcpy3DAsync()` must specify one of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more than one non-zero source or destination will cause :py:obj:`~.cudaMemcpy3DAsync()` to return an error. The `srcPos` and `dstPos` fields are optional offsets into the source and destination objects and are defined in units of each object's elements. The element for a host or device pointer is assumed to be unsigned char. For CUDA arrays, positions must be in the range [0, 2048) for any dimension. The `extent` field defines the dimensions of the transferred area in elements. If a CUDA array is participating in the copy, the extent is defined in terms of that array's elements. If no CUDA array is participating in the copy then the extents are defined in elements of unsigned char. The `kind` field defines the direction of the copy. It must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type passed as source or destination, if the kind implies cudaArray type to be present on the host, :py:obj:`~.cudaMemcpy3DAsync()` will disregard that implication and silently correct the kind based on the fact that cudaArray type can only be present on the device. If the source and destination are both arrays, :py:obj:`~.cudaMemcpy3DAsync()` will return an error if they do not have the same element size. The source and destination object may not overlap. If overlapping source and destination objects are specified, undefined behavior will result. The source object must lie entirely within the region defined by `srcPos` and `extent`. The destination object must lie entirely within the region defined by `dstPos` and `extent`. :py:obj:`~.cudaMemcpy3DAsync()` returns an error if the pitch of `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` will always be valid. :py:obj:`~.cudaMemcpy3DAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param p: 3D memory copy parameters :type p: :py:obj:`~.cudaMemcpy3DParms` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, ::::py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :obj:`make_cudaExtent`, :obj:`make_cudaPos`, :py:obj:`~.cuMemcpy3DAsync`
- cuda.bindings.runtime.cudaMemcpy3DPeerAsync(cudaMemcpy3DPeerParms p: Optional[cudaMemcpy3DPeerParms], stream)#
Copies memory between devices asynchronously. Perform a 3D memory copy according to the parameters specified in `p`. See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure for documentation of its parameters. :param p: Parameters for the memory copy :type p: :py:obj:`~.cudaMemcpy3DPeerParms` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`
- cuda.bindings.runtime.cudaMemGetInfo()#
Gets free and total device memory. Returns in `*total` the total amount of memory available to the the current context. Returns in `*free` the amount of memory on the device that is free according to the OS. CUDA is not guaranteed to be able to allocate all of the memory that the OS reports as free. In a multi- tenet situation, free estimate returned is prone to race condition where a new allocation/free done by a different process or a different thread in the same process between the time when free memory was estimated and reported, will result in deviation in free value reported and actual free memory. The integrated GPU on Tegra shares memory with CPU and other component of the SoC. The free and total values returned by the API excludes the SWAP memory space maintained by the OS on some platforms. The OS may move some of the memory pages into swap area as the GPU or CPU allocate or access memory. See Tegra app note on how to calculate total and free memory on Tegra. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure` * **free** (*int*) -- Returned free memory in bytes * **total** (*int*) -- Returned total memory in bytes .. seealso:: :py:obj:`~.cuMemGetInfo`
- cuda.bindings.runtime.cudaArrayGetInfo(array)#
Gets info about the specified cudaArray. Returns in `*desc`, `*extent` and `*flags` respectively, the type, shape and flags of `array`. Any of `*desc`, `*extent` and `*flags` may be specified as NULL. :param array: The :py:obj:`~.cudaArray` to get info for :type array: :py:obj:`~.cudaArray_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **desc** (:py:obj:`~.cudaChannelFormatDesc`) -- Returned array type * **extent** (:py:obj:`~.cudaExtent`) -- Returned array shape. 2D arrays will have depth of zero * **flags** (*unsigned int*) -- Returned array flags .. seealso:: :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuArray3DGetDescriptor`
- cuda.bindings.runtime.cudaArrayGetPlane(hArray, unsigned int planeIdx)#
Gets a CUDA array plane from a CUDA array. Returns in `pPlaneArray` a CUDA array that represents a single format plane of the CUDA array `hArray`. If `planeIdx` is greater than the maximum number of planes in this array or if the array does not have a multi-planar format e.g: :py:obj:`~.cudaChannelFormatKindNV12`, then :py:obj:`~.cudaErrorInvalidValue` is returned. Note that if the `hArray` has format :py:obj:`~.cudaChannelFormatKindNV12`, then passing in 0 for `planeIdx` returns a CUDA array of the same size as `hArray` but with one 8-bit channel and :py:obj:`~.cudaChannelFormatKindUnsigned` as its format kind. If 1 is passed for `planeIdx`, then the returned CUDA array has half the height and width of `hArray` with two 8-bit channels and :py:obj:`~.cudaChannelFormatKindUnsigned` as its format kind. :param hArray: CUDA array :type hArray: :py:obj:`~.cudaArray_t` :param planeIdx: Plane index :type planeIdx: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` * **pPlaneArray** (:py:obj:`~.cudaArray_t`) -- Returned CUDA array referenced by the `planeIdx` .. seealso:: :py:obj:`~.cuArrayGetPlane`
- cuda.bindings.runtime.cudaArrayGetMemoryRequirements(array, int device)#
Returns the memory requirements of a CUDA array. Returns the memory requirements of a CUDA array in `memoryRequirements` If the CUDA array is not allocated with flag :py:obj:`~.cudaArrayDeferredMapping` :py:obj:`~.cudaErrorInvalidValue` will be returned. The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` represents the total size of the CUDA array. The returned value in :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents the alignment necessary for mapping the CUDA array. :param array: CUDA array to get the memory requirements of :type array: :py:obj:`~.cudaArray_t` :param device: Device to get the memory requirements for :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` * **memoryRequirements** (:py:obj:`~.cudaArrayMemoryRequirements`) -- Pointer to :py:obj:`~.cudaArrayMemoryRequirements` .. seealso:: :py:obj:`~.cudaMipmappedArrayGetMemoryRequirements`
- cuda.bindings.runtime.cudaMipmappedArrayGetMemoryRequirements(mipmap, int device)#
Returns the memory requirements of a CUDA mipmapped array. Returns the memory requirements of a CUDA mipmapped array in `memoryRequirements` If the CUDA mipmapped array is not allocated with flag :py:obj:`~.cudaArrayDeferredMapping` :py:obj:`~.cudaErrorInvalidValue` will be returned. The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` represents the total size of the CUDA mipmapped array. The returned value in :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents the alignment necessary for mapping the CUDA mipmapped array. :param mipmap: CUDA mipmapped array to get the memory requirements of :type mipmap: :py:obj:`~.cudaMipmappedArray_t` :param device: Device to get the memory requirements for :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` * **memoryRequirements** (:py:obj:`~.cudaArrayMemoryRequirements`) -- Pointer to :py:obj:`~.cudaArrayMemoryRequirements` .. seealso:: :py:obj:`~.cudaArrayGetMemoryRequirements`
- cuda.bindings.runtime.cudaMemcpy(dst, src, size_t count, kind: cudaMemcpyKind)#
Returns the layout properties of a sparse CUDA array. Returns the layout properties of a sparse CUDA array in `sparseProperties`. If the CUDA array is not allocated with flag :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be returned. If the returned value in :py:obj:`~.cudaArraySparseProperties.flags` contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then :py:obj:`~.cudaArraySparseProperties.miptailSize` represents the total size of the array. Otherwise, it will be zero. Also, the returned value in :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is always zero. Note that the `array` must have been allocated using :py:obj:`~.cudaMallocArray` or :py:obj:`~.cudaMalloc3DArray`. For CUDA arrays obtained using :py:obj:`~.cudaMipmappedArrayGetLevel`, :py:obj:`~.cudaErrorInvalidValue` will be returned. Instead, :py:obj:`~.cudaMipmappedArrayGetSparseProperties` must be used to obtain the sparse properties of the entire CUDA mipmapped array to which `array` belongs to. Returns the layout properties of a sparse CUDA mipmapped array Returns the sparse array layout properties in `sparseProperties`. If the CUDA mipmapped array is not allocated with flag :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be returned. For non-layered CUDA mipmapped arrays, :py:obj:`~.cudaArraySparseProperties.miptailSize` returns the size of the mip tail region. The mip tail region includes all mip levels whose width, height or depth is less than that of the tile. For layered CUDA mipmapped arrays, if :py:obj:`~.cudaArraySparseProperties.flags` contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies the size of the mip tail of all layers combined. Otherwise, :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies mip tail size per layer. The returned value of :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is valid only if :py:obj:`~.cudaArraySparseProperties.miptailSize` is non-zero. Copies data between host and device Copies `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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. Calling :py:obj:`~.cudaMemcpy()` with dst and src pointers that do not match the direction of the copy results in an undefined behavior. ote_sync Parameters ---------- sparseProperties : Any Pointer to return the :py:obj:`~.cudaArraySparseProperties` array : Any The CUDA array to get the sparse properties of sparseProperties : size_t Pointer to return :py:obj:`~.cudaArraySparseProperties` mipmap : :py:obj:`~.cudaMemcpyKind` The CUDA mipmapped array to get the sparse properties of Returns ------- cudaError_t :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- :py:obj:`~.cudaMipmappedArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` :py:obj:`~.cudaArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpy`
- cuda.bindings.runtime.cudaMemcpyPeer(dst, int dstDevice, src, int srcDevice, size_t count)#
Copies memory between two devices. Copies memory from one device to memory on another device. `dst` is the base device pointer of the destination memory and `dstDevice` is the destination device. `src` is the base device pointer of the source memory and `srcDevice` is the source device. `count` specifies the number of bytes to copy. Note that this function is asynchronous with respect to the host, but serialized with respect all pending and future asynchronous work in to the current device, `srcDevice`, and `dstDevice` (use :py:obj:`~.cudaMemcpyPeerAsync` to avoid this synchronization). :param dst: Destination device pointer :type dst: Any :param dstDevice: Destination device :type dstDevice: int :param src: Source device pointer :type src: Any :param srcDevice: Source device :type srcDevice: int :param count: Size of memory copy in bytes :type count: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeer`
- cuda.bindings.runtime.cudaMemcpy2D(
- dst,
- size_t dpitch,
- src,
- size_t spitch,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) 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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `dpitch` and `spitch` are the widths in memory in bytes of the 2D arrays pointed to by `dst` and `src`, including any padding added to the end of each row. The memory areas may not overlap. `width` must not exceed either `dpitch` or `spitch`. Calling :py:obj:`~.cudaMemcpy2D()` with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior. :py:obj:`~.cudaMemcpy2D()` returns an error if `dpitch` or `spitch` exceeds the maximum allowed. :param dst: Destination memory address :type dst: Any :param dpitch: Pitch of destination memory :type dpitch: size_t :param src: Source memory address :type src: Any :param spitch: Pitch of source memory :type spitch: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned`
- cuda.bindings.runtime.cudaMemcpy2DToArray(
- dst,
- size_t wOffset,
- size_t hOffset,
- src,
- size_t spitch,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `spitch` is the width in memory in bytes of the 2D array pointed to by `src`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `dst`. `width` must not exceed `spitch`. :py:obj:`~.cudaMemcpy2DToArray()` returns an error if `spitch` exceeds the maximum allowed. :param dst: Destination memory address :type dst: :py:obj:`~.cudaArray_t` :param wOffset: Destination starting X offset (columns in bytes) :type wOffset: size_t :param hOffset: Destination starting Y offset (rows) :type hOffset: size_t :param src: Source memory address :type src: Any :param spitch: Pitch of source memory :type spitch: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned`
- cuda.bindings.runtime.cudaMemcpy2DFromArray(
- dst,
- size_t dpitch,
- src,
- size_t wOffset,
- size_t hOffset,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `dpitch` is the width in memory in bytes of the 2D array pointed to by `dst`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `src`. `width` must not exceed `dpitch`. :py:obj:`~.cudaMemcpy2DFromArray()` returns an error if `dpitch` exceeds the maximum allowed. :param dst: Destination memory address :type dst: Any :param dpitch: Pitch of destination memory :type dpitch: size_t :param src: Source memory address :type src: :py:obj:`~.cudaArray_const_t` :param wOffset: Source starting X offset (columns in bytes) :type wOffset: size_t :param hOffset: Source starting Y offset (rows) :type hOffset: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned`
- cuda.bindings.runtime.cudaMemcpy2DArrayToArray(
- dst,
- size_t wOffsetDst,
- size_t hOffsetDst,
- src,
- size_t wOffsetSrc,
- size_t hOffsetSrc,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffsetSrc` rows and `wOffsetSrc` bytes from the upper left corner to the CUDA array `dst` starting at `hOffsetDst` rows and `wOffsetDst` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `wOffsetDst` + `width` must not exceed the width of the CUDA array `dst`. `wOffsetSrc` + `width` must not exceed the width of the CUDA array `src`. :param dst: Destination memory address :type dst: :py:obj:`~.cudaArray_t` :param wOffsetDst: Destination starting X offset (columns in bytes) :type wOffsetDst: size_t :param hOffsetDst: Destination starting Y offset (rows) :type hOffsetDst: size_t :param src: Source memory address :type src: :py:obj:`~.cudaArray_const_t` :param wOffsetSrc: Source starting X offset (columns in bytes) :type wOffsetSrc: size_t :param hOffsetSrc: Source starting Y offset (rows) :type hOffsetSrc: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned`
- cuda.bindings.runtime.cudaMemcpyAsync(dst, src, size_t count, kind: cudaMemcpyKind, stream)#
Copies data between host and device. Copies `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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. The memory areas may not overlap. Calling :py:obj:`~.cudaMemcpyAsync()` with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior. :py:obj:`~.cudaMemcpyAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and the `stream` is non-zero, the copy may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param dst: Destination memory address :type dst: Any :param src: Source memory address :type src: Any :param count: Size in bytes to copy :type count: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemcpyDtoDAsync`
- cuda.bindings.runtime.cudaMemcpyPeerAsync(
- dst,
- int dstDevice,
- src,
- int srcDevice,
- size_t count,
- stream,
Copies memory between two devices asynchronously. Copies memory from one device to memory on another device. `dst` is the base device pointer of the destination memory and `dstDevice` is the destination device. `src` is the base device pointer of the source memory and `srcDevice` is the source device. `count` specifies the number of bytes to copy. Note that this function is asynchronous with respect to the host and all work on other devices. :param dst: Destination device pointer :type dst: Any :param dstDevice: Destination device :type dstDevice: int :param src: Source device pointer :type src: Any :param srcDevice: Source device :type srcDevice: int :param count: Size of memory copy in bytes :type count: size_t :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeerAsync`
- cuda.bindings.runtime.cudaMemcpyBatchAsync(dsts: Optional[tuple[Any] | list[Any]], srcs: Optional[tuple[Any] | list[Any]], sizes: tuple[int] | list[int], size_t count, attrs: Optional[tuple[cudaMemcpyAttributes] | list[cudaMemcpyAttributes]], attrsIdxs: tuple[int] | list[int], size_t numAttrs, stream)#
Performs a batch of memory copies asynchronously. Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. This API only supports pointer-to-pointer copies. For copies involving CUDA arrays, please see :py:obj:`~.cudaMemcpy3DBatchAsync`. Performs memory copies from source buffers specified in `srcs` to destination buffers specified in `dsts`. The size of each copy is specified in `sizes`. All three arrays must be of the same length as specified by `count`. Since there are no ordering guarantees for copies within a batch, specifying any dependent copies within a batch will result in undefined behavior. Every copy in the batch has to be associated with a set of attributes specified in the `attrs` array. Each entry in this array can apply to more than one copy. This can be done by specifying in the `attrsIdxs` array, the index of the first copy that the corresponding entry in the `attrs` array applies to. Both `attrs` and `attrsIdxs` must be of the same length as specified by `numAttrs`. For example, if a batch has 10 copies listed in dst/src/sizes, the first 6 of which have one set of attributes and the remaining 4 another, then `numAttrs` will be 2, `attrsIdxs` will be {0, 6} and `attrs` will contains the two sets of attributes. Note that the first entry in `attrsIdxs` must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than `count`. Furthermore, `numAttrs` must be lesser than or equal to `count`. The :py:obj:`~.cudaMemcpyAttributes.srcAccessOrder` indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderStream`, then the source will be accessed in stream order. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderDuringApiCall` then it indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderAny` then it indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. Each memcpy operation in the batch must have a valid :py:obj:`~.cudaMemcpyAttributes` corresponding to it including the appropriate srcAccessOrder setting, otherwise the API will return :py:obj:`~.cudaErrorInvalidValue`. The :py:obj:`~.cudaMemcpyAttributes.srcLocHint` and :py:obj:`~.cudaMemcpyAttributes.dstLocHint` allows applications to specify hint locations for operands of a copy when the operand doesn't have a fixed location. That is, these hints are only applicable for managed memory pointers on devices where :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is true or system- allocated pageable memory on devices where :py:obj:`~.cudaDevAttrPageableMemoryAccess` is true. For other cases, these hints are ignored. The :py:obj:`~.cudaMemcpyAttributes.flags` field can be used to specify certain flags for copies. Setting the :py:obj:`~.cudaMemcpyFlagPreferOverlapWithCompute` flag indicates that the associated copies should preferably overlap with any compute work. Note that this flag is a hint and can be ignored depending on the platform and other parameters of the copy. :param dsts: Array of destination pointers. :type dsts: list[Any] :param srcs: Array of memcpy source pointers. :type srcs: list[Any] :param sizes: Array of sizes for memcpy operations. :type sizes: list[int] :param count: Size of `dsts`, `srcs` and `sizes` arrays :type count: size_t :param attrs: Array of memcpy attributes. :type attrs: list[:py:obj:`~.cudaMemcpyAttributes`] :param attrsIdxs: Array of indices to specify which copies each entry in the `attrs` array applies to. The attributes specified in attrs[k] will be applied to copies starting from attrsIdxs[k] through attrsIdxs[k+1] - 1. Also attrs[numAttrs-1] will apply to copies starting from attrsIdxs[numAttrs-1] through count - 1. :type attrsIdxs: list[int] :param numAttrs: Size of `attrs` and `attrsIdxs` arrays. :type numAttrs: size_t :param hStream: The stream to enqueue the operations in. Must not be legacy NULL stream. :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t
- cuda.bindings.runtime.cudaMemcpy3DBatchAsync(size_t numOps, opList: Optional[tuple[cudaMemcpy3DBatchOp] | list[cudaMemcpy3DBatchOp]], unsigned long long flags, stream)#
Performs a batch of 3D memory copies asynchronously. Performs a batch of memory copies. The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. Note that this means specifying any dependent copies within a batch will result in undefined behavior. Performs memory copies as specified in the `opList` array. The length of this array is specified in `numOps`. Each entry in this array describes a copy operation. This includes among other things, the source and destination operands for the copy as specified in :py:obj:`~.cudaMemcpy3DBatchOp.src` and :py:obj:`~.cudaMemcpy3DBatchOp.dst` respectively. The source and destination operands of a copy can either be a pointer or a CUDA array. The width, height and depth of a copy is specified in :py:obj:`~.cudaMemcpy3DBatchOp.extent`. The width, height and depth of a copy are specified in elements and must not be zero. For pointer-to- pointer copies, the element size is considered to be 1. For pointer to CUDA array or vice versa copies, the element size is determined by the CUDA array. For CUDA array to CUDA array copies, the element size of the two CUDA arrays must match. For a given operand, if :py:obj:`~.cudaMemcpy3DOperand.type` is specified as :py:obj:`~.cudaMemcpyOperandTypePointer`, then :py:obj:`~.cudaMemcpy3DOperand`::op::ptr will be used. The :py:obj:`~.cudaMemcpy3DOperand`::op::ptr::ptr field must contain the pointer where the copy should begin. The :py:obj:`~.cudaMemcpy3DOperand`::op::ptr::rowLength field specifies the length of each row in elements and must either be zero or be greater than or equal to the width of the copy specified in :py:obj:`~.cudaMemcpy3DBatchOp`::extent::width. The :py:obj:`~.cudaMemcpy3DOperand`::op::ptr::layerHeight field specifies the height of each layer and must either be zero or be greater than or equal to the height of the copy specified in :py:obj:`~.cudaMemcpy3DBatchOp`::extent::height. When either of these values is zero, that aspect of the operand is considered to be tightly packed according to the copy extent. For managed memory pointers on devices where :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is true or system-allocated pageable memory on devices where :py:obj:`~.cudaDevAttrPageableMemoryAccess` is true, the :py:obj:`~.cudaMemcpy3DOperand`::op::ptr::locHint field can be used to hint the location of the operand. If an operand's type is specified as :py:obj:`~.cudaMemcpyOperandTypeArray`, then :py:obj:`~.cudaMemcpy3DOperand`::op::array will be used. The :py:obj:`~.cudaMemcpy3DOperand`::op::array::array field specifies the CUDA array and :py:obj:`~.cudaMemcpy3DOperand`::op::array::offset specifies the 3D offset into that array where the copy begins. The :py:obj:`~.cudaMemcpyAttributes.srcAccessOrder` indicates the source access ordering to be observed for copies associated with the attribute. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderStream`, then the source will be accessed in stream order. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderDuringApiCall` then it indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. If the source access order is set to :py:obj:`~.cudaMemcpySrcAccessOrderAny` then it indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. Each memcopy operation in `opList` must have a valid srcAccessOrder setting, otherwise this API will return :py:obj:`~.cudaErrorInvalidValue`. The :py:obj:`~.cudaMemcpyAttributes.flags` field can be used to specify certain flags for copies. Setting the :py:obj:`~.cudaMemcpyFlagPreferOverlapWithCompute` flag indicates that the associated copies should preferably overlap with any compute work. Note that this flag is a hint and can be ignored depending on the platform and other parameters of the copy. :param numOps: Total number of memcpy operations. :type numOps: size_t :param opList: Array of size `numOps` containing the actual memcpy operations. :type opList: list[:py:obj:`~.cudaMemcpy3DBatchOp`] :param flags: Flags for future use, must be zero now. :type flags: unsigned long long :param hStream: The stream to enqueue the operations in. Must not be default NULL stream. :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t
- cuda.bindings.runtime.cudaMemcpyWithAttributesAsync(dst, src, size_t size, cudaMemcpyAttributes attr: Optional[cudaMemcpyAttributes], stream)#
Performs asynchronous memory copy operation with the specified attributes. Performs asynchronous memory copy operation where `dst` and `src` are the destination and source pointers respectively. `size` specifies the number of bytes to copy. `attr` specifies the attributes for the copy and `hStream` specifies the stream to enqueue the operation in. For more information regarding the attributes, please refer to :py:obj:`~.cudaMemcpyAttributes` and it's usage desciption in::cudaMemcpyBatchAsync :param dst: Destination device pointer :type dst: Any :param src: Source device pointer :type src: Any :param size: Number of bytes to copy :type size: size_t :param attr: Attributes for the copy :type attr: :py:obj:`~.cudaMemcpyAttributes` :param hStream: Stream to enqueue the operation in :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpyBatchAsync`
- cuda.bindings.runtime.cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp op: Optional[cudaMemcpy3DBatchOp], unsigned long long flags, stream)#
Performs 3D asynchronous memory copy with the specified attributes. Performs the copy operation specified in `op`. `flags` specifies the flags for the copy and `hStream` specifies the stream to enqueue the operation in. For more information regarding the operation, please refer to :py:obj:`~.cudaMemcpy3DBatchOp` and it's usage desciption in::cudaMemcpy3DBatchAsync :param op: Operation to perform :type op: :py:obj:`~.cudaMemcpy3DBatchOp` :param flags: Flags for the copy, must be zero now. :type flags: unsigned long long :param hStream: Stream to enqueue the operation in :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy3DBatchAsync`
- cuda.bindings.runtime.cudaMemcpy2DAsync(
- dst,
- size_t dpitch,
- src,
- size_t spitch,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
- stream,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) 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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `dpitch` and `spitch` are the widths in memory in bytes of the 2D arrays pointed to by `dst` and `src`, including any padding added to the end of each row. The memory areas may not overlap. `width` must not exceed either `dpitch` or `spitch`. Calling :py:obj:`~.cudaMemcpy2DAsync()` with `dst` and `src` pointers that do not match the direction of the copy results in an undefined behavior. :py:obj:`~.cudaMemcpy2DAsync()` returns an error if `dpitch` or `spitch` is greater than the maximum allowed. :py:obj:`~.cudaMemcpy2DAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param dst: Destination memory address :type dst: Any :param dpitch: Pitch of destination memory :type dpitch: size_t :param src: Source memory address :type src: Any :param spitch: Pitch of source memory :type spitch: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync`
- cuda.bindings.runtime.cudaMemcpy2DToArrayAsync(
- dst,
- size_t wOffset,
- size_t hOffset,
- src,
- size_t spitch,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
- stream,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) from the memory area pointed to by `src` to the CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from the upper left corner, where `kind` specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `spitch` is the width in memory in bytes of the 2D array pointed to by `src`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `dst`. `width` must not exceed `spitch`. :py:obj:`~.cudaMemcpy2DToArrayAsync()` returns an error if `spitch` exceeds the maximum allowed. :py:obj:`~.cudaMemcpy2DToArrayAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` :param dst: Destination memory address :type dst: :py:obj:`~.cudaArray_t` :param wOffset: Destination starting X offset (columns in bytes) :type wOffset: size_t :param hOffset: Destination starting Y offset (rows) :type hOffset: size_t :param src: Source memory address :type src: Any :param spitch: Pitch of source memory :type spitch: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`
- cuda.bindings.runtime.cudaMemcpy2DFromArrayAsync(
- dst,
- size_t dpitch,
- src,
- size_t wOffset,
- size_t hOffset,
- size_t width,
- size_t height,
- kind: cudaMemcpyKind,
- stream,
Copies data between host and device. Copies a matrix (`height` rows of `width` bytes each) from the CUDA array `src` starting at `hOffset` rows and `wOffset` bytes from the upper left corner to the memory area pointed to by `dst`, where `kind` specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. `dpitch` is the width in memory in bytes of the 2D array pointed to by `dst`, including any padding added to the end of each row. `wOffset` + `width` must not exceed the width of the CUDA array `src`. `width` must not exceed `dpitch`. :py:obj:`~.cudaMemcpy2DFromArrayAsync()` returns an error if `dpitch` exceeds the maximum allowed. :py:obj:`~.cudaMemcpy2DFromArrayAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` :param dst: Destination memory address :type dst: Any :param dpitch: Pitch of destination memory :type dpitch: size_t :param src: Source memory address :type src: :py:obj:`~.cudaArray_const_t` :param wOffset: Source starting X offset (columns in bytes) :type wOffset: size_t :param hOffset: Source starting Y offset (rows) :type hOffset: size_t :param width: Width of matrix transfer (columns in bytes) :type width: size_t :param height: Height of matrix transfer (rows) :type height: size_t :param kind: Type of transfer :type kind: :py:obj:`~.cudaMemcpyKind` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`
- cuda.bindings.runtime.cudaMemset(devPtr, int value, size_t count)#
Initializes or sets device memory to a value. Fills the first `count` bytes of the memory area pointed to by `devPtr` with the constant byte value `value`. Note that this function is asynchronous with respect to the host unless `devPtr` refers to pinned host memory. :param devPtr: Pointer to device memory :type devPtr: Any :param value: Value to set for each byte of specified memory :type value: int :param count: Size in bytes to set :type count: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`
- cuda.bindings.runtime.cudaMemset2D(
- devPtr,
- size_t pitch,
- int value,
- size_t width,
- size_t height,
Initializes or sets device memory to a value. Sets to the specified value `value` a matrix (`height` rows of `width` bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of the 2D array pointed to by `dstPtr`, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by :py:obj:`~.cudaMallocPitch()`. Note that this function is asynchronous with respect to the host unless `devPtr` refers to pinned host memory. :param devPtr: Pointer to 2D device memory :type devPtr: Any :param pitch: Pitch in bytes of 2D device memory(Unused if `height` is 1) :type pitch: size_t :param value: Value to set for each byte of specified memory :type value: int :param width: Width of matrix set (columns in bytes) :type width: size_t :param height: Height of matrix set (rows) :type height: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`
- cuda.bindings.runtime.cudaMemset3D(
- cudaPitchedPtr pitchedDevPtr: cudaPitchedPtr,
- int value,
- cudaExtent extent: cudaExtent,
Initializes or sets device memory to a value. Initializes each element of a 3D array to the specified value `value`. The object to initialize is defined by `pitchedDevPtr`. The `pitch` field of `pitchedDevPtr` is the width in memory in bytes of the 3D array pointed to by `pitchedDevPtr`, including any padding added to the end of each row. The `xsize` field specifies the logical width of each row in bytes, while the `ysize` field specifies the height of each 2D slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when `height` and `depth` are both equal to 1. The extents of the initialized region are specified as a `width` in bytes, a `height` in rows, and a `depth` in slices. Extents with `width` greater than or equal to the `xsize` of `pitchedDevPtr` may perform significantly faster than extents narrower than the `xsize`. Secondarily, extents with `height` equal to the `ysize` of `pitchedDevPtr` will perform faster than when the `height` is shorter than the `ysize`. This function performs fastest when the `pitchedDevPtr` has been allocated by :py:obj:`~.cudaMalloc3D()`. Note that this function is asynchronous with respect to the host unless `pitchedDevPtr` refers to pinned host memory. :param pitchedDevPtr: Pointer to pitched device memory :type pitchedDevPtr: :py:obj:`~.cudaPitchedPtr` :param value: Value to set for each byte of specified memory :type value: int :param extent: Size parameters for where to set device memory (`width` field in bytes) :type extent: :py:obj:`~.cudaExtent` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cudaMalloc3D`, :obj:`make_cudaPitchedPtr`, :obj:`make_cudaExtent`
- cuda.bindings.runtime.cudaMemsetAsync(devPtr, int value, size_t count, stream)#
Initializes or sets device memory to a value. Fills the first `count` bytes of the memory area pointed to by `devPtr` with the constant byte value `value`. :py:obj:`~.cudaMemsetAsync()` is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param devPtr: Pointer to device memory :type devPtr: Any :param value: Value to set for each byte of specified memory :type value: int :param count: Size in bytes to set :type count: size_t :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32Async`
- cuda.bindings.runtime.cudaMemset2DAsync(
- devPtr,
- size_t pitch,
- int value,
- size_t width,
- size_t height,
- stream,
Initializes or sets device memory to a value. Sets to the specified value `value` a matrix (`height` rows of `width` bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of the 2D array pointed to by `dstPtr`, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by :py:obj:`~.cudaMallocPitch()`. :py:obj:`~.cudaMemset2DAsync()` is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non- zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param devPtr: Pointer to 2D device memory :type devPtr: Any :param pitch: Pitch in bytes of 2D device memory(Unused if `height` is 1) :type pitch: size_t :param value: Value to set for each byte of specified memory :type value: int :param width: Width of matrix set (columns in bytes) :type width: size_t :param height: Height of matrix set (rows) :type height: size_t :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32Async`
- cuda.bindings.runtime.cudaMemset3DAsync(
- cudaPitchedPtr pitchedDevPtr: cudaPitchedPtr,
- int value,
- cudaExtent extent: cudaExtent,
- stream,
Initializes or sets device memory to a value. Initializes each element of a 3D array to the specified value `value`. The object to initialize is defined by `pitchedDevPtr`. The `pitch` field of `pitchedDevPtr` is the width in memory in bytes of the 3D array pointed to by `pitchedDevPtr`, including any padding added to the end of each row. The `xsize` field specifies the logical width of each row in bytes, while the `ysize` field specifies the height of each 2D slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when `height` and `depth` are both equal to 1. The extents of the initialized region are specified as a `width` in bytes, a `height` in rows, and a `depth` in slices. Extents with `width` greater than or equal to the `xsize` of `pitchedDevPtr` may perform significantly faster than extents narrower than the `xsize`. Secondarily, extents with `height` equal to the `ysize` of `pitchedDevPtr` will perform faster than when the `height` is shorter than the `ysize`. This function performs fastest when the `pitchedDevPtr` has been allocated by :py:obj:`~.cudaMalloc3D()`. :py:obj:`~.cudaMemset3DAsync()` is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non- zero `stream` argument. If `stream` is non-zero, the operation may overlap with operations in other streams. The device version of this function only handles device to device copies and cannot be given local or shared pointers. :param pitchedDevPtr: Pointer to pitched device memory :type pitchedDevPtr: :py:obj:`~.cudaPitchedPtr` :param value: Value to set for each byte of specified memory :type value: int :param extent: Size parameters for where to set device memory (`width` field in bytes) :type extent: :py:obj:`~.cudaExtent` :param stream: Stream identifier :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMalloc3D`, :obj:`make_cudaPitchedPtr`, :obj:`make_cudaExtent`
- cuda.bindings.runtime.cudaMemPrefetchAsync(
- devPtr,
- size_t count,
- cudaMemLocation location: cudaMemLocation,
- unsigned int flags,
- stream,
Prefetches memory to the specified destination location. Prefetches memory to the specified destination location. `devPtr` is the base device pointer of the memory to be prefetched and `location` specifies the destination location. `count` specifies the number of bytes to copy. `stream` is the stream in which the operation is enqueued. The memory range must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables, or it may also refer to memory allocated from a managed memory pool, or it may also refer to system-allocated memory on systems with non-zero cudaDevAttrPageableMemoryAccess. Specifying :py:obj:`~.cudaMemLocationTypeDevice` for :py:obj:`~.cudaMemLocation.type` will prefetch memory to GPU specified by device ordinal :py:obj:`~.cudaMemLocation.id` which must have non- zero value for the device attribute :py:obj:`~.concurrentManagedAccess`. Additionally, `stream` must be associated with a device that has a non-zero value for the device attribute :py:obj:`~.concurrentManagedAccess`. Specifying :py:obj:`~.cudaMemLocationTypeHost` as :py:obj:`~.cudaMemLocation.type` will prefetch data to host memory. Applications can request prefetching memory to a specific host NUMA node by specifying :py:obj:`~.cudaMemLocationTypeHostNuma` for :py:obj:`~.cudaMemLocation.type` and a valid host NUMA node id in :py:obj:`~.cudaMemLocation.id` Users can also request prefetching memory to the host NUMA node closest to the current thread's CPU by specifying :py:obj:`~.cudaMemLocationTypeHostNumaCurrent` for :py:obj:`~.cudaMemLocation.type`. Note when :py:obj:`~.cudaMemLocation.type` is etiher :py:obj:`~.cudaMemLocationTypeHost` OR :py:obj:`~.cudaMemLocationTypeHostNumaCurrent`, :py:obj:`~.cudaMemLocation.id` will be ignored. The start address and end address of the memory range will be rounded down and rounded up respectively to be aligned to CPU page size before the prefetch operation is enqueued in the stream. If no physical memory has been allocated for this region, then this memory region will be populated and mapped on the destination device. If there's insufficient memory to prefetch the desired region, the Unified Memory driver may evict pages from other :py:obj:`~.cudaMallocManaged` allocations to host memory in order to make room. Device memory allocated using :py:obj:`~.cudaMalloc` or :py:obj:`~.cudaMallocArray` will not be evicted. By default, any mappings to the previous location of the migrated pages are removed and mappings for the new location are only setup on the destination location. The exact behavior however also depends on the settings applied to this memory range via :py:obj:`~.cuMemAdvise` as described below: If :py:obj:`~.cudaMemAdviseSetReadMostly` was set on any subset of this memory range, then that subset will create a read-only copy of the pages on destination location. If however the destination location is a host NUMA node, then any pages of that subset that are already in another host NUMA node will be transferred to the destination. If :py:obj:`~.cudaMemAdviseSetPreferredLocation` was called on any subset of this memory range, then the pages will be migrated to `location` even if `location` is not the preferred location of any pages in the memory range. If :py:obj:`~.cudaMemAdviseSetAccessedBy` was called on any subset of this memory range, then mappings to those pages from all the appropriate processors are updated to refer to the new location if establishing such a mapping is possible. Otherwise, those mappings are cleared. Note that this API is not required for functionality and only serves to improve performance by allowing the application to migrate data to a suitable location before it is accessed. Memory accesses to this range are always coherent and are allowed even when the data is actively being migrated. Note that this function is asynchronous with respect to the host and all work on other devices. :param devPtr: Pointer to be prefetched :type devPtr: Any :param count: Size in bytes :type count: size_t :param location: location to prefetch to :type location: :py:obj:`~.cudaMemLocation` :param flags: flags for future use, must be zero now. :type flags: unsigned int :param stream: Stream to enqueue prefetch operation :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cuMemPrefetchAsync`
- cuda.bindings.runtime.cudaMemPrefetchBatchAsync(dptrs: Optional[tuple[Any] | list[Any]], sizes: tuple[int] | list[int], size_t count, prefetchLocs: Optional[tuple[cudaMemLocation] | list[cudaMemLocation]], prefetchLocIdxs: tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, stream)#
Performs a batch of memory prefetches asynchronously. Performs a batch of memory prefetches. The batch as a whole executes in stream order but operations within a batch are not guaranteed to execute in any specific order. All devices in the system must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will return an error. The semantics of the individual prefetch operations are as described in :py:obj:`~.cudaMemPrefetchAsync`. Performs memory prefetch on address ranges specified in `dptrs` and `sizes`. Both arrays must be of the same length as specified by `count`. Each memory range specified must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables or it may also refer to system-allocated memory when all devices have a non-zero value for :py:obj:`~.cudaDevAttrPageableMemoryAccess`. The prefetch location for every operation in the batch is specified in the `prefetchLocs` array. Each entry in this array can apply to more than one operation. This can be done by specifying in the `prefetchLocIdxs` array, the index of the first prefetch operation that the corresponding entry in the `prefetchLocs` array applies to. Both `prefetchLocs` and `prefetchLocIdxs` must be of the same length as specified by `numPrefetchLocs`. For example, if a batch has 10 prefetches listed in dptrs/sizes, the first 4 of which are to be prefetched to one location and the remaining 6 are to be prefetched to another, then `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be {0, 4} and `prefetchLocs` will contain the two locations. Note the first entry in `prefetchLocIdxs` must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than `count`. Furthermore, `numPrefetchLocs` must be lesser than or equal to `count`. :param dptrs: Array of pointers to be prefetched :type dptrs: list[Any] :param sizes: Array of sizes for memory prefetch operations. :type sizes: list[int] :param count: Size of `dptrs` and `sizes` arrays. :type count: size_t :param prefetchLocs: Array of locations to prefetch to. :type prefetchLocs: list[:py:obj:`~.cudaMemLocation`] :param prefetchLocIdxs: Array of indices to specify which operands each entry in the `prefetchLocs` array applies to. The locations specified in prefetchLocs[k] will be applied to copies starting from prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also prefetchLocs[numPrefetchLocs - 1] will apply to prefetches starting from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. :type prefetchLocIdxs: list[int] :param numPrefetchLocs: Size of `prefetchLocs` and `prefetchLocIdxs` arrays. :type numPrefetchLocs: size_t :param flags: Flags reserved for future use. Must be zero. :type flags: unsigned long long :param hStream: The stream to enqueue the operations in. Must not be legacy NULL stream. :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :rtype: cudaError_t
- cuda.bindings.runtime.cudaMemDiscardBatchAsync(dptrs: Optional[tuple[Any] | list[Any]], sizes: tuple[int] | list[int], size_t count, unsigned long long flags, stream)#
Performs a batch of memory discards asynchronously. Performs a batch of memory discards. The batch as a whole executes in stream order but operations within a batch are not guaranteed to execute in any specific order. All devices in the system must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will return an error. Discarding a memory range informs the driver that the contents of that range are no longer useful. Discarding memory ranges allows the driver to optimize certain data migrations and can also help reduce memory pressure. This operation can be undone on any part of the range by either writing to it or prefetching it via :py:obj:`~.cudaMemPrefetchAsync` or :py:obj:`~.cudaMemPrefetchBatchAsync`. Reading from a discarded range, without a subsequent write or prefetch to that part of the range, will return an indeterminate value. Note that any reads, writes or prefetches to any part of the memory range that occur simultaneously with the discard operation result in undefined behavior. Performs memory discard on address ranges specified in `dptrs` and `sizes`. Both arrays must be of the same length as specified by `count`. Each memory range specified must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables or it may also refer to system-allocated memory when all devices have a non-zero value for :py:obj:`~.cudaDevAttrPageableMemoryAccess`. :param dptrs: Array of pointers to be discarded :type dptrs: list[Any] :param sizes: Array of sizes for memory discard operations. :type sizes: list[int] :param count: Size of `dptrs` and `sizes` arrays. :type count: size_t :param flags: Flags reserved for future use. Must be zero. :type flags: unsigned long long :param hStream: The stream to enqueue the operations in. Must not be legacy NULL stream. :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :rtype: cudaError_t
- cuda.bindings.runtime.cudaMemDiscardAndPrefetchBatchAsync(dptrs: Optional[tuple[Any] | list[Any]], sizes: tuple[int] | list[int], size_t count, prefetchLocs: Optional[tuple[cudaMemLocation] | list[cudaMemLocation]], prefetchLocIdxs: tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, stream)#
Performs a batch of memory discards and prefetches asynchronously. Performs a batch of memory discards followed by prefetches. The batch as a whole executes in stream order but operations within a batch are not guaranteed to execute in any specific order. All devices in the system must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will return an error. Calling :py:obj:`~.cudaMemDiscardAndPrefetchBatchAsync` is semantically equivalent to calling :py:obj:`~.cudaMemDiscardBatchAsync` followed by :py:obj:`~.cudaMemPrefetchBatchAsync`, but is more optimal. For more details on what discarding and prefetching imply, please refer to :py:obj:`~.cudaMemDiscardBatchAsync` and :py:obj:`~.cudaMemPrefetchBatchAsync` respectively. Note that any reads, writes or prefetches to any part of the memory range that occur simultaneously with this combined discard+prefetch operation result in undefined behavior. Performs memory discard and prefetch on address ranges specified in `dptrs` and `sizes`. Both arrays must be of the same length as specified by `count`. Each memory range specified must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables or it may also refer to system-allocated memory when all devices have a non-zero value for :py:obj:`~.cudaDevAttrPageableMemoryAccess`. Every operation in the batch has to be associated with a valid location to prefetch the address range to and specified in the `prefetchLocs` array. Each entry in this array can apply to more than one operation. This can be done by specifying in the `prefetchLocIdxs` array, the index of the first operation that the corresponding entry in the `prefetchLocs` array applies to. Both `prefetchLocs` and `prefetchLocIdxs` must be of the same length as specified by `numPrefetchLocs`. For example, if a batch has 10 operations listed in dptrs/sizes, the first 6 of which are to be prefetched to one location and the remaining 4 are to be prefetched to another, then `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be {0, 6} and `prefetchLocs` will contain the two set of locations. Note the first entry in `prefetchLocIdxs` must always be 0. Also, each entry must be greater than the previous entry and the last entry should be less than `count`. Furthermore, `numPrefetchLocs` must be lesser than or equal to `count`. :param dptrs: Array of pointers to be discarded :type dptrs: list[Any] :param sizes: Array of sizes for memory discard operations. :type sizes: list[int] :param count: Size of `dptrs` and `sizes` arrays. :type count: size_t :param prefetchLocs: Array of locations to prefetch to. :type prefetchLocs: list[:py:obj:`~.cudaMemLocation`] :param prefetchLocIdxs: Array of indices to specify which operands each entry in the `prefetchLocs` array applies to. The locations specified in prefetchLocs[k] will be applied to operations starting from prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also prefetchLocs[numPrefetchLocs - 1] will apply to copies starting from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. :type prefetchLocIdxs: list[int] :param numPrefetchLocs: Size of `prefetchLocs` and `prefetchLocIdxs` arrays. :type numPrefetchLocs: size_t :param flags: Flags reserved for future use. Must be zero. :type flags: unsigned long long :param hStream: The stream to enqueue the operations in. Must not be legacy NULL stream. :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :rtype: cudaError_t
- cuda.bindings.runtime.cudaMemAdvise(
- devPtr,
- size_t count,
- advice: cudaMemoryAdvise,
- cudaMemLocation location: cudaMemLocation,
Advise about the usage of a given memory range. Advise the Unified Memory subsystem about the usage pattern for the memory range starting at `devPtr` with a size of `count` bytes. The start address and end address of the memory range will be rounded down and rounded up respectively to be aligned to CPU page size before the advice is applied. The memory range must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables. The memory range could also refer to system-allocated pageable memory provided it represents a valid, host-accessible region of memory and all additional constraints imposed by `advice` as outlined below are also satisfied. Specifying an invalid system- allocated pageable memory range results in an error being returned. The `advice` parameter can take the following values: - :py:obj:`~.cudaMemAdviseSetReadMostly`: This implies that the data is mostly going to be read from and only occasionally written to. Any read accesses from any processor to this region will create a read- only copy of at least the accessed pages in that processor's memory. Additionally, if :py:obj:`~.cudaMemPrefetchAsync` or :py:obj:`~.cudaMemPrefetchAsync` is called on this region, it will create a read-only copy of the data on the destination processor. If the target location for :py:obj:`~.cudaMemPrefetchAsync` is a host NUMA node and a read-only copy already exists on another host NUMA node, that copy will be migrated to the targeted host NUMA node. If any processor writes to this region, all copies of the corresponding page will be invalidated except for the one where the write occurred. If the writing processor is the CPU and the preferred location of the page is a host NUMA node, then the page will also be migrated to that host NUMA node. The `location` argument is ignored for this advice. Note that for a page to be read-duplicated, the accessing processor must either be the CPU or a GPU that has a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Also, if a context is created on a device that does not have the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` set, then read-duplication will not occur until all such contexts are destroyed. If the memory region refers to valid system-allocated pageable memory, then the accessing device must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess` for a read-only copy to be created on that device. Note however that if the accessing device also has a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then setting this advice will not create a read-only copy when that device accesses this memory region. - :py:obj:`~.cudaMemAdviceUnsetReadMostly`: Undoes the effect of :py:obj:`~.cudaMemAdviseSetReadMostly` and also prevents the Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated copies of the data will be collapsed into a single copy. The location for the collapsed copy will be the preferred location if the page has a preferred location and one of the read-duplicated copies was resident at that location. Otherwise, the location chosen is arbitrary. Note: The `location` argument is ignored for this advice. - :py:obj:`~.cudaMemAdviseSetPreferredLocation`: This advice sets the preferred location for the data to be the memory belonging to `location`. When :py:obj:`~.cudaMemLocation.type` is :py:obj:`~.cudaMemLocationTypeHost`, :py:obj:`~.cudaMemLocation.id` is ignored and the preferred location is set to be host memory. To set the preferred location to a specific host NUMA node, applications must set :py:obj:`~.cudaMemLocation.type` to :py:obj:`~.cudaMemLocationTypeHostNuma` and :py:obj:`~.cudaMemLocation.id` must specify the NUMA ID of the host NUMA node. If :py:obj:`~.cudaMemLocation.type` is set to :py:obj:`~.cudaMemLocationTypeHostNumaCurrent`, :py:obj:`~.cudaMemLocation.id` will be ignored and the host NUMA node closest to the calling thread's CPU will be used as the preferred location. If :py:obj:`~.cudaMemLocation.type` is a :py:obj:`~.cudaMemLocationTypeDevice`, then :py:obj:`~.cudaMemLocation.id` must be a valid device ordinal and the device must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Setting the preferred location does not cause data to migrate to that location immediately. Instead, it guides the migration policy when a fault occurs on that memory region. If the data is already in its preferred location and the faulting processor can establish a mapping without requiring the data to be migrated, then data migration will be avoided. On the other hand, if the data is not in its preferred location or if a direct mapping cannot be established, then it will be migrated to the processor accessing it. It is important to note that setting the preferred location does not prevent data prefetching done using :py:obj:`~.cudaMemPrefetchAsync`. Having a preferred location can override the page thrash detection and resolution logic in the Unified Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device memory, the page may eventually be pinned to host memory by the Unified Memory driver. But if the preferred location is set as device memory, then the page will continue to thrash indefinitely. If :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory region or any subset of it, then the policies associated with that advice will override the policies of this advice, unless read accesses from `location` will not result in a read-only copy being created on that procesor as outlined in description for the advice :py:obj:`~.cudaMemAdviseSetReadMostly`. If the memory region refers to valid system-allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is :py:obj:`~.cudaMemLocationTypeDevice` then :py:obj:`~.cudaMemLocation.id` must be a valid device that has a non- zero alue for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - :py:obj:`~.cudaMemAdviseUnsetPreferredLocation`: Undoes the effect of :py:obj:`~.cudaMemAdviseSetPreferredLocation` and changes the preferred location to none. The `location` argument is ignored for this advice. - :py:obj:`~.cudaMemAdviseSetAccessedBy`: This advice implies that the data will be accessed by processor `location`. The :py:obj:`~.cudaMemLocation.type` must be either :py:obj:`~.cudaMemLocationTypeDevice` with :py:obj:`~.cudaMemLocation.id` representing a valid device ordinal or :py:obj:`~.cudaMemLocationTypeHost` and :py:obj:`~.cudaMemLocation.id` will be ignored. All other location types are invalid. If :py:obj:`~.cudaMemLocation.id` is a GPU, then the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` must be non-zero. This advice does not cause data migration and has no impact on the location of the data per se. Instead, it causes the data to always be mapped in the specified processor's page tables, as long as the location of the data permits a mapping to be established. If the data gets migrated for any reason, the mappings are updated accordingly. This advice is recommended in scenarios where data locality is not important, but avoiding faults is. Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data over to the other GPUs is not as important because the accesses are infrequent and the overhead of migration may be too high. But preventing faults can still help improve performance, and so having a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated to host memory because the CPU typically cannot access device memory directly. Any GPU that had the :py:obj:`~.cudaMemAdviseSetAccessedBy` flag set for this data will now have its mapping updated to point to the page in host memory. If :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory region or any subset of it, then the policies associated with that advice will override the policies of this advice. Additionally, if the preferred location of this memory region or any subset of it is also `location`, then the policies associated with :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` will override the policies of this advice. If the memory region refers to valid system- allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is :py:obj:`~.cudaMemLocationTypeDevice` then device in :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then this call has no effect. - :py:obj:`~.CU_MEM_ADVISE_UNSET_ACCESSED_BY`: Undoes the effect of :py:obj:`~.cudaMemAdviseSetAccessedBy`. Any mappings to the data from `location` may be removed at any time causing accesses to result in non-fatal page faults. If the memory region refers to valid system- allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is :py:obj:`~.cudaMemLocationTypeDevice` then device in :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then this call has no effect. :param devPtr: Pointer to memory to set the advice for :type devPtr: Any :param count: Size in bytes of the memory range :type count: size_t :param advice: Advice to be applied for the specified memory range :type advice: :py:obj:`~.cudaMemoryAdvise` :param location: location to apply the advice for :type location: :py:obj:`~.cudaMemLocation` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemAdvise`
- cuda.bindings.runtime.cudaMemRangeGetAttribute(
- size_t dataSize,
- attribute: cudaMemRangeAttribute,
- devPtr,
- size_t count,
Query an attribute of a given memory range. Query an attribute about the memory range starting at `devPtr` with a size of `count` bytes. The memory range must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables. The `attribute` parameter can take the following values: - :py:obj:`~.cudaMemRangeAttributeReadMostly`: If this attribute is specified, `data` will be interpreted as a 32-bit integer, and `dataSize` must be 4. The result returned will be 1 if all pages in the given memory range have read-duplication enabled, or 0 otherwise. - :py:obj:`~.cudaMemRangeAttributePreferredLocation`: If this attribute is specified, `data` will be interpreted as a 32-bit integer, and `dataSize` must be 4. The result returned will be a GPU device id if all pages in the memory range have that GPU as their preferred location, or it will be cudaCpuDeviceId if all pages in the memory range have the CPU as their preferred location, or it will be cudaInvalidDeviceId if either all the pages don't have the same preferred location or some of the pages don't have a preferred location at all. Note that the actual location of the pages in the memory range at the time of the query may be different from the preferred location. - :py:obj:`~.cudaMemRangeAttributeAccessedBy`: If this attribute is specified, `data` will be interpreted as an array of 32-bit integers, and `dataSize` must be a non-zero multiple of 4. The result returned will be a list of device ids that had :py:obj:`~.cudaMemAdviceSetAccessedBy` set for that entire memory range. If any device does not have that advice set for the entire memory range, that device will not be included. If `data` is larger than the number of devices that have that advice set for that memory range, cudaInvalidDeviceId will be returned in all the extra space provided. For ex., if `dataSize` is 12 (i.e. `data` has 3 elements) and only device 0 has the advice set, then the result returned will be { 0, cudaInvalidDeviceId, cudaInvalidDeviceId }. If `data` is smaller than the number of devices that have that advice set, then only as many devices will be returned as can fit in the array. There is no guarantee on which specific devices will be returned, however. - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation`: If this attribute is specified, `data` will be interpreted as a 32-bit integer, and `dataSize` must be 4. The result returned will be the last location to which all pages in the memory range were prefetched explicitly via :py:obj:`~.cudaMemPrefetchAsync`. This will either be a GPU id or cudaCpuDeviceId depending on whether the last location for prefetch was a GPU or the CPU respectively. If any page in the memory range was never explicitly prefetched or if all pages were not prefetched to the same location, cudaInvalidDeviceId will be returned. Note that this simply returns the last location that the applicaton requested to prefetch the memory range to. It gives no indication as to whether the prefetch operation to that location has completed or even begun. - :py:obj:`~.cudaMemRangeAttributePreferredLocationType`: If this attribute is specified, `data` will be interpreted as a :py:obj:`~.cudaMemLocationType`, and `dataSize` must be sizeof(cudaMemLocationType). The :py:obj:`~.cudaMemLocationType` returned will be :py:obj:`~.cudaMemLocationTypeDevice` if all pages in the memory range have the same GPU as their preferred location, or :py:obj:`~.cudaMemLocationType` will be :py:obj:`~.cudaMemLocationTypeHost` if all pages in the memory range have the CPU as their preferred location, or or it will be :py:obj:`~.cudaMemLocationTypeHostNuma` if all the pages in the memory range have the same host NUMA node ID as their preferred location or it will be :py:obj:`~.cudaMemLocationTypeInvalid` if either all the pages don't have the same preferred location or some of the pages don't have a preferred location at all. Note that the actual location type of the pages in the memory range at the time of the query may be different from the preferred location type. - :py:obj:`~.cudaMemRangeAttributePreferredLocationId`: If this attribute is specified, `data` will be interpreted as a 32-bit integer, and `dataSize` must be 4. If the :py:obj:`~.cudaMemRangeAttributePreferredLocationType` query for the same address range returns :py:obj:`~.cudaMemLocationTypeDevice`, it will be a valid device ordinal or if it returns :py:obj:`~.cudaMemLocationTypeHostNuma`, it will be a valid host NUMA node ID or if it returns any other location type, the id should be ignored. - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType`: If this attribute is specified, `data` will be interpreted as a :py:obj:`~.cudaMemLocationType`, and `dataSize` must be sizeof(cudaMemLocationType). The result returned will be the last location type to which all pages in the memory range were prefetched explicitly via :py:obj:`~.cuMemPrefetchAsync`. The :py:obj:`~.cudaMemLocationType` returned will be :py:obj:`~.cudaMemLocationTypeDevice` if the last prefetch location was the GPU or :py:obj:`~.cudaMemLocationTypeHost` if it was the CPU or :py:obj:`~.cudaMemLocationTypeHostNuma` if the last prefetch location was a specific host NUMA node. If any page in the memory range was never explicitly prefetched or if all pages were not prefetched to the same location, :py:obj:`~.CUmemLocationType` will be :py:obj:`~.cudaMemLocationTypeInvalid`. Note that this simply returns the last location type that the application requested to prefetch the memory range to. It gives no indication as to whether the prefetch operation to that location has completed or even begun. - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationId`: If this attribute is specified, `data` will be interpreted as a 32-bit integer, and `dataSize` must be 4. If the :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType` query for the same address range returns :py:obj:`~.cudaMemLocationTypeDevice`, it will be a valid device ordinal or if it returns :py:obj:`~.cudaMemLocationTypeHostNuma`, it will be a valid host NUMA node ID or if it returns any other location type, the id should be ignored. :param dataSize: Array containing the size of data :type dataSize: size_t :param attribute: The attribute to query :type attribute: :py:obj:`~.cudaMemRangeAttribute` :param devPtr: Start of the range to query :type devPtr: Any :param count: Size of the range to query :type count: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **data** (*Any*) -- A pointers to a memory location where the result of each attribute query will be written to. .. seealso:: :py:obj:`~.cudaMemRangeGetAttributes`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cuMemRangeGetAttribute`
- cuda.bindings.runtime.cudaMemRangeGetAttributes(dataSizes: tuple[int] | list[int], attributes: Optional[tuple[cudaMemRangeAttribute] | list[cudaMemRangeAttribute]], size_t numAttributes, devPtr, size_t count)#
Query attributes of a given memory range. Query attributes of the memory range starting at `devPtr` with a size of `count` bytes. The memory range must refer to managed memory allocated via :py:obj:`~.cudaMallocManaged` or declared via managed variables. The `attributes` array will be interpreted to have `numAttributes` entries. The `dataSizes` array will also be interpreted to have `numAttributes` entries. The results of the query will be stored in `data`. The list of supported attributes are given below. Please refer to :py:obj:`~.cudaMemRangeGetAttribute` for attribute descriptions and restrictions. - :py:obj:`~.cudaMemRangeAttributeReadMostly` - :py:obj:`~.cudaMemRangeAttributePreferredLocation` - :py:obj:`~.cudaMemRangeAttributeAccessedBy` - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation` - :: cudaMemRangeAttributePreferredLocationType - :: cudaMemRangeAttributePreferredLocationId - :: cudaMemRangeAttributeLastPrefetchLocationType - :: cudaMemRangeAttributeLastPrefetchLocationId :param dataSizes: Array containing the sizes of each result :type dataSizes: list[int] :param attributes: An array of attributes to query (numAttributes and the number of attributes in this array should match) :type attributes: list[:py:obj:`~.cudaMemRangeAttribute`] :param numAttributes: Number of attributes to query :type numAttributes: size_t :param devPtr: Start of the range to query :type devPtr: Any :param count: Size of the range to query :type count: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **data** (*list[Any]*) -- A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to. .. seealso:: :py:obj:`~.cudaMemRangeGetAttribute`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemRangeGetAttributes`
- cuda.bindings.runtime.make_cudaPitchedPtr(d, size_t p, size_t xsz, size_t ysz)#
Returns a :py:obj:`~.cudaPitchedPtr` based on input parameters. Returns a :py:obj:`~.cudaPitchedPtr` based on the specified input parameters `d`, `p`, `xsz`, and `ysz`. :param d: Pointer to allocated memory :type d: Any :param p: Pitch of allocated memory in bytes :type p: size_t :param xsz: Logical width of allocation in elements :type xsz: size_t :param ysz: Logical height of allocation in elements :type ysz: size_t :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * :py:obj:`~.cudaPitchedPtr` -- :py:obj:`~.cudaPitchedPtr` specified by `d`, `p`, `xsz`, and `ysz` .. seealso:: :obj:`make_cudaExtent`, :obj:`make_cudaPos`
- cuda.bindings.runtime.make_cudaPos(size_t x, size_t y, size_t z)#
Returns a :py:obj:`~.cudaPos` based on input parameters. Returns a :py:obj:`~.cudaPos` based on the specified input parameters `x`, `y`, and `z`. :param x: X position :type x: size_t :param y: Y position :type y: size_t :param z: Z position :type z: size_t :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * :py:obj:`~.cudaPos` -- :py:obj:`~.cudaPos` specified by `x`, `y`, and `z` .. seealso:: :obj:`make_cudaExtent`, :obj:`make_cudaPitchedPtr`
- cuda.bindings.runtime.make_cudaExtent(size_t w, size_t h, size_t d)#
Returns a :py:obj:`~.cudaExtent` based on input parameters. Returns a :py:obj:`~.cudaExtent` based on the specified input parameters `w`, `h`, and `d`. :param w: Width in elements when referring to array memory, in bytes when referring to linear memory :type w: size_t :param h: Height in elements :type h: size_t :param d: Depth in elements :type d: size_t :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * :py:obj:`~.cudaExtent` -- :py:obj:`~.cudaExtent` specified by `w`, `h`, and `d` .. seealso:: :obj:`make_cudaPitchedPtr`, :obj:`make_cudaPos`
Stream Ordered Memory Allocator#
overview
The asynchronous allocator allows the user to allocate and free in stream order. All asynchronous accesses of the allocation must happen between the stream executions of the allocation and the free. If the memory is accessed outside of the promised stream order, a use before allocation / use after free error will cause undefined behavior.
The allocator is free to reallocate the memory as long as it can guarantee that compliant memory accesses will not overlap temporally. The allocator may refer to internal stream ordering as well as inter-stream dependencies (such as CUDA events and null stream dependencies) when establishing the temporal guarantee. The allocator may also insert inter-stream dependencies to establish the temporal guarantee.
Supported Platforms
Whether or not a device supports the integrated stream ordered memory allocator may be queried by calling cudaDeviceGetAttribute() with the device attribute cudaDevAttrMemoryPoolsSupported.
- cuda.bindings.runtime.cudaMallocAsync(size_t size, hStream)#
Allocates memory with stream ordered semantics. Inserts an allocation operation into `hStream`. A pointer to the allocated memory is returned immediately in *dptr. The allocation must not be accessed until the the allocation operation completes. The allocation comes from the memory pool associated with the stream's device. :param size: Number of bytes to allocate :type size: size_t :param hStream: The stream establishing the stream ordering contract and the memory pool to allocate from :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, * **devPtr** (*Any*) -- Returned device pointer .. seealso:: :py:obj:`~.cuMemAllocAsync`, :obj:`cudaMallocAsync`, :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolGetAttribute` .. rubric:: Notes The default memory pool of a device contains device memory from that device. Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream runs. During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters.
- cuda.bindings.runtime.cudaFreeAsync(devPtr, hStream)#
Frees memory with stream ordered semantics. Inserts a free operation into `hStream`. The allocation must not be accessed after stream execution reaches the free. After this API returns, accessing the memory from any subsequent work launched on the GPU or querying its pointer attributes results in undefined behavior. :param dptr: memory to free :type dptr: Any :param hStream: The stream establishing the stream ordering promise :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cudaMallocAsync` .. rubric:: Notes During stream capture, this function results in the creation of a free node and must therefore be passed the address of a graph allocation.
- cuda.bindings.runtime.cudaMemPoolTrimTo(memPool, size_t minBytesToKeep)#
Tries to release memory back to the OS. Releases memory back to the OS until the pool contains fewer than minBytesToKeep reserved bytes, or there is no more memory that the allocator can safely release. The allocator cannot release OS allocations that back outstanding asynchronous allocations. The OS allocations may happen at different granularity from the user allocations. :param pool: The memory pool to trim :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param minBytesToKeep: If the pool has less than minBytesToKeep reserved, the TrimTo operation is a no-op. Otherwise the pool will be guaranteed to have at least minBytesToKeep bytes reserved after the operation. :type minBytesToKeep: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` .. rubric:: Notes : Allocations that have not been freed count as outstanding. : Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize) can count as outstanding.
- cuda.bindings.runtime.cudaMemPoolSetAttribute(memPool, attr: cudaMemPoolAttr, value)#
Sets attributes of a memory pool. Supported attributes are: - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0) - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously freed in another stream as long as a stream ordering dependency of the allocating stream on the free action exists. Cuda events and null stream interactions can create the required stream ordered dependencies. (default enabled) - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled) - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` (default enabled). - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) Reset the high watermark that tracks the amount of backing memory that was allocated for the memory pool. It is illegal to set this attribute to a non-zero value. - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) Reset the high watermark that tracks the amount of used memory that was allocated for the memory pool. It is illegal to set this attribute to a non-zero value. :param pool: The memory pool to modify :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param attr: The attribute to modify :type attr: :py:obj:`~.cudaMemPoolAttr` :param value: Pointer to the value to assign :type value: Any :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuMemPoolSetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate`
- cuda.bindings.runtime.cudaMemPoolGetAttribute(memPool, attr: cudaMemPoolAttr)#
Gets attributes of a memory pool. Supported attributes are: - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0) - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously freed in another stream as long as a stream ordering dependency of the allocating stream on the free action exists. Cuda events and null stream interactions can create the required stream ordered dependencies. (default enabled) - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled) - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` (default enabled). - :py:obj:`~.cudaMemPoolAttrReservedMemCurrent`: (value type = cuuint64_t) Amount of backing memory currently allocated for the mempool. - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset. - :py:obj:`~.cudaMemPoolAttrUsedMemCurrent`: (value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application. - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset. The following properties can be also be queried on imported and default pools: - :py:obj:`~.cudaMemPoolAttrAllocationType`: (value type = cudaMemAllocationType) The allocation type of the mempool - :py:obj:`~.cudaMemPoolAttrExportHandleTypes`: (value type = cudaMemAllocationHandleType) Available export handle types for the mempool. For imported pools this value is always cudaMemHandleTypeNone as an imported pool cannot be re-exported - :py:obj:`~.cudaMemPoolAttrLocationId`: (value type = int) The location id for the mempool. If the location type for this pool is cudaMemLocationTypeInvisible then ID will be cudaInvalidDeviceId. - :py:obj:`~.cudaMemPoolAttrLocationType`: (value type = cudaMemLocationType) The location type for the mempool. For imported memory pools where the device is not directly visible to the importing process or pools imported via fabric handles across nodes this will be cudaMemlocataionTypeInvisible. - :py:obj:`~.cudaMemPoolAttrMaxPoolSize`: (value type = cuuint64_t) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cuMemPoolCreate due to alignment requirements. A value of 0 indicates no maximum size. For cudaMemAllocationTypeManaged and IPC imported pools this value will be system dependent. - :py:obj:`~.cudaMemPoolAttrHwDecompressEnabled`: (value type = int) Indicates whether the pool has hardware compresssion enabled :param pool: The memory pool to get attributes of :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param attr: The attribute to get :type attr: :py:obj:`~.cudaMemPoolAttr` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **value** (*Any*) -- Retrieved value .. seealso:: :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate`
- cuda.bindings.runtime.cudaMemPoolSetAccess(memPool, descList: Optional[tuple[cudaMemAccessDesc] | list[cudaMemAccessDesc]], size_t count)#
Controls visibility of pools between devices. :param pool: The pool being modified :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param map: Array of access descriptors. Each descriptor instructs the access to enable for a single gpu :type map: list[:py:obj:`~.cudaMemAccessDesc`] :param count: Number of descriptors in the map array. :type count: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuMemPoolSetAccess`, :py:obj:`~.cudaMemPoolGetAccess`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`
- cuda.bindings.runtime.cudaMemPoolGetAccess(memPool, cudaMemLocation location: Optional[cudaMemLocation])#
Returns the accessibility of a pool from a device. Returns the accessibility of the pool's memory from the specified location. :param memPool: the pool being queried :type memPool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param location: the location accessing the pool :type location: :py:obj:`~.cudaMemLocation` :returns: * *cudaError_t* * **flags** (:py:obj:`~.cudaMemAccessFlags`) -- the accessibility of the pool from the specified location .. seealso:: :py:obj:`~.cuMemPoolGetAccess`, :py:obj:`~.cudaMemPoolSetAccess`
- cuda.bindings.runtime.cudaMemPoolCreate(cudaMemPoolProps poolProps: Optional[cudaMemPoolProps])#
Creates a memory pool. Creates a CUDA memory pool and returns the handle in `pool`. The `poolProps` determines the properties of the pool such as the backing device and IPC capabilities. To create a memory pool for host memory not targeting a specific NUMA node, applications must set set :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::type to :py:obj:`~.cudaMemLocationTypeHost`. :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::id is ignored for such pools. Pools created with the type :py:obj:`~.cudaMemLocationTypeHost` are not IPC capable and :py:obj:`~.cudaMemPoolProps.handleTypes` must be 0, any other values will result in :py:obj:`~.cudaErrorInvalidValue`. To create a memory pool targeting a specific host NUMA node, applications must set :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::type to :py:obj:`~.cudaMemLocationTypeHostNuma` and :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::id must specify the NUMA ID of the host memory node. Specifying :py:obj:`~.cudaMemLocationTypeHostNumaCurrent` as the :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::type will result in :py:obj:`~.cudaErrorInvalidValue`. By default, the pool's memory will be accessible from the device it is allocated on. In the case of pools created with :py:obj:`~.cudaMemLocationTypeHostNuma` or :py:obj:`~.cudaMemLocationTypeHost`, their default accessibility will be from the host CPU. Applications can control the maximum size of the pool by specifying a non-zero value for :py:obj:`~.cudaMemPoolProps.maxSize`. If set to 0, the maximum size of the pool will default to a system dependent value. Applications that intend to use :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` based memory sharing must ensure: (1) `nvidia-caps-imex-channels` character device is created by the driver and is listed under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application. When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory. The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each user. These channel files exist in /dev/nvidia-caps-imex-channels/channel* and can be created using standard OS native calls like mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command: `mknod /dev/nvidia-caps-imex-channels/channel0 c <major number> 0` To create a managed memory pool, applications must set :py:obj:`~.cudaMemPoolProps`:cudaMemAllocationType to :py:obj:`~.cudaMemAllocationTypeManaged`. :py:obj:`~.cudaMemPoolProps`::cudaMemAllocationHandleType must also be set to :py:obj:`~.cudaMemHandleTypeNone` since IPC is not supported. For managed memory pools, :py:obj:`~.cudaMemPoolProps`::cudaMemLocation will be treated as the preferred location for all allocations created from the pool. An application can also set :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location. :py:obj:`~.cudaMemPoolProps.maxSize` must be set to zero for managed memory pools. :py:obj:`~.cudaMemPoolProps.usage` should be zero as decompress for managed memory is not supported. For managed memory pools, all devices on the system must have non-zero :py:obj:`~.concurrentManagedAccess`. If not, this call returns :py:obj:`~.cudaErrorNotSupported` :param poolProps: None :type poolProps: :py:obj:`~.cudaMemPoolProps` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` * **memPool** (:py:obj:`~.cudaMemPool_t`) -- None .. seealso:: :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool` .. rubric:: Notes Specifying :py:obj:`~.cudaMemHandleTypeNone` creates a memory pool that will not support IPC.
- cuda.bindings.runtime.cudaMemPoolDestroy(memPool)#
Destroys the specified memory pool. If any pointers obtained from this pool haven't been freed or the pool has free operations that haven't completed when :py:obj:`~.cudaMemPoolDestroy` is invoked, the function will return immediately and the resources associated with the pool will be released automatically once there are no more outstanding allocations. Destroying the current mempool of a device sets the default mempool of that device as the current mempool for that device. :param memPool: None :type memPool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :obj:`cuMemPoolDestroy`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` .. rubric:: Notes A device's default memory pool cannot be destroyed.
- cuda.bindings.runtime.cudaMemGetDefaultMemPool(cudaMemLocation location: Optional[cudaMemLocation], typename: cudaMemAllocationType)#
Returns the default memory pool for a given location and allocation type. The memory location can be of one of :py:obj:`~.cudaMemLocationTypeDevice`, :py:obj:`~.cudaMemLocationTypeHost` or :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one of :py:obj:`~.cudaMemAllocationTypePinned` or :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location for the managed memory pool. In all other cases, the call return :py:obj:`~.cudaErrorInvalidValue` :param location: None :type location: :py:obj:`~.cudaMemLocation` :param typename: None :type typename: :py:obj:`~.cudaMemAllocationType` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, * **memPool** (:py:obj:`~.cudaMemPool_t`) -- None .. seealso:: :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cuMemPoolSetAttribute`, :obj:`cuMemPoolSetAccess`, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate`
- cuda.bindings.runtime.cudaMemGetMemPool(cudaMemLocation location: Optional[cudaMemLocation], typename: cudaMemAllocationType)#
Gets the current memory pool for a given memory location and allocation type. The memory location can be of one of :py:obj:`~.cudaMemLocationTypeDevice`, :py:obj:`~.cudaMemLocationTypeHost` or :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one of :py:obj:`~.cudaMemAllocationTypePinned` or :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location for the managed memory pool. In all other cases, the call return :py:obj:`~.cudaErrorInvalidValue` Returns the last pool provided to :py:obj:`~.cudaMemSetMemPool` or :py:obj:`~.cudaDeviceSetMemPool` for this location and allocation type or the location's default memory pool if :py:obj:`~.cudaMemSetMemPool` or :py:obj:`~.cudaDeviceSetMemPool` for that allocType and location has never been called. By default the current mempool of a location is the default mempool for a device that can be obtained via cudaMemGetDefaultMemPool Otherwise the returned pool must have been set with :py:obj:`~.cudaDeviceSetMemPool`. :param location: None :type location: :py:obj:`~.cudaMemLocation` :param typename: None :type typename: :py:obj:`~.cudaMemAllocationType` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **memPool** (:py:obj:`~.cudaMemPool_t`) -- None .. seealso:: :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cuMemSetMemPool`
- cuda.bindings.runtime.cudaMemSetMemPool(cudaMemLocation location: Optional[cudaMemLocation], typename: cudaMemAllocationType, memPool)#
Sets the current memory pool for a memory location and allocation type. The memory location can be of one of :py:obj:`~.cudaMemLocationTypeDevice`, :py:obj:`~.cudaMemLocationTypeHost` or :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one of :py:obj:`~.cudaMemAllocationTypePinned` or :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location for the managed memory pool. In all other cases, the call return :py:obj:`~.cudaErrorInvalidValue` When a memory pool is set as the current memory pool, the location parameter should be the same as the location of the pool. If the location type or index don't match, the call returns :py:obj:`~.cudaErrorInvalidValue`. The type of memory pool should also match the parameter allocType. Else the call returns :py:obj:`~.cudaErrorInvalidValue`. By default, a memory location's current memory pool is its default memory pool. If the location type is :py:obj:`~.cudaMemLocationTypeDevice` and the allocation type is :py:obj:`~.cudaMemAllocationTypePinned`, then this API is the equivalent of calling :py:obj:`~.cudaDeviceSetMemPool` with the location id as the device. For further details on the implications, please refer to the documentation for :py:obj:`~.cudaDeviceSetMemPool`. :param location: None :type location: :py:obj:`~.cudaMemLocation` :param typename: None :type typename: :py:obj:`~.cudaMemAllocationType` :param memPool: None :type memPool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuMemPoolDestroy`, :py:obj:`~.cuMemAllocFromPoolAsync` .. rubric:: Notes Use :py:obj:`~.cudaMallocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on.
- cuda.bindings.runtime.cudaMallocFromPoolAsync(size_t size, memPool, stream)#
Allocates memory from a specified pool with stream ordered semantics. Inserts an allocation operation into `hStream`. A pointer to the allocated memory is returned immediately in *dptr. The allocation must not be accessed until the the allocation operation completes. The allocation comes from the specified memory pool. :param bytesize: Number of bytes to allocate :type bytesize: size_t :param memPool: The pool to allocate from :type memPool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param stream: The stream establishing the stream ordering semantic :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory` * **ptr** (*Any*) -- Returned device pointer .. seealso:: :py:obj:`~.cuMemAllocFromPoolAsync`, :obj:`cudaMallocAsync`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute` .. rubric:: Notes During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters.
- memPool,
- handleType: cudaMemAllocationHandleType,
- unsigned int flags,
Exports a memory pool to the requested handle type. Given an IPC capable mempool, create an OS handle to share the pool with another process. A recipient process can convert the shareable handle into a mempool with :py:obj:`~.cudaMemPoolImportFromShareableHandle`. Individual pointers can then be shared with the :py:obj:`~.cudaMemPoolExportPointer` and :py:obj:`~.cudaMemPoolImportPointer` APIs. The implementation of what the shareable handle is and how it can be transferred is defined by the requested handle type. :param pool: pool to export :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param handleType: the type of handle to create :type handleType: :py:obj:`~.cudaMemAllocationHandleType` :param flags: must be 0 :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` * **handle_out** (*Any*) -- pointer to the location in which to store the requested handle .. seealso:: :py:obj:`~.cuMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` .. rubric:: Notes : To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than cudaMemHandleTypeNone.
- shareableHandle,
- handleType: cudaMemAllocationHandleType,
- unsigned int flags,
imports a memory pool from a shared handle. Specific allocations can be imported from the imported pool with :py:obj:`~.cudaMemPoolImportPointer`. :param handle: OS handle of the pool to open :type handle: Any :param handleType: The type of handle being imported :type handleType: :py:obj:`~.cudaMemAllocationHandleType` :param flags: must be 0 :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` * **pool_out** (:py:obj:`~.cudaMemPool_t`) -- Returned memory pool .. seealso:: :py:obj:`~.cuMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` .. rubric:: Notes Imported memory pools do not support creating new allocations. As such imported memory pools may not be used in :py:obj:`~.cudaDeviceSetMemPool` or :py:obj:`~.cudaMallocFromPoolAsync` calls.
- cuda.bindings.runtime.cudaMemPoolExportPointer(ptr)#
Export data to share a memory pool allocation between processes. Constructs `shareData_out` for sharing a specific allocation from an already shared memory pool. The recipient process can import the allocation with the :py:obj:`~.cudaMemPoolImportPointer` api. The data is not a handle and may be shared through any IPC mechanism. :param ptr: pointer to memory being exported :type ptr: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` * **shareData_out** (:py:obj:`~.cudaMemPoolPtrExportData`) -- Returned export data .. seealso:: :py:obj:`~.cuMemPoolExportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolImportPointer`
- cuda.bindings.runtime.cudaMemPoolImportPointer(memPool, cudaMemPoolPtrExportData exportData: Optional[cudaMemPoolPtrExportData])#
Import a memory pool allocation from another process. Returns in `ptr_out` a pointer to the imported memory. The imported memory must not be accessed before the allocation operation completes in the exporting process. The imported memory must be freed from all importing processes before being freed in the exporting process. The pointer may be freed with cudaFree or cudaFreeAsync. If :py:obj:`~.cudaFreeAsync` is used, the free must be completed on the importing process before the free operation on the exporting process. :param pool: pool from which to import :type pool: :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` :param shareData: data specifying the memory to import :type shareData: :py:obj:`~.cudaMemPoolPtrExportData` :returns: * *cudaError_t* -- :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` * **ptr_out** (*Any*) -- pointer to imported memory .. seealso:: :py:obj:`~.cuMemPoolImportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer` .. rubric:: Notes The :py:obj:`~.cudaFreeAsync` api may be used in the exporting process before the :py:obj:`~.cudaFreeAsync` operation completes in its stream as long as the :py:obj:`~.cudaFreeAsync` in the exporting process specifies a stream with a stream dependency on the importing process's :py:obj:`~.cudaFreeAsync`.
Unified Addressing#
This section describes the unified addressing functions of the CUDA runtime application programming interface.
Overview
CUDA devices can share a unified address space with the host.
For these devices there is no distinction between a device pointer and a host pointer – the same pointer value may be used to access memory from the host program and from a kernel running on the device (with exceptions enumerated below).
Supported Platforms
Whether or not a device supports unified addressing may be queried by calling cudaGetDeviceProperties() with the device property cudaDeviceProp::unifiedAddressing.
Unified addressing is automatically enabled in 64-bit processes .
Looking Up Information from Pointer Values
It is possible to look up information about the memory which backs a pointer value. For instance, one may want to know if a pointer points to host or device memory. As another example, in the case of device memory, one may want to know on which CUDA device the memory resides. These properties may be queried using the function cudaPointerGetAttributes()
Since pointers are unique, it is not necessary to specify information about the pointers specified to cudaMemcpy() and other copy functions.
The copy direction cudaMemcpyDefault may be used to specify that the CUDA runtime should infer the location of the pointer from its value.
Automatic Mapping of Host Allocated Host Memory
All host memory allocated through all devices using cudaMallocHost() and cudaHostAlloc() is always directly accessible from all devices that support unified addressing. This is the case regardless of whether or not the flags cudaHostAllocPortable and cudaHostAllocMapped are specified.
The pointer value through which allocated host memory may be accessed in kernels on all devices that support unified addressing is the same as the pointer value through which that memory is accessed on the host. It is not necessary to call cudaHostGetDevicePointer() to get the device pointer for these allocations.
Note that this is not the case for memory allocated using the flag cudaHostAllocWriteCombined, as discussed below.
Direct Access of Peer Memory
Upon enabling direct access from a device that supports unified addressing to another peer device that supports unified addressing using cudaDeviceEnablePeerAccess() all memory allocated in the peer device using cudaMalloc() and cudaMallocPitch() will immediately be accessible by the current device. The device pointer value through which any peer’s memory may be accessed in the current device is the same pointer value through which that memory may be accessed from the peer device.
Exceptions, Disjoint Addressing
Not all memory may be accessed on devices through the same pointer value through which they are accessed on the host. These exceptions are host memory registered using cudaHostRegister() and host memory allocated using the flag cudaHostAllocWriteCombined. For these exceptions, there exists a distinct host and device address for the memory. The device address is guaranteed to not overlap any valid host pointer range and is guaranteed to have the same value across all devices that support unified addressing.
This device address may be queried using cudaHostGetDevicePointer() when a device using unified addressing is current. Either the host or the unified device pointer value may be used to refer to this memory in cudaMemcpy() and similar functions using the cudaMemcpyDefault memory direction.
- cuda.bindings.runtime.cudaPointerGetAttributes(ptr)#
Returns attributes about a specified pointer. Returns in `*attributes` the attributes of the pointer `ptr`. If pointer was not allocated in, mapped by or registered with context supporting unified addressing :py:obj:`~.cudaErrorInvalidValue` is returned. The :py:obj:`~.cudaPointerAttributes` structure is defined as: **View CUDA Toolkit Documentation for a C++ code example** In this structure, the individual fields mean - :py:obj:`~.cudaPointerAttributes.type` identifies type of memory. It can be :py:obj:`~.cudaMemoryTypeUnregistered` for unregistered host memory, :py:obj:`~.cudaMemoryTypeHost` for registered host memory, :py:obj:`~.cudaMemoryTypeDevice` for device memory or :py:obj:`~.cudaMemoryTypeManaged` for managed memory. - :py:obj:`~.device` is the device against which `ptr` was allocated. If `ptr` has memory type :py:obj:`~.cudaMemoryTypeDevice` then this identifies the device on which the memory referred to by `ptr` physically resides. If `ptr` has memory type :py:obj:`~.cudaMemoryTypeHost` then this identifies the device which was current when the allocation was made (and if that device is deinitialized then this allocation will vanish with that device's state). - :py:obj:`~.devicePointer` is the device pointer alias through which the memory referred to by `ptr` may be accessed on the current device. If the memory referred to by `ptr` cannot be accessed directly by the current device then this is NULL. - :py:obj:`~.hostPointer` is the host pointer alias through which the memory referred to by `ptr` may be accessed on the host. If the memory referred to by `ptr` cannot be accessed directly by the host then this is NULL. :param ptr: Pointer to get attributes for :type ptr: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` * **attributes** (:py:obj:`~.cudaPointerAttributes`) -- Attributes for the specified pointer .. seealso:: :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuPointerGetAttributes` .. rubric:: Notes In CUDA 11.0 forward passing host pointer will return :py:obj:`~.cudaMemoryTypeUnregistered` in :py:obj:`~.cudaPointerAttributes.type` and call will return :py:obj:`~.cudaSuccess`.
Peer Device Memory Access#
This section describes the peer device memory access functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaDeviceCanAccessPeer(int device, int peerDevice)#
Queries if a device may directly access a peer device's memory. Returns in `*canAccessPeer` a value of 1 if device `device` is capable of directly accessing memory from `peerDevice` and 0 otherwise. If direct access of `peerDevice` from `device` is possible, then access may be enabled by calling :py:obj:`~.cudaDeviceEnablePeerAccess()`. :param device: Device from which allocations on `peerDevice` are to be directly accessed. :type device: int :param peerDevice: Device on which the allocations to be directly accessed by `device` reside. :type peerDevice: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` * **canAccessPeer** (*int*) -- Returned access capability .. seealso:: :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuDeviceCanAccessPeer`
- cuda.bindings.runtime.cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags)#
Enables direct access to memory allocations on a peer device. On success, all allocations from `peerDevice` will immediately be accessible by the current device. They will remain accessible until access is explicitly disabled using :py:obj:`~.cudaDeviceDisablePeerAccess()` or either device is reset using :py:obj:`~.cudaDeviceReset()`. Note that access granted by this call is unidirectional and that in order to access memory on the current device from `peerDevice`, a separate symmetric call to :py:obj:`~.cudaDeviceEnablePeerAccess()` is required. Note that there are both device-wide and system-wide limitations per system configuration, as noted in the CUDA Programming Guide under the section "Peer-to-Peer Memory Access". Returns :py:obj:`~.cudaErrorInvalidDevice` if :py:obj:`~.cudaDeviceCanAccessPeer()` indicates that the current device cannot directly access memory from `peerDevice`. Returns :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled` if direct access of `peerDevice` from the current device has already been enabled. Returns :py:obj:`~.cudaErrorInvalidValue` if `flags` is not 0. :param peerDevice: Peer device to enable direct access to from the current device :type peerDevice: int :param flags: Reserved for future use and must be set to 0 :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuCtxEnablePeerAccess`
- cuda.bindings.runtime.cudaDeviceDisablePeerAccess(int peerDevice)#
Disables direct access to memory allocations on a peer device. Returns :py:obj:`~.cudaErrorPeerAccessNotEnabled` if direct access to memory on `peerDevice` has not yet been enabled from the current device. :param peerDevice: Peer device to disable direct access to :type peerDevice: int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorPeerAccessNotEnabled`, :py:obj:`~.cudaErrorInvalidDevice` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess`
OpenGL Interoperability#
impl_private
This section describes the OpenGL interoperability functions of the CUDA runtime application programming interface. Note that mapping of OpenGL resources is performed with the graphics API agnostic, resource mapping interface described in Graphics Interopability.
- class cuda.bindings.runtime.cudaGLDeviceList(value: int)#
CUDA devices corresponding to the current OpenGL context
- cudaGLDeviceListAll = <cudaGLDeviceList.cudaGLDeviceListAll: 1>#
The CUDA devices for all GPUs used by the current OpenGL context
- cudaGLDeviceListCurrentFrame = <cudaGLDeviceList.cudaGLDeviceListCurrentFrame: 2>#
The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame
- cudaGLDeviceListNextFrame = <cudaGLDeviceList.cudaGLDeviceListNextFrame: 3>#
The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame
- cuda.bindings.runtime.cudaGLGetDevices(
- unsigned int cudaDeviceCount,
- deviceList: cudaGLDeviceList,
Gets the CUDA devices associated with the current OpenGL context. Returns in `*pCudaDeviceCount` the number of CUDA-compatible devices corresponding to the current OpenGL context. Also returns in `*pCudaDevices` at most `cudaDeviceCount` of the CUDA-compatible devices corresponding to the current OpenGL context. If any of the GPUs being used by the current OpenGL context are not CUDA capable then the call will return cudaErrorNoDevice. :param cudaDeviceCount: The size of the output device array `pCudaDevices` :type cudaDeviceCount: unsigned int :param deviceList: The set of devices to return. This set may be cudaGLDeviceListAll for all devices, cudaGLDeviceListCurrentFrame for the devices used to render the current frame (in SLI), or cudaGLDeviceListNextFrame for the devices used to render the next frame (in SLI). :type deviceList: cudaGLDeviceList :returns: * *cudaError_t* -- cudaSuccess cudaErrorNoDevice cudaErrorInvalidGraphicsContext cudaErrorUnknown * **pCudaDeviceCount** (*unsigned int*) -- Returned number of CUDA devices corresponding to the current OpenGL context * **pCudaDevices** (*list[int]*) -- Returned CUDA devices corresponding to the current OpenGL context .. seealso:: :obj:`~.cudaGraphicsUnregisterResource`, :obj:`~.cudaGraphicsMapResources`, :obj:`~.cudaGraphicsSubResourceGetMappedArray`, :obj:`~.cudaGraphicsResourceGetMappedPointer`, :obj:`~.cuGLGetDevices` .. rubric:: Notes This function is not supported on Mac OS X.
- cuda.bindings.runtime.cudaGraphicsGLRegisterImage(image, target, unsigned int flags)#
Register an OpenGL texture or renderbuffer object. Registers the texture or renderbuffer object specified by `image` for access by CUDA. A handle to the registered object is returned as `resource`. `target` must match the type of the object, and must be one of :py:obj:`~.GL_TEXTURE_2D`, :py:obj:`~.GL_TEXTURE_RECTANGLE`, :py:obj:`~.GL_TEXTURE_CUBE_MAP`, :py:obj:`~.GL_TEXTURE_3D`, :py:obj:`~.GL_TEXTURE_2D_ARRAY`, or :py:obj:`~.GL_RENDERBUFFER`. The register flags `flags` specify the intended usage, as follows: - :py:obj:`~.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. - :py:obj:`~.cudaGraphicsRegisterFlagsReadOnly`: Specifies that CUDA will not write to this resource. - :py:obj:`~.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. - :py:obj:`~.cudaGraphicsRegisterFlagsSurfaceLoadStore`: Specifies that CUDA will bind this resource to a surface reference. - :py:obj:`~.cudaGraphicsRegisterFlagsTextureGather`: Specifies that CUDA will perform texture gather operations on this resource. The following image formats are supported. For brevity's sake, the list is abbreviated. For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats {GL_R8, GL_R16, GL_RG8, GL_RG16} : - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I} - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT} The following image classes are currently disallowed: - Textures with borders - Multisampled renderbuffers :param image: name of texture or renderbuffer object to be registered :type image: :py:obj:`~.GLuint` :param target: Identifies the type of object specified by `image` :type target: :py:obj:`~.GLenum` :param flags: Register flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem`, :py:obj:`~.cudaErrorUnknown` * **resource** (:py:obj:`~.cudaGraphicsResource`) -- Pointer to the returned object handle .. seealso:: :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsGLRegisterImage`
- cuda.bindings.runtime.cudaGraphicsGLRegisterBuffer(buffer, unsigned int flags)#
Registers an OpenGL buffer object. Registers the buffer object specified by `buffer` for access by CUDA. A handle to the registered object is returned as `resource`. The register flags `flags` specify the intended usage, as follows: - :py:obj:`~.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. - :py:obj:`~.cudaGraphicsRegisterFlagsReadOnly`: Specifies that CUDA will not write to this resource. - :py:obj:`~.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. :param buffer: name of buffer object to be registered :type buffer: :py:obj:`~.GLuint` :param flags: Register flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem`, :py:obj:`~.cudaErrorUnknown` * **resource** (:py:obj:`~.cudaGraphicsResource`) -- Pointer to the returned object handle .. seealso:: :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsGLRegisterBuffer`
Direct3D 9 Interoperability#
Direct3D 10 Interoperability#
Direct3D 11 Interoperability#
VDPAU Interoperability#
This section describes the VDPAU interoperability functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaVDPAUGetDevice(vdpDevice, vdpGetProcAddress)#
Gets the CUDA device associated with a VdpDevice. Returns the CUDA device associated with a VdpDevice, if applicable. :param vdpDevice: A VdpDevice handle :type vdpDevice: :py:obj:`~.VdpDevice` :param vdpGetProcAddress: VDPAU's VdpGetProcAddress function pointer :type vdpGetProcAddress: :py:obj:`~.VdpGetProcAddress` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` * **device** (*int*) -- Returns the device associated with vdpDevice, or -1 if the device associated with vdpDevice is not a compute device. .. seealso:: :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cuVDPAUGetDevice`
- cuda.bindings.runtime.cudaVDPAUSetVDPAUDevice(int device, vdpDevice, vdpGetProcAddress)#
Sets a CUDA device to use VDPAU interoperability. Records `vdpDevice` as the VdpDevice for VDPAU interoperability with the CUDA device `device` and sets `device` as the current device for the calling host thread. This function will immediately initialize the primary context on `device` if needed. If `device` has already been initialized then this call will fail with the error :py:obj:`~.cudaErrorSetOnActiveProcess`. In this case it is necessary to reset `device` using :py:obj:`~.cudaDeviceReset()` before VDPAU interoperability on `device` may be enabled. :param device: Device to use for VDPAU interoperability :type device: int :param vdpDevice: The VdpDevice to interoperate with :type vdpDevice: :py:obj:`~.VdpDevice` :param vdpGetProcAddress: VDPAU's VdpGetProcAddress function pointer :type vdpGetProcAddress: :py:obj:`~.VdpGetProcAddress` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorSetOnActiveProcess` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphicsVDPAURegisterVideoSurface`, :py:obj:`~.cudaGraphicsVDPAURegisterOutputSurface`, :py:obj:`~.cudaDeviceReset`
- cuda.bindings.runtime.cudaGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags)#
Register a VdpVideoSurface object. Registers the VdpVideoSurface specified by `vdpSurface` for access by CUDA. A handle to the registered object is returned as `resource`. The surface's intended usage is specified using `flags`, as follows: - :py:obj:`~.cudaGraphicsMapFlagsNone`: 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. - :py:obj:`~.cudaGraphicsMapFlagsReadOnly`: Specifies that CUDA will not write to this resource. - :py:obj:`~.cudaGraphicsMapFlagsWriteDiscard`: 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. :param vdpSurface: VDPAU object to be registered :type vdpSurface: :py:obj:`~.VdpVideoSurface` :param flags: Map flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` * **resource** (:py:obj:`~.cudaGraphicsResource`) -- Pointer to the returned object handle .. seealso:: :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsVDPAURegisterVideoSurface`
- cuda.bindings.runtime.cudaGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags)#
Register a VdpOutputSurface object. Registers the VdpOutputSurface specified by `vdpSurface` for access by CUDA. A handle to the registered object is returned as `resource`. The surface's intended usage is specified using `flags`, as follows: - :py:obj:`~.cudaGraphicsMapFlagsNone`: 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. - :py:obj:`~.cudaGraphicsMapFlagsReadOnly`: Specifies that CUDA will not write to this resource. - :py:obj:`~.cudaGraphicsMapFlagsWriteDiscard`: 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. :param vdpSurface: VDPAU object to be registered :type vdpSurface: :py:obj:`~.VdpOutputSurface` :param flags: Map flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` * **resource** (:py:obj:`~.cudaGraphicsResource`) -- Pointer to the returned object handle .. seealso:: :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsVDPAURegisterOutputSurface`
EGL Interoperability#
This section describes the EGL interoperability functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaGraphicsEGLRegisterImage(image, unsigned int flags)#
Registers an EGL image. 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 :py:obj:`~.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: - :py:obj:`~.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. - :py:obj:`~.cudaGraphicsRegisterFlagsReadOnly`: Specifies that CUDA will not write to this resource. - :py:obj:`~.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 :param image: An EGLImageKHR image which can be used to create target resource. :type image: :py:obj:`~.EGLImageKHR` :param flags: Map flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` * **pCudaResource** (:py:obj:`~.cudaGraphicsResource`) -- Pointer to the returned object handle .. seealso:: :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame`, :py:obj:`~.cuGraphicsEGLRegisterImage`
- cuda.bindings.runtime.cudaEGLStreamConsumerConnect(eglStream)#
Connect CUDA to EGLStream as a consumer. Connect CUDA as a consumer to EGLStreamKHR specified by `eglStream`. The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one API to another. :param eglStream: EGLStreamKHR handle :type eglStream: :py:obj:`~.EGLStreamKHR` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` * **conn** (:py:obj:`~.cudaEglStreamConnection`) -- Pointer to the returned connection handle .. seealso:: :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerConnect`
- cuda.bindings.runtime.cudaEGLStreamConsumerConnectWithFlags(eglStream, unsigned int flags)#
Connect CUDA to EGLStream as a consumer with given flags. Connect CUDA as a consumer to EGLStreamKHR specified by `stream` with specified `flags` defined by :py:obj:`~.cudaEglResourceLocationFlags`. The flags specify whether the consumer wants to access frames from system memory or video memory. Default is :py:obj:`~.cudaEglResourceLocationVidmem`. :param eglStream: EGLStreamKHR handle :type eglStream: :py:obj:`~.EGLStreamKHR` :param flags: Flags denote intended location - system or video. :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` * **conn** (:py:obj:`~.cudaEglStreamConnection`) -- Pointer to the returned connection handle .. seealso:: :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerConnectWithFlags`
- cuda.bindings.runtime.cudaEGLStreamConsumerDisconnect(conn)#
Disconnect CUDA as a consumer to EGLStream . Disconnect CUDA as a consumer to EGLStreamKHR. :param conn: Conection to disconnect. :type conn: :py:obj:`~.cudaEglStreamConnection` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerDisconnect`
- cuda.bindings.runtime.cudaEGLStreamConsumerAcquireFrame(
- conn,
- pCudaResource,
- pStream,
- unsigned int timeout,
Acquire an image frame from the EGLStream with CUDA as a consumer. Acquire an image frame from EGLStreamKHR. :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame` can be called on `pCudaResource` to get :py:obj:`~.cudaEglFrame`. :param conn: Connection on which to acquire :type conn: :py:obj:`~.cudaEglStreamConnection` :param pCudaResource: CUDA resource on which the EGLStream frame will be mapped for use. :type pCudaResource: :py:obj:`~.cudaGraphicsResource_t` :param pStream: CUDA stream for synchronization and any data migrations implied by :py:obj:`~.cudaEglResourceLocationFlags`. :type pStream: :py:obj:`~.cudaStream_t` :param timeout: Desired timeout in usec. :type timeout: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, :py:obj:`~.cudaErrorLaunchTimeout` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`
- cuda.bindings.runtime.cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream)#
Releases the last frame acquired from the EGLStream. Release the acquired image frame specified by `pCudaResource` to EGLStreamKHR. :param conn: Connection on which to release :type conn: :py:obj:`~.cudaEglStreamConnection` :param pCudaResource: CUDA resource whose corresponding frame is to be released :type pCudaResource: :py:obj:`~.cudaGraphicsResource_t` :param pStream: CUDA stream on which release will be done. :type pStream: :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`
- cuda.bindings.runtime.cudaEGLStreamProducerConnect(eglStream, width, height)#
Connect CUDA to EGLStream as a producer. Connect CUDA as a producer to EGLStreamKHR specified by `stream`. The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one API to another. :param eglStream: EGLStreamKHR handle :type eglStream: :py:obj:`~.EGLStreamKHR` :param width: width of the image to be submitted to the stream :type width: :py:obj:`~.EGLint` :param height: height of the image to be submitted to the stream :type height: :py:obj:`~.EGLint` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` * **conn** (:py:obj:`~.cudaEglStreamConnection`) -- Pointer to the returned connection handle .. seealso:: :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerConnect`
- cuda.bindings.runtime.cudaEGLStreamProducerDisconnect(conn)#
Disconnect CUDA as a producer to EGLStream . Disconnect CUDA as a producer to EGLStreamKHR. :param conn: Conection to disconnect. :type conn: :py:obj:`~.cudaEglStreamConnection` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerDisconnect`
- cuda.bindings.runtime.cudaEGLStreamProducerPresentFrame(
- conn,
- cudaEglFrame eglframe: cudaEglFrame,
- pStream,
Present a CUDA eglFrame to the EGLStream with CUDA as a producer. The :py:obj:`~.cudaEglFrame` is defined as: **View CUDA Toolkit Documentation for a C++ code example** For :py:obj:`~.cudaEglFrame` of type :py:obj:`~.cudaEglFrameTypePitch`, the application may present sub-region of a memory allocation. In that case, :py:obj:`~.cudaPitchedPtr.ptr` will specify the start address of the sub-region in the allocation and :py:obj:`~.cudaEglPlaneDesc` will specify the dimensions of the sub-region. :param conn: Connection on which to present the CUDA array :type conn: :py:obj:`~.cudaEglStreamConnection` :param eglframe: CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream. :type eglframe: :py:obj:`~.cudaEglFrame` :param pStream: CUDA stream on which to present the frame. :type pStream: :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerPresentFrame`
- cuda.bindings.runtime.cudaEGLStreamProducerReturnFrame(conn, cudaEglFrame eglframe: Optional[cudaEglFrame], pStream)#
Return the CUDA eglFrame to the EGLStream last released by the consumer. 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. :param conn: Connection on which to present the CUDA array :type conn: :py:obj:`~.cudaEglStreamConnection` :param eglframe: CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream. :type eglframe: :py:obj:`~.cudaEglFrame` :param pStream: CUDA stream on which to return the frame. :type pStream: :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLaunchTimeout`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cuEGLStreamProducerReturnFrame`
- cuda.bindings.runtime.cudaGraphicsResourceGetMappedEglFrame(
- resource,
- unsigned int index,
- unsigned int mipLevel,
Get an eglFrame through which to access a registered EGL graphics resource. 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 :py:obj:`~.cudaEglFrame` is defined as **View CUDA Toolkit Documentation for a C++ code example** :param resource: Registered resource to access. :type resource: :py:obj:`~.cudaGraphicsResource_t` :param index: Index for cubemap surfaces. :type index: unsigned int :param mipLevel: Mipmap level for the subresource to access. :type mipLevel: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown` * **eglFrame** (:py:obj:`~.cudaEglFrame`) -- Returned eglFrame. .. seealso:: :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsResourceGetMappedEglFrame` .. rubric:: Notes Note that in case of multiplanar `*eglFrame`, pitch of only first plane (unsigned int :py:obj:`~.cudaEglPlaneDesc.pitch`) is to be considered by the application.
- cuda.bindings.runtime.cudaEventCreateFromEGLSync(eglSync, unsigned int flags)#
Creates an event from EGLSync object. Creates an event *phEvent from an EGLSyncKHR eglSync with the flages specified via `flags`. Valid flags include: - :py:obj:`~.cudaEventDefault`: Default event creation flag. - :py:obj:`~.cudaEventBlockingSync`: Specifies that the created event should use blocking synchronization. A CPU thread that uses :py:obj:`~.cudaEventSynchronize()` to wait on an event created with this flag will block until the event has actually been completed. :py:obj:`~.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 :param eglSync: Opaque handle to EGLSync object :type eglSync: :py:obj:`~.EGLSyncKHR` :param flags: Event creation flags :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` * **phEvent** (:py:obj:`~.cudaEvent_t`) -- Returns newly created event .. seealso:: :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`
Graphics Interoperability#
This section describes the graphics interoperability functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaGraphicsUnregisterResource(resource)#
Unregisters a graphics resource for access by CUDA. Unregisters the graphics resource `resource` so it is not accessible by CUDA unless registered again. If `resource` is invalid then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. :param resource: Resource to unregister :type resource: :py:obj:`~.cudaGraphicsResource_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphicsD3D9RegisterResource`, :py:obj:`~.cudaGraphicsD3D10RegisterResource`, :py:obj:`~.cudaGraphicsD3D11RegisterResource`, :py:obj:`~.cudaGraphicsGLRegisterBuffer`, :py:obj:`~.cudaGraphicsGLRegisterImage`, :py:obj:`~.cuGraphicsUnregisterResource`
- cuda.bindings.runtime.cudaGraphicsResourceSetMapFlags(resource, unsigned int flags)#
Set usage flags for mapping a graphics resource. 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: - :py:obj:`~.cudaGraphicsMapFlagsNone`: Specifies no hints about how `resource` will be used. It is therefore assumed that CUDA may read from or write to `resource`. - :py:obj:`~.cudaGraphicsMapFlagsReadOnly`: Specifies that CUDA will not write to `resource`. - :py:obj:`~.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 :py:obj:`~.cudaErrorUnknown` is returned. If `flags` is not one of the above values then :py:obj:`~.cudaErrorInvalidValue` is returned. :param resource: Registered resource to set flags for :type resource: :py:obj:`~.cudaGraphicsResource_t` :param flags: Parameters for resource mapping :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsResourceSetMapFlags`
- cuda.bindings.runtime.cudaGraphicsMapResources(int count, resources, stream)#
Map graphics resources for access by CUDA. 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 :py:obj:`~.cudaGraphicsMapResources()` will complete before any subsequent CUDA work issued in `stream` begins. If `resources` contains any duplicate entries then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of `resources` are presently mapped for access by CUDA then :py:obj:`~.cudaErrorUnknown` is returned. :param count: Number of resources to map :type count: int :param resources: Resources to map for CUDA :type resources: :py:obj:`~.cudaGraphicsResource_t` :param stream: Stream for synchronization :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsUnmapResources`, :py:obj:`~.cuGraphicsMapResources`
- cuda.bindings.runtime.cudaGraphicsUnmapResources(int count, resources, stream)#
Unmap graphics resources. 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 :py:obj:`~.cudaGraphicsUnmapResources()` will complete before any subsequently issued graphics work begins. If `resources` contains any duplicate entries then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of `resources` are not presently mapped for access by CUDA then :py:obj:`~.cudaErrorUnknown` is returned. :param count: Number of resources to unmap :type count: int :param resources: Resources to unmap :type resources: :py:obj:`~.cudaGraphicsResource_t` :param stream: Stream for synchronization :type stream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`
- cuda.bindings.runtime.cudaGraphicsResourceGetMappedPointer(resource)#
Get an device pointer through which to access a mapped graphics resource. 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 :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not mapped then :py:obj:`~.cudaErrorUnknown` is returned. :param resource: None :type resource: :py:obj:`~.cudaGraphicsResource_t` :returns: * *cudaError_t* * **devPtr** (*Any*) -- None * **size** (*int*) -- None
- cuda.bindings.runtime.cudaGraphicsSubResourceGetMappedArray(
- resource,
- unsigned int arrayIndex,
- unsigned int mipLevel,
Get an array through which to access a subresource of a mapped graphics resource. 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 :py:obj:`~.cudaErrorUnknown` is returned. If `arrayIndex` is not a valid array index for `resource` then :py:obj:`~.cudaErrorInvalidValue` is returned. If `mipLevel` is not a valid mipmap level for `resource` then :py:obj:`~.cudaErrorInvalidValue` is returned. If `resource` is not mapped then :py:obj:`~.cudaErrorUnknown` is returned. :param resource: Mapped resource to access :type resource: :py:obj:`~.cudaGraphicsResource_t` :param arrayIndex: Array index for array textures or cubemap face index as defined by :py:obj:`~.cudaGraphicsCubeFace` for cubemap textures for the subresource to access :type arrayIndex: unsigned int :param mipLevel: Mipmap level for the subresource to access :type mipLevel: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` * **array** (:py:obj:`~.cudaArray_t`) -- Returned array through which a subresource of `resource` may be accessed .. seealso:: :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`
- cuda.bindings.runtime.cudaGraphicsResourceGetMappedMipmappedArray(resource)#
Get a mipmapped array through which to access a mapped graphics resource. 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 :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not mapped then :py:obj:`~.cudaErrorUnknown` is returned. :param resource: Mapped resource to access :type resource: :py:obj:`~.cudaGraphicsResource_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` * **mipmappedArray** (:py:obj:`~.cudaMipmappedArray_t`) -- Returned mipmapped array through which `resource` may be accessed .. seealso:: :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsResourceGetMappedMipmappedArray`
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.
- cuda.bindings.runtime.cudaGetChannelDesc(array)#
Get the channel descriptor of an array. Returns in `*desc` the channel descriptor of the CUDA array `array`. :param array: Memory array on device :type array: :py:obj:`~.cudaArray_const_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **desc** (:py:obj:`~.cudaChannelFormatDesc`) -- Channel format .. seealso:: :py:obj:`~.cudaCreateChannelDesc (C API)`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject`
- cuda.bindings.runtime.cudaCreateChannelDesc(
- int x,
- int y,
- int z,
- int w,
- f: cudaChannelFormatKind,
Returns a channel descriptor using the specified format. Returns a channel descriptor with format `f` and number of bits of each component `x`, `y`, `z`, and `w`. The :py:obj:`~.cudaChannelFormatDesc` is defined as: **View CUDA Toolkit Documentation for a C++ code example** where :py:obj:`~.cudaChannelFormatKind` is one of :py:obj:`~.cudaChannelFormatKindSigned`, :py:obj:`~.cudaChannelFormatKindUnsigned`, or :py:obj:`~.cudaChannelFormatKindFloat`. :param x: X component :type x: int :param y: Y component :type y: int :param z: Z component :type z: int :param w: W component :type w: int :param f: Channel format :type f: :py:obj:`~.cudaChannelFormatKind` :returns: * *cudaError_t.cudaSuccess* -- cudaError_t.cudaSuccess * :py:obj:`~.cudaChannelFormatDesc` -- Channel descriptor with format `f` .. seealso:: :obj:`cudaCreateChannelDesc`, :py:obj:`~.cudaGetChannelDesc`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject`
- cuda.bindings.runtime.cudaCreateTextureObject(cudaResourceDesc pResDesc: Optional[cudaResourceDesc], cudaTextureDesc pTexDesc: Optional[cudaTextureDesc], cudaResourceViewDesc pResViewDesc: Optional[cudaResourceViewDesc])#
Creates a texture object. 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 :py:obj:`~.cudaResourceDesc` structure is defined as: **View CUDA Toolkit Documentation for a C++ code example** where: - :py:obj:`~.cudaResourceDesc.resType` specifies the type of resource to texture from. CUresourceType is defined as: - **View CUDA Toolkit Documentation for a C++ code example** If :py:obj:`~.cudaResourceDesc.resType` is set to :py:obj:`~.cudaResourceTypeArray`, :py:obj:`~.cudaResourceDesc`::res::array::array must be set to a valid CUDA array handle. If :py:obj:`~.cudaResourceDesc.resType` is set to :py:obj:`~.cudaResourceTypeMipmappedArray`, :py:obj:`~.cudaResourceDesc`::res::mipmap::mipmap must be set to a valid CUDA mipmapped array handle and :py:obj:`~.cudaTextureDesc.normalizedCoords` must be set to true. If :py:obj:`~.cudaResourceDesc.resType` is set to :py:obj:`~.cudaResourceTypeLinear`, :py:obj:`~.cudaResourceDesc`::res::linear::devPtr must be set to a valid device pointer, that is aligned to :py:obj:`~.cudaDeviceProp.textureAlignment`. :py:obj:`~.cudaResourceDesc`::res::linear::desc describes the format and the number of components per array element. :py:obj:`~.cudaResourceDesc`::res::linear::sizeInBytes specifies the size of the array in bytes. The total number of elements in the linear address range cannot exceed :py:obj:`~.cudaDeviceGetTexture1DLinearMaxWidth()`. The number of elements is computed as (sizeInBytes / sizeof(desc)). If :py:obj:`~.cudaResourceDesc.resType` is set to :py:obj:`~.cudaResourceTypePitch2D`, :py:obj:`~.cudaResourceDesc`::res::pitch2D::devPtr must be set to a valid device pointer, that is aligned to :py:obj:`~.cudaDeviceProp.textureAlignment`. :py:obj:`~.cudaResourceDesc`::res::pitch2D::desc describes the format and the number of components per array element. :py:obj:`~.cudaResourceDesc`::res::pitch2D::width and :py:obj:`~.cudaResourceDesc`::res::pitch2D::height specify the width and height of the array in elements, and cannot exceed :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[0] and :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[1] respectively. :py:obj:`~.cudaResourceDesc`::res::pitch2D::pitchInBytes specifies the pitch between two rows in bytes and has to be aligned to :py:obj:`~.cudaDeviceProp.texturePitchAlignment`. Pitch cannot exceed :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[2]. The :py:obj:`~.cudaTextureDesc` struct is defined as **View CUDA Toolkit Documentation for a C++ code example** where - :py:obj:`~.cudaTextureDesc.addressMode` specifies the addressing mode for each dimension of the texture data. :py:obj:`~.cudaTextureAddressMode` is defined as: - **View CUDA Toolkit Documentation for a C++ code example** - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is :py:obj:`~.cudaResourceTypeLinear`. Also, if :py:obj:`~.cudaTextureDesc.normalizedCoords` is set to zero, :py:obj:`~.cudaAddressModeWrap` and :py:obj:`~.cudaAddressModeMirror` won't be supported and will be switched to :py:obj:`~.cudaAddressModeClamp`. - :py:obj:`~.cudaTextureDesc.filterMode` specifies the filtering mode to be used when fetching from the texture. :py:obj:`~.cudaTextureFilterMode` is defined as: - **View CUDA Toolkit Documentation for a C++ code example** - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is :py:obj:`~.cudaResourceTypeLinear`. - :py:obj:`~.cudaTextureDesc.readMode` specifies whether integer data should be converted to floating point or not. :py:obj:`~.cudaTextureReadMode` is defined as: - **View CUDA Toolkit Documentation for a C++ code example** - 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 :py:obj:`~.cudaTextureDesc.readMode` is set :py:obj:`~.cudaReadModeNormalizedFloat` is specified. - :py:obj:`~.cudaTextureDesc.sRGB` specifies whether sRGB to linear conversion should be performed during texture fetch. - :py:obj:`~.cudaTextureDesc.borderColor` specifies the float values of color. where: :py:obj:`~.cudaTextureDesc.borderColor`[0] contains value of 'R', :py:obj:`~.cudaTextureDesc.borderColor`[1] contains value of 'G', :py:obj:`~.cudaTextureDesc.borderColor`[2] contains value of 'B', :py:obj:`~.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 :py:obj:`~.cudaTextureDesc.addressMode` is cudaAddressModeBorder. - :py:obj:`~.cudaTextureDesc.normalizedCoords` specifies whether the texture coordinates will be normalized or not. - :py:obj:`~.cudaTextureDesc.maxAnisotropy` specifies the maximum anistropy ratio to be used when doing anisotropic filtering. This value will be clamped to the range [1,16]. - :py:obj:`~.cudaTextureDesc.mipmapFilterMode` specifies the filter mode when the calculated mipmap level lies between two defined mipmap levels. - :py:obj:`~.cudaTextureDesc.mipmapLevelBias` specifies the offset to be applied to the calculated mipmap level. - :py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` specifies the lower end of the mipmap level range to clamp access to. - :py:obj:`~.cudaTextureDesc.maxMipmapLevelClamp` specifies the upper end of the mipmap level range to clamp access to. - :py:obj:`~.cudaTextureDesc.disableTrilinearOptimization` specifies whether the trilinear filtering optimizations will be disabled. - :py:obj:`~.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 :py:obj:`~.cudaArrayCubemap`. When seamless cube map filtering is enabled, texture address modes specified by :py:obj:`~.cudaTextureDesc.addressMode` are ignored. Instead, if the :py:obj:`~.cudaTextureDesc.filterMode` is set to :py:obj:`~.cudaFilterModePoint` the address mode :py:obj:`~.cudaAddressModeClamp` will be applied for all dimensions. If the :py:obj:`~.cudaTextureDesc.filterMode` is set to :py:obj:`~.cudaFilterModeLinear` seamless cube map filtering will be performed when sampling along the cube face borders. The :py:obj:`~.cudaResourceViewDesc` struct is defined as **View CUDA Toolkit Documentation for a C++ code example** where: - :py:obj:`~.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 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. - :py:obj:`~.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. - :py:obj:`~.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. - :py:obj:`~.cudaResourceViewDesc.depth` specifies the new depth of the texture data. This value has to be equal to that of the original resource. - :py:obj:`~.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.:py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` and :py:obj:`~.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. - :py:obj:`~.cudaResourceViewDesc.lastMipmapLevel` specifies the least detailed mipmap level. For non-mipmapped resources, this value has to be zero. - :py:obj:`~.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. - :py:obj:`~.cudaResourceViewDesc.lastLayer` specifies the last layer index for layered textures. For non-layered resources, this value has to be zero. :param pResDesc: Resource descriptor :type pResDesc: :py:obj:`~.cudaResourceDesc` :param pTexDesc: Texture descriptor :type pTexDesc: :py:obj:`~.cudaTextureDesc` :param pResViewDesc: Resource view descriptor :type pResViewDesc: :py:obj:`~.cudaResourceViewDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pTexObject** (:py:obj:`~.cudaTextureObject_t`) -- Texture object to create .. seealso:: :py:obj:`~.cudaDestroyTextureObject`, :py:obj:`~.cuTexObjectCreate`
- cuda.bindings.runtime.cudaDestroyTextureObject(texObject)#
Destroys a texture object. Destroys the texture object specified by `texObject`. :param texObject: Texture object to destroy :type texObject: :py:obj:`~.cudaTextureObject_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectDestroy`
- cuda.bindings.runtime.cudaGetTextureObjectResourceDesc(texObject)#
Returns a texture object's resource descriptor. Returns the resource descriptor for the texture object specified by `texObject`. :param texObject: Texture object :type texObject: :py:obj:`~.cudaTextureObject_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pResDesc** (:py:obj:`~.cudaResourceDesc`) -- Resource descriptor .. seealso:: :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceDesc`
- cuda.bindings.runtime.cudaGetTextureObjectTextureDesc(texObject)#
Returns a texture object's texture descriptor. Returns the texture descriptor for the texture object specified by `texObject`. :param texObject: Texture object :type texObject: :py:obj:`~.cudaTextureObject_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pTexDesc** (:py:obj:`~.cudaTextureDesc`) -- Texture descriptor .. seealso:: :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetTextureDesc`
- cuda.bindings.runtime.cudaGetTextureObjectResourceViewDesc(texObject)#
Returns a texture object's resource view descriptor. Returns the resource view descriptor for the texture object specified by `texObject`. If no resource view was specified, :py:obj:`~.cudaErrorInvalidValue` is returned. :param texObject: Texture object :type texObject: :py:obj:`~.cudaTextureObject_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pResViewDesc** (:py:obj:`~.cudaResourceViewDesc`) -- Resource view descriptor .. seealso:: :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceViewDesc`
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.
- cuda.bindings.runtime.cudaCreateSurfaceObject(cudaResourceDesc pResDesc: Optional[cudaResourceDesc])#
Creates a surface object. Creates a surface object and returns it in `pSurfObject`. `pResDesc` describes the data to perform surface load/stores on. :py:obj:`~.cudaResourceDesc.resType` must be :py:obj:`~.cudaResourceTypeArray` and :py:obj:`~.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. :param pResDesc: Resource descriptor :type pResDesc: :py:obj:`~.cudaResourceDesc` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidChannelDescriptor`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **pSurfObject** (:py:obj:`~.cudaSurfaceObject_t`) -- Surface object to create .. seealso:: :py:obj:`~.cudaDestroySurfaceObject`, :py:obj:`~.cuSurfObjectCreate`
- cuda.bindings.runtime.cudaDestroySurfaceObject(surfObject)#
Destroys a surface object. Destroys the surface object specified by `surfObject`. :param surfObject: Surface object to destroy :type surfObject: :py:obj:`~.cudaSurfaceObject_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectDestroy`
- cuda.bindings.runtime.cudaGetSurfaceObjectResourceDesc(surfObject)#
Returns a surface object's resource descriptor Returns the resource descriptor for the surface object specified by `surfObject`. :param surfObject: Surface object :type surfObject: :py:obj:`~.cudaSurfaceObject_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pResDesc** (:py:obj:`~.cudaResourceDesc`) -- Resource descriptor .. seealso:: :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectGetResourceDesc`
Version Management#
- cuda.bindings.runtime.cudaDriverGetVersion()#
Returns the latest version of CUDA supported by the driver. 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 :py:obj:`~.cudaErrorInvalidValue` if `driverVersion` is NULL. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **driverVersion** (*int*) -- Returns the CUDA driver version. .. seealso:: :py:obj:`~.cudaRuntimeGetVersion`, :py:obj:`~.cuDriverGetVersion`
- cuda.bindings.runtime.cudaRuntimeGetVersion()#
Returns the CUDA Runtime version. 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 :py:obj:`~.cudaErrorInvalidValue` if the `runtimeVersion` argument is NULL. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **runtimeVersion** (*int*) -- Returns the CUDA Runtime version. .. seealso:: :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cuDriverGetVersion`
- cuda.bindings.runtime.getLocalRuntimeVersion()#
Returns the CUDA Runtime version of local shared library. 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 :py:obj:`~.cudaErrorInvalidValue` if the `runtimeVersion` argument is NULL. :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **runtimeVersion** (*int*) -- Returns the CUDA Runtime version. .. seealso:: :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cuDriverGetVersion`
Error Log Management Functions#
This section describes the error log management functions of the CUDA runtime application programming interface. The Error Log Management interface will operate on both the CUDA Driver and CUDA Runtime.
- class cuda.bindings.runtime.cudaLogsCallback_t(*args, **kwargs)#
Get memory address of class instance
- cuda.bindings.runtime.cudaLogsRegisterCallback(callbackFunc, userData)#
Register a callback function to receive error log messages. :param callbackFunc: The function to register as a callback :type callbackFunc: :py:obj:`~.cudaLogsCallback_t` :param userData: A generic pointer to user data. This is passed into the callback function. :type userData: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, * **callback_out** (:py:obj:`~.cudaLogsCallbackHandle`) -- Optional location to store the callback handle after it is registered
- cuda.bindings.runtime.cudaLogsUnregisterCallback(callback)#
Unregister a log message callback. :param callback: The callback instance to unregister from receiving log messages :type callback: :py:obj:`~.cudaLogsCallbackHandle` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t
- cuda.bindings.runtime.cudaLogsCurrent(unsigned int flags)#
Sets log iterator to point to the end of log buffer, where the next message would be written. :param flags: Reserved for future use, must be 0 :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, * **iterator_out** (:py:obj:`~.cudaLogIterator`) -- Location to store an iterator to the current tail of the logs
- cuda.bindings.runtime.cudaLogsDumpToFile(cudaLogIterator iterator: Optional[cudaLogIterator], char *pathToFile, unsigned int flags)#
Dump accumulated driver logs into a file. Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps all driver logs starting from `iterator` into `pathToFile` provided. :param iterator: Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs. :type iterator: :py:obj:`~.cudaLogIterator` :param pathToFile: Path to output file for dumping logs :type pathToFile: bytes :param flags: Reserved for future use, must be 0 :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, * **iterator** (:py:obj:`~.cudaLogIterator`) -- Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs. .. rubric:: Notes `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. The driver reserves limited memory for storing logs. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk.
- cuda.bindings.runtime.cudaLogsDumpToMemory(cudaLogIterator iterator: Optional[cudaLogIterator], char *buffer, size_t size, unsigned int flags)#
Dump accumulated driver logs into a buffer. Logs generated by the driver are stored in an internal buffer and can be copied out using this API. This API dumps driver logs from `iterator` into `buffer` up to the size specified in `*size`. The driver will always null terminate the buffer but there will not be a null character between log entries, only a newline . The driver will then return the actual number of bytes written in `*size`, excluding the null terminator. If there are no messages to dump, `*size` will be set to 0 and the function will return :py:obj:`~.CUDA_SUCCESS`. If the provided `buffer` is not large enough to hold any messages, `*size` will be set to 0 and the function will return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. Parameters ---------- iterator : :py:obj:`~.cudaLogIterator` Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs. buffer : bytes Pointer to dump logs size : int See description flags : unsigned int Reserved for future use, must be 0 Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, iterator : :py:obj:`~.cudaLogIterator` Optional auto-advancing iterator specifying the starting log to read. NULL value dumps all logs. size : int See description Notes ----- `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. The driver reserves limited memory for storing logs. The maximum size of the buffer is 25600 bytes. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk. If the provided value in `*size` is not large enough to hold all buffered messages, a message will be added at the head of the buffer indicating this. The driver then computes the number of messages it is able to store in `buffer` and writes it out. The final message in `buffer` will always be the most recent log message as of when the API is called.
Graph Management#
This section describes the graph management functions of CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaGraphCreate(unsigned int flags)#
Creates a graph. Creates an empty graph, which is returned via `pGraph`. :param flags: Graph creation flags, must be 0 :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **pGraph** (:py:obj:`~.cudaGraph_t`) -- Returns newly created graph .. seealso:: :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphDestroy`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphClone`
- cuda.bindings.runtime.cudaGraphAddKernelNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, cudaKernelNodeParams pNodeParams: Optional[cudaKernelNodeParams])#
Creates a kernel execution node and adds it to a graph. 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 :py:obj:`~.cudaKernelNodeParams` structure is defined as: **View CUDA Toolkit Documentation for a C++ code example** 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. - :py:obj:`~.CU_LAUNCH_PARAM_END`, which indicates the end of the `extra` array; - :py:obj:`~.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`; - :py:obj:`~.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 :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`; The error :py:obj:`~.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. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param numDependencies: Number of dependencies :type numDependencies: size_t :param pNodeParams: Parameters for the GPU execution node :type pNodeParams: :py:obj:`~.cudaKernelNodeParams` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` .. rubric:: Notes 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.
- cuda.bindings.runtime.cudaGraphKernelNodeGetParams(node)#
Returns a kernel node's parameters. Returns the parameters of kernel node `node` in `pNodeParams`. The `kernelParams` or `extra` array returned in `pNodeParams`, as well as the argument values it points to, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not be modified directly. Use :py:obj:`~.cudaGraphKernelNodeSetParams` to update the parameters of this node. The params will contain either `kernelParams` or `extra`, according to which of these was most recently set on the node. :param node: Node to get the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` * **pNodeParams** (:py:obj:`~.cudaKernelNodeParams`) -- Pointer to return the parameters .. seealso:: :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams`
- cuda.bindings.runtime.cudaGraphKernelNodeSetParams(node, cudaKernelNodeParams pNodeParams: Optional[cudaKernelNodeParams])#
Sets a kernel node's parameters. Sets the parameters of kernel node `node` to `pNodeParams`. :param node: Node to set the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Parameters to copy :type pNodeParams: :py:obj:`~.cudaKernelNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorMemoryAllocation` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeGetParams`
- cuda.bindings.runtime.cudaGraphKernelNodeCopyAttributes(hDst, hSrc)#
Copies attributes from source node to destination node. Copies attributes from source node `hSrc` to destination node `hDst`. Both node must have the same context. :param hDst: Destination node :type hDst: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param hSrc: Source node For list of attributes see :py:obj:`~.cudaKernelNodeAttrID` :type hSrc: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidContext` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaGraphKernelNodeGetAttribute(hNode, attr: cudaKernelNodeAttrID)#
Queries node attribute. Queries attribute `attr` from node `hNode` and stores it in corresponding member of `value_out`. :param hNode: :type hNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param attr: :type attr: :py:obj:`~.cudaKernelNodeAttrID` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **value_out** (:py:obj:`~.cudaKernelNodeAttrValue`) .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaGraphKernelNodeSetAttribute(hNode, attr: cudaKernelNodeAttrID, cudaKernelNodeAttrValue value: Optional[cudaKernelNodeAttrValue])#
Sets node attribute. Sets attribute `attr` on node `hNode` from corresponding attribute of `value`. :param hNode: :type hNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param attr: :type attr: :py:obj:`~.cudaKernelNodeAttrID` :param value: :type value: :py:obj:`~.cudaKernelNodeAttrValue` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaAccessPolicyWindow`
- cuda.bindings.runtime.cudaGraphAddMemcpyNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, cudaMemcpy3DParms pCopyParams: Optional[cudaMemcpy3DParms])#
Creates a memcpy node and adds it to a graph. 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`. When the graph is launched, the node will perform the memcpy described by `pCopyParams`. See :py:obj:`~.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 :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param numDependencies: Number of dependencies :type numDependencies: size_t :param pCopyParams: Parameters for the memory copy :type pCopyParams: :py:obj:`~.cudaMemcpy3DParms` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNodeToSymbol`, :py:obj:`~.cudaGraphAddMemcpyNodeFromSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode`
- cuda.bindings.runtime.cudaGraphMemcpyNodeGetParams(node)#
Creates a memcpy node to copy to a symbol on the device and adds it to a graph. 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 areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.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 :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Creates a memcpy node to copy from a symbol on the device and adds it to a graph 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 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 :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.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 :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Creates a 1D memcpy node and adds it to a graph 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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.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 :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Returns a memcpy node's parameters Returns the parameters of memcpy node `node` in `pNodeParams`. :param pGraphNode: Returns newly created node :type pGraphNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **graph** (:py:obj:`~.cudaMemcpy3DParms`) -- Graph to which to add the node .. seealso:: :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNodeFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNodeToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`
- cuda.bindings.runtime.cudaGraphMemcpyNodeSetParams(node, cudaMemcpy3DParms pNodeParams: Optional[cudaMemcpy3DParms])#
Sets a memcpy node's parameters. Sets the parameters of memcpy node `node` to `pNodeParams`. :param node: Node to set the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Parameters to copy :type pNodeParams: :py:obj:`~.cudaMemcpy3DParms` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`
- cuda.bindings.runtime.cudaGraphAddMemsetNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, cudaMemsetParams pMemsetParams: Optional[cudaMemsetParams])#
Sets a memcpy node's parameters to copy to a symbol on the device. Sets the parameters of memcpy node `node` to the copy described by the provided parameters. 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 areas may not overlap. `symbol` is a variable that resides in global or constant memory space. `kind` can be either :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. Sets a memcpy node's parameters to copy from a symbol on the device Sets the parameters of memcpy node `node` to the copy described by the provided parameters. 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 :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. Sets a memcpy node's parameters to perform a 1-dimensional copy Sets the parameters of memcpy node `node` to the copy described by the provided parameters. 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 :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.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. Creates a memset node and adds it to a graph 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`. :param symbol: Device symbol address :type symbol: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param src: Source memory address :type src: list[:py:obj:`~.cudaGraphNode_t`] :param count: Size in bytes to copy :type count: size_t :param offset: Offset from start of symbol in bytes :type offset: :py:obj:`~.cudaMemsetParams` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` * **node** (:py:obj:`~.cudaGraphNode_t`) -- Node to set the parameters for .. seealso:: :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`
- cuda.bindings.runtime.cudaGraphMemsetNodeGetParams(node)#
Returns a memset node's parameters. Returns the parameters of memset node `node` in `pNodeParams`. :param node: Node to get the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pNodeParams** (:py:obj:`~.cudaMemsetParams`) -- Pointer to return the parameters .. seealso:: :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams`
- cuda.bindings.runtime.cudaGraphMemsetNodeSetParams(node, cudaMemsetParams pNodeParams: Optional[cudaMemsetParams])#
Sets a memset node's parameters. Sets the parameters of memset node `node` to `pNodeParams`. :param node: Node to set the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Parameters to copy :type pNodeParams: :py:obj:`~.cudaMemsetParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeGetParams`
- cuda.bindings.runtime.cudaGraphAddHostNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, cudaHostNodeParams pNodeParams: Optional[cudaHostNodeParams])#
Creates a host execution node and adds it to a graph. 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. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param numDependencies: Number of dependencies :type numDependencies: size_t :param pNodeParams: Parameters for the host node :type pNodeParams: :py:obj:`~.cudaHostNodeParams` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`
- cuda.bindings.runtime.cudaGraphHostNodeGetParams(node)#
Returns a host node's parameters. Returns the parameters of host node `node` in `pNodeParams`. :param node: Node to get the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pNodeParams** (:py:obj:`~.cudaHostNodeParams`) -- Pointer to return the parameters .. seealso:: :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams`
- cuda.bindings.runtime.cudaGraphHostNodeSetParams(node, cudaHostNodeParams pNodeParams: Optional[cudaHostNodeParams])#
Sets a host node's parameters. Sets the parameters of host node `node` to `nodeParams`. :param node: Node to set the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Parameters to copy :type pNodeParams: :py:obj:`~.cudaHostNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeGetParams`
- cuda.bindings.runtime.cudaGraphAddChildGraphNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, childGraph)#
Creates a child graph node and adds it to a graph. Creates a new node which executes an embedded graph, 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`. 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. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param numDependencies: Number of dependencies :type numDependencies: size_t :param childGraph: The graph to clone into this node :type childGraph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphClone`
- cuda.bindings.runtime.cudaGraphChildGraphNodeGetGraph(node)#
Gets a handle to the embedded graph of a child graph node. 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. :param node: Node to get the embedded graph for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraph** (:py:obj:`~.cudaGraph_t`) -- Location to store a handle to the graph .. seealso:: :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphNodeFindInClone`
- cuda.bindings.runtime.cudaGraphAddEmptyNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies)#
Creates an empty node and adds it to a graph. 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. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param numDependencies: Number of dependencies :type numDependencies: size_t :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`
- cuda.bindings.runtime.cudaGraphClone(originalGraph)#
Creates an event record node and adds it to a graph. 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. Returns the event associated with an event record node Returns the event of event record node `hNode` in `event_out`. Sets an event record node's event Sets the event of event record node `hNode` to `event`. Creates an event wait node and adds it to a graph 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 :py:obj:`~.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. Returns the event associated with an event wait node Returns the event of event wait node `hNode` in `event_out`. Sets an event wait node's event Sets the event of event wait node `hNode` to `event`. Creates an external semaphore signal node and adds it to a graph 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. `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. Returns an external semaphore signal node's parameters Returns the parameters of an external semaphore signal node `hNode` in `params_out`. The `extSemArray` and `paramsArray` returned in `params_out`, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not be modified directly. Use :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update the parameters of this node. Sets an external semaphore signal node's parameters Sets the parameters of an external semaphore signal node `hNode` to `nodeParams`. Creates an external semaphore wait node and adds it to a graph 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. Returns an external semaphore wait node's parameters Returns the parameters of an external semaphore wait node `hNode` in `params_out`. The `extSemArray` and `paramsArray` returned in `params_out`, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not be modified directly. Use :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update the parameters of this node. Sets an external semaphore wait node's parameters Sets the parameters of an external semaphore wait node `hNode` to `nodeParams`. Creates an allocation node and adds it to a graph 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 :py:obj:`~.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 :py:obj:`~.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 :py:obj:`~.cudaMemFreeAsync` or :py:obj:`~.cudaMemFree`; - launching a graph with a free node for that allocation; or - specifying :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch` during instantiation, which makes each launch behave as though it called :py:obj:`~.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. Returns a memory alloc node's parameters Returns the parameters of a memory alloc node `hNode` in `params_out`. The `poolProps` and `accessDescs` returned in `params_out`, are owned by the node. This memory remains valid until the node is destroyed. The returned parameters must not be modified. Creates a memory free node and adds it to a graph 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`. :py:obj:`~.cudaGraphAddMemFreeNode` will return :py:obj:`~.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. Returns a memory free node's parameters Returns the address of a memory free node `hNode` in `dptr_out`. Free unused memory that was cached on the specified device for use with graphs back to the OS. 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. Query asynchronous allocation attributes related to graphs Valid attributes are: - :py:obj:`~.cudaGraphMemAttrUsedMemCurrent`: Amount of memory, in bytes, currently associated with graphs - :py:obj:`~.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. - :py:obj:`~.cudaGraphMemAttrReservedMemCurrent`: Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. Set asynchronous allocation attributes related to graphs Valid attributes are: - :py:obj:`~.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. - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. Clones a graph 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. Child graph nodes in the original graph are recursively copied into the clone. :param hGraph: Graph to which to add the node :type hGraph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` * **phGraphNode** (:py:obj:`~.cudaGraph_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemAllocNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeFindInClone` .. rubric:: Notes : Cloning is not supported for graphs which contain memory allocation nodes, memory free nodes, or conditional nodes.
- cuda.bindings.runtime.cudaGraphNodeFindInClone(originalNode, clonedGraph)#
Finds a cloned version of a node. This function returns the node in `clonedGraph` corresponding to `originalNode` in the original graph. `clonedGraph` must have been cloned from `originalGraph` via :py:obj:`~.cudaGraphClone`. `originalNode` must have been in `originalGraph` at the time of the call to :py:obj:`~.cudaGraphClone`, and the corresponding cloned node in `clonedGraph` must not have been removed. The cloned node is then returned via `pClonedNode`. :param originalNode: Handle to the original node :type originalNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param clonedGraph: Cloned graph to query :type clonedGraph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns handle to the cloned node .. seealso:: :py:obj:`~.cudaGraphClone`
- cuda.bindings.runtime.cudaGraphNodeGetType(node)#
Returns a node's type. Returns the node type of `node` in `pType`. :param node: Node to query :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pType** (:py:obj:`~.cudaGraphNodeType`) -- Pointer to return the node type .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams`
- cuda.bindings.runtime.cudaGraphNodeGetContainingGraph(hNode)#
Returns the graph that contains a given graph node. Returns the graph that contains `hNode` in `*phGraph`. If hNode is in a child graph, the child graph it is in is returned. :param hNode: Node to query :type hNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` * **phGraph** (:py:obj:`~.cudaGraph_t`) -- Pointer to return the containing graph .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint`
- cuda.bindings.runtime.cudaGraphNodeGetLocalId(hNode)#
Returns the node id of a given graph node. Returns the node id of `hNode` in `*nodeId`. The nodeId matches that referenced by :py:obj:`~.cudaGraphDebugDotPrint`. The local nodeId and graphId together can uniquely identify the node. :param hNode: Node to query :type hNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` * **nodeId** (*unsigned int*) -- Pointer to return the nodeId .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint`
- cuda.bindings.runtime.cudaGraphNodeGetToolsId(hNode)#
Returns an id used by tools to identify a given node. :param hNode: Node to query :type hNode: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.cudaErrorInvalidValue` * **\*toolsNodeId** (*unsigned long long*) -- Pointer to return the id used by tools .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint`
- cuda.bindings.runtime.cudaGraphGetId(hGraph)#
Returns the id of a given graph. Returns the id of `hGraph` in `*graphId`. The value in `*graphId` matches that referenced by :py:obj:`~.cudaGraphDebugDotPrint`. :param hGraph: Graph to query :type hGraph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **graphId** (*unsigned int*) -- Pointer to return the graphId .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint`
- cuda.bindings.runtime.cudaGraphExecGetId(hGraphExec)#
Returns the id of a given graph exec. Returns the id of `hGraphExec` in `*graphId`. The value in `*graphId` matches that referenced by :py:obj:`~.cudaGraphDebugDotPrint`. :param hGraphExec: Graph to query :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **graphId** (*unsigned int*) -- Pointer to return the graphId .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint`
- cuda.bindings.runtime.cudaGraphGetNodes(graph, size_t numNodes=0)#
Returns a graph's nodes. Returns a list of `graph's` nodes. `nodes` may be NULL, in which case this function will return the number of nodes in `numNodes`. Otherwise, `numNodes` entries will be filled in. If `numNodes` is higher than the actual number of nodes, the remaining entries in `nodes` will be set to NULL, and the number of nodes actually obtained will be returned in `numNodes`. :param graph: Graph to query :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param numNodes: See description :type numNodes: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **nodes** (list[:py:obj:`~.cudaGraphNode_t`]) -- Pointer to return the nodes * **numNodes** (*int*) -- See description .. seealso:: :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes`
- cuda.bindings.runtime.cudaGraphGetRootNodes(graph, size_t pNumRootNodes=0)#
Returns a graph's root nodes. Returns a list of `graph's` root nodes. `pRootNodes` may be NULL, in which case this function will return the number of root nodes in `pNumRootNodes`. Otherwise, `pNumRootNodes` entries will be filled in. If `pNumRootNodes` is higher than the actual number of root nodes, the remaining entries in `pRootNodes` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumRootNodes`. :param graph: Graph to query :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pNumRootNodes: See description :type pNumRootNodes: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pRootNodes** (list[:py:obj:`~.cudaGraphNode_t`]) -- Pointer to return the root nodes * **pNumRootNodes** (*int*) -- See description .. seealso:: :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes`
- cuda.bindings.runtime.cudaGraphGetEdges(graph, size_t numEdges=0)#
Returns a graph's dependency edges. Returns a list of `graph's` dependency edges. Edges are returned via corresponding indices in `from`, `to` and `edgeData`; that is, the node in `to`[i] has a dependency on the node in `from`[i] with data `edgeData`[i]. `from` and `to` may both be NULL, in which case this function only returns the number of edges in `numEdges`. Otherwise, `numEdges` entries will be filled in. If `numEdges` is higher than the actual number of edges, the remaining entries in `from` and `to` will be set to NULL, and the number of edges actually returned will be written to `numEdges`. `edgeData` may alone be NULL, in which case the edges must all have default (zeroed) edge data. Attempting a losst query via NULL `edgeData` will result in :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL then `from` and `to` must be as well. :param graph: Graph to get the edges from :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param numEdges: See description :type numEdges: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` * **from** (list[:py:obj:`~.cudaGraphNode_t`]) -- Location to return edge endpoints * **to** (list[:py:obj:`~.cudaGraphNode_t`]) -- Location to return edge endpoints * **edgeData** (list[:py:obj:`~.cudaGraphEdgeData`]) -- Optional location to return edge data * **numEdges** (*int*) -- See description .. seealso:: :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes`
- cuda.bindings.runtime.cudaGraphNodeGetDependencies(node, size_t pNumDependencies=0)#
Returns a node's dependencies. Returns a list of `node's` dependencies. `pDependencies` may be NULL, in which case this function will return the number of dependencies in `pNumDependencies`. Otherwise, `pNumDependencies` entries will be filled in. If `pNumDependencies` is higher than the actual number of dependencies, the remaining entries in `pDependencies` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumDependencies`. Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then `pDependencies` must be as well. :param node: Node to query :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNumDependencies: See description :type pNumDependencies: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` * **pDependencies** (list[:py:obj:`~.cudaGraphNode_t`]) -- Pointer to return the dependencies * **edgeData** (list[:py:obj:`~.cudaGraphEdgeData`]) -- Optional array to return edge data for each dependency * **pNumDependencies** (*int*) -- See description .. seealso:: :py:obj:`~.cudaGraphNodeGetDependentNodes`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`
- cuda.bindings.runtime.cudaGraphNodeGetDependentNodes(node, size_t pNumDependentNodes=0)#
Returns a node's dependent nodes. Returns a list of `node's` dependent nodes. `pDependentNodes` may be NULL, in which case this function will return the number of dependent nodes in `pNumDependentNodes`. Otherwise, `pNumDependentNodes` entries will be filled in. If `pNumDependentNodes` is higher than the actual number of dependent nodes, the remaining entries in `pDependentNodes` will be set to NULL, and the number of nodes actually obtained will be returned in `pNumDependentNodes`. Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then `pDependentNodes` must be as well. :param node: Node to query :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNumDependentNodes: See description :type pNumDependentNodes: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` * **pDependentNodes** (list[:py:obj:`~.cudaGraphNode_t`]) -- Pointer to return the dependent nodes * **edgeData** (list[:py:obj:`~.cudaGraphEdgeData`]) -- Optional pointer to return edge data for dependent nodes * **pNumDependentNodes** (*int*) -- See description .. seealso:: :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`
- cuda.bindings.runtime.cudaGraphAddDependencies(graph, from_: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], to: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], edgeData: Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies)#
Adds dependency edges to a graph. 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. :param graph: Graph to which dependencies are added :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param from: Array of nodes that provide the dependencies :type from: list[:py:obj:`~.cudaGraphNode_t`] :param to: Array of dependent nodes :type to: list[:py:obj:`~.cudaGraphNode_t`] :param edgeData: Optional array of edge data. If NULL, default (zeroed) edge data is assumed. :type edgeData: list[:py:obj:`~.cudaGraphEdgeData`] :param numDependencies: Number of dependencies to be added :type numDependencies: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes`
- cuda.bindings.runtime.cudaGraphRemoveDependencies(graph, from_: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], to: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], edgeData: Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies)#
Removes dependency edges from a graph. The number of `pDependencies` to be removed 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 edge that does not exist in the graph, with data matching `edgeData`, results in an error. `edgeData` is nullable, which is equivalent to passing default (zeroed) data for each edge. :param graph: Graph from which to remove dependencies :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param from: Array of nodes that provide the dependencies :type from: list[:py:obj:`~.cudaGraphNode_t`] :param to: Array of dependent nodes :type to: list[:py:obj:`~.cudaGraphNode_t`] :param edgeData: Optional array of edge data. If NULL, edge data is assumed to be default (zeroed). :type edgeData: list[:py:obj:`~.cudaGraphEdgeData`] :param numDependencies: Number of dependencies to be removed :type numDependencies: size_t :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes`
- cuda.bindings.runtime.cudaGraphDestroyNode(node)#
Remove a node from the graph. 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. :param node: Node to remove :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`
- cuda.bindings.runtime.cudaGraphInstantiate(graph, unsigned long long flags)#
Creates an executable graph from a graph. Instantiates `graph` as an executable graph. The graph is validated for any structural constraints or intra-node constraints which were not previously validated. If instantiation is successful, a handle to the instantiated graph is returned in `pGraphExec`. The `flags` parameter controls the behavior of instantiation and subsequent graph launches. Valid flags are: - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before the graph is relaunched. - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures the graph for launch from the device. If this flag is passed, the executable graph handle returned can be used to launch the graph from both the host and device. This flag cannot be used in conjunction with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the graph to use the priorities from the per-node attributes rather than the priority of the launch stream during execution. Note that priorities are only available on kernel nodes, and are copied from stream priority during stream capture. If `graph` contains any allocation or free nodes, there can be at most one executable graph in existence for that graph at a time. An attempt to instantiate a second executable graph before destroying the first with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes. Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs: - The graph's nodes must reside on a single device. - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are outlined below. - Kernel nodes: - Use of CUDA Dynamic Parallelism is not permitted. - Cooperative launches are permitted as long as MPS is not in use. - Memcpy nodes: - Only copies involving device memory and/or pinned device-mapped host memory are permitted. - Copies involving CUDA arrays are not permitted. - Both operands must be accessible from the current device, and the current device must match the device of other nodes in the graph. If `graph` is not instantiated for launch on the device but contains kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result in an error. :param graph: Graph to instantiate :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param flags: Flags to control instantiation. See :py:obj:`~.CUgraphInstantiate_flags`. :type flags: unsigned long long :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphExec** (:py:obj:`~.cudaGraphExec_t`) -- Returns instantiated graph .. seealso:: :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy`
- cuda.bindings.runtime.cudaGraphInstantiateWithParams(graph, cudaGraphInstantiateParams instantiateParams: Optional[cudaGraphInstantiateParams])#
Creates an executable graph from a graph. Instantiates `graph` as an executable graph. The graph is validated for any structural constraints or intra-node constraints which were not previously validated. If instantiation is successful, a handle to the instantiated graph is returned in `pGraphExec`. The `flags` parameter controls the behavior of instantiation and subsequent graph launches. Valid flags are: - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before the graph is relaunched. - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures the graph for launch from the device. If this flag is passed, the executable graph handle returned can be used to launch the graph from both the host and device. This flag can only be used on platforms which support unified addressing. This flag cannot be used in conjunction with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the graph to use the priorities from the per-node attributes rather than the priority of the launch stream during execution. Note that priorities are only available on kernel nodes, and are copied from stream priority during stream capture. If `graph` contains any allocation or free nodes, there can be at most one executable graph in existence for that graph at a time. An attempt to instantiate a second executable graph before destroying the first with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes. If `graph` contains kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result in an error. Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs: - The graph's nodes must reside on a single device. - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are outlined below. - Kernel nodes: - Use of CUDA Dynamic Parallelism is not permitted. - Cooperative launches are permitted as long as MPS is not in use. - Memcpy nodes: - Only copies involving device memory and/or pinned device-mapped host memory are permitted. - Copies involving CUDA arrays are not permitted. - Both operands must be accessible from the current device, and the current device must match the device of other nodes in the graph. Creates an executable graph from a graph Instantiates `graph` as an executable graph according to the `instantiateParams` structure. The graph is validated for any structural constraints or intra-node constraints which were not previously validated. If instantiation is successful, a handle to the instantiated graph is returned in `pGraphExec`. `instantiateParams` controls the behavior of instantiation and subsequent graph launches, as well as returning more detailed information in the event of an error. :py:obj:`~.cudaGraphInstantiateParams` is defined as: **View CUDA Toolkit Documentation for a C++ code example** The `flags` field controls the behavior of instantiation and subsequent graph launches. Valid flags are: - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which configures a graph containing memory allocation nodes to automatically free any unfreed memory allocations before the graph is relaunched. - :py:obj:`~.cudaGraphInstantiateFlagUpload`, which will perform an upload of the graph into `uploadStream` once the graph has been instantiated. - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures the graph for launch from the device. If this flag is passed, the executable graph handle returned can be used to launch the graph from both the host and device. This flag can only be used on platforms which support unified addressing. This flag cannot be used in conjunction with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the graph to use the priorities from the per-node attributes rather than the priority of the launch stream during execution. Note that priorities are only available on kernel nodes, and are copied from stream priority during stream capture. If `graph` contains any allocation or free nodes, there can be at most one executable graph in existence for that graph at a time. An attempt to instantiate a second executable graph before destroying the first with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same also applies if `graph` contains any device-updatable kernel nodes. If `graph` contains kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result in an error. Graphs instantiated for launch on the device have additional restrictions which do not apply to host graphs: - The graph's nodes must reside on a single device. - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. Operation-specific restrictions are outlined below. - Kernel nodes: - Use of CUDA Dynamic Parallelism is not permitted. - Cooperative launches are permitted as long as MPS is not in use. - Memcpy nodes: - Only copies involving device memory and/or pinned device-mapped host memory are permitted. - Copies involving CUDA arrays are not permitted. - Both operands must be accessible from the current device, and the current device must match the device of other nodes in the graph. In the event of an error, the `result_out` and `errNode_out` fields will contain more information about the nature of the error. Possible error reporting includes: - :py:obj:`~.cudaGraphInstantiateError`, if passed an invalid value or if an unexpected error occurred which is described by the return value of the function. `errNode_out` will be set to NULL. - :py:obj:`~.cudaGraphInstantiateInvalidStructure`, if the graph structure is invalid. `errNode_out` will be set to one of the offending nodes. - :py:obj:`~.cudaGraphInstantiateNodeOperationNotSupported`, if the graph is instantiated for device launch but contains a node of an unsupported node type, or a node which performs unsupported operations, such as use of CUDA dynamic parallelism within a kernel node. `errNode_out` will be set to this node. - :py:obj:`~.cudaGraphInstantiateMultipleDevicesNotSupported`, if the graph is instantiated for device launch but a node’s device differs from that of another node. This error can also be returned if a graph is not instantiated for device launch and it contains kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices. `errNode_out` will be set to this node. If instantiation is successful, `result_out` will be set to :py:obj:`~.cudaGraphInstantiateSuccess`, and `hErrNode_out` will be set to NULL. :param graph: Graph to instantiate :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param flags: Flags to control instantiation. See :py:obj:`~.CUgraphInstantiate_flags`. :type flags: :py:obj:`~.cudaGraphInstantiateParams` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **pGraphExec** (:py:obj:`~.cudaGraphExec_t`) -- Returns instantiated graph .. seealso:: :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphExecDestroy`
- cuda.bindings.runtime.cudaGraphExecGetFlags(graphExec)#
Query the instantiation flags of an executable graph. Returns the flags that were passed to instantiation for the given executable graph. :py:obj:`~.cudaGraphInstantiateFlagUpload` will not be returned by this API as it does not affect the resulting executable graph. :param graphExec: The executable graph to query :type graphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **flags** (*unsigned long long*) -- Returns the instantiation flags .. seealso:: :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphInstantiateWithParams`
- cuda.bindings.runtime.cudaGraphExecKernelNodeSetParams(hGraphExec, node, cudaKernelNodeParams pNodeParams: Optional[cudaKernelNodeParams])#
Sets the parameters for a kernel node in the given graphExec. 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 :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which uses device-side :py:obj:`~.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. 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. :param hGraphExec: The executable graph in which to set the specified node :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: kernel node from the graph from which graphExec was instantiated :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Updated Parameters to set :type pNodeParams: :py:obj:`~.cudaKernelNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`
- cuda.bindings.runtime.cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, cudaMemcpy3DParms pNodeParams: Optional[cudaMemcpy3DParms])#
Sets the parameters for a memcpy node in the given graphExec. 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 source and destination memory in `pNodeParams` must be allocated from the same contexts as the original source and destination memory. Both the instantiation-time memory operands and the memory operands in `pNodeParams` must be 1-dimensional. Zero-length operations are not supported. 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. Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' mappings changed or either the original or new memory operands are multidimensional. :param hGraphExec: The executable graph in which to set the specified node :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: Memcpy node from the graph which was used to instantiate graphExec :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Updated Parameters to set :type pNodeParams: :py:obj:`~.cudaMemcpy3DParms` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`
- cuda.bindings.runtime.cudaGraphExecMemsetNodeSetParams(hGraphExec, node, cudaMemsetParams pNodeParams: Optional[cudaMemsetParams])#
Sets the parameters for a memcpy node in the given graphExec to copy to a symbol on the device. Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored. `src` and `symbol` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported. 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. Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' mappings changed or the original memory operands are multidimensional. Sets the parameters for a memcpy node in the given graphExec to copy from a symbol on the device Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored. `symbol` and `dst` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported. 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. Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' mappings changed or the original memory operands are multidimensional. Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional copy Updates the work represented by `node` in `hGraphExec` as though `node` had contained the given params at instantiation. `node` must remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from `node` are ignored. `src` and `dst` must be allocated from the same contexts as the original source and destination memory. The instantiation-time memory operands must be 1-dimensional. Zero-length operations are not supported. 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. Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' mappings changed or the original memory operands are multidimensional. Sets the parameters for a memset node in the given graphExec. 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. Zero sized operations are not supported. The new destination pointer in `pNodeParams` must be to the same kind of allocation as the original destination pointer and have the same context association and device mapping as the original destination pointer. Both the value and pointer address may be updated. Changing other aspects of the memset (width, height, element size or pitch) may cause the update to be rejected. Specifically, for 2d memsets, all dimension changes are rejected. For 1d memsets, changes in height are explicitly rejected and other changes are opportunistically allowed if the resulting work maps onto the work resources already allocated for the node. 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. :param hGraphExec: The executable graph in which to set the specified node :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: Memcpy node from the graph which was used to instantiate graphExec :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param symbol: Device symbol address :type symbol: :py:obj:`~.cudaMemsetParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNodeToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNodeFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`
- cuda.bindings.runtime.cudaGraphExecHostNodeSetParams(hGraphExec, node, cudaHostNodeParams pNodeParams: Optional[cudaHostNodeParams])#
Sets the parameters for a host node in the given graphExec. 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. :param hGraphExec: The executable graph in which to set the specified node :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: Host node from the graph which was used to instantiate graphExec :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param pNodeParams: Updated Parameters to set :type pNodeParams: :py:obj:`~.cudaHostNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`
- cuda.bindings.runtime.cudaGraphExecUpdate(hGraphExec, hGraph)#
Updates node parameters in the child graph node in the given graphExec. 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 :py:obj:`~.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. Sets the event for an event record node in the given graphExec 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. Sets the event for an event wait node in the given graphExec 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. Sets the parameters for an external semaphore signal node in the given graphExec 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. Sets the parameters for an external semaphore wait node in the given graphExec 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. Enables or disables the specified node in the given graphExec Sets `hNode` to be either enabled or disabled. Disabled nodes are functionally equivalent to empty nodes until they are reenabled. Existing node parameters are not affected by disabling/enabling the node. 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. Query whether a node in the given graphExec is enabled Sets isEnabled to 1 if `hNode` is enabled, or 0 if `hNode` is disabled. 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. Check whether an executable graph can be updated with a graph and perform the update if possible Updates the node parameters in the instantiated graph specified by `hGraphExec` with the node parameters in a topologically identical graph specified by `hGraph`. Limitations: - Kernel nodes: - The owning context 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. - A cooperative node cannot be updated to a non-cooperative node, and vice-versa. - If the graph was instantiated with cudaGraphInstantiateFlagUseNodePriority, the priority attribute cannot change. Equality is checked on the originally requested priority values, before they are clamped to the device's supported range. - If `hGraphExec` was not instantiated for device launch, a node whose function originally did not use device-side :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which uses device-side :py:obj:`~.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. - Neither `hGraph` nor `hGraphExec` may contain device-updatable kernel nodes. - Memset and memcpy nodes: - The CUDA device(s) to which the operand(s) was allocated/mapped cannot change. - The source/destination memory must be allocated from the same contexts as the original source/destination memory. - For 2d memsets, only address and assigned value may be updated. - For 1d memsets, updating dimensions is also allowed, but may fail if the resulting operation doesn't map onto the work resources already allocated for the node. - Additional memcpy node restrictions: - Changing either the source or destination memory type(i.e. CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY, etc.) is not supported. - Conditional nodes: - Changing node parameters is not supported. - Changing parameters of nodes within the conditional body graph is subject to the rules above. - Conditional handle flags and default values are updated as part of the graph update. Note: The API may add further restrictions in future releases. The return code should always be checked. cudaGraphExecUpdate sets the result member of `resultInfo` to cudaGraphExecUpdateErrorTopologyChanged under the following conditions: - The count of nodes directly in `hGraphExec` and `hGraph` differ, in which case resultInfo->errorNode is set to NULL. - `hGraph` has more exit nodes than `hGraph`, in which case resultInfo->errorNode is set to one of the exit nodes in hGraph. - A node in `hGraph` has a different number of dependencies than the node from `hGraphExec` it is paired with, in which case resultInfo->errorNode is set to the node from `hGraph`. - A node in `hGraph` has a dependency that does not match with the corresponding dependency of the paired node from `hGraphExec`. resultInfo->errorNode will be set to the node from `hGraph`. resultInfo->errorFromNode will be set to the mismatched dependency. The dependencies are paired based on edge order and a dependency does not match when the nodes are already paired based on other edges examined in the graph. cudaGraphExecUpdate sets `the` result member of `resultInfo` to: - cudaGraphExecUpdateError if passed an invalid value. - cudaGraphExecUpdateErrorTopologyChanged if the graph topology changed - cudaGraphExecUpdateErrorNodeTypeChanged if the type of a node changed, in which case `hErrorNode_out` is set to the node from `hGraph`. - cudaGraphExecUpdateErrorFunctionChanged if the function of a kernel node changed (CUDA driver < 11.2) - cudaGraphExecUpdateErrorUnsupportedFunctionChange if the func field of a kernel changed in an unsupported way(see note above), in which case `hErrorNode_out` is set to the node from `hGraph` - cudaGraphExecUpdateErrorParametersChanged if any parameters to a node changed in a way that is not supported, in which case `hErrorNode_out` is set to the node from `hGraph` - cudaGraphExecUpdateErrorAttributesChanged if any attributes of a node changed in a way that is not supported, in which case `hErrorNode_out` is set to the node from `hGraph` - cudaGraphExecUpdateErrorNotSupported if something about a node is unsupported, like the node's type or configuration, in which case `hErrorNode_out` is set to the node from `hGraph` If the update fails for a reason not listed above, the result member of `resultInfo` will be set to cudaGraphExecUpdateError. If the update succeeds, the result member will be set to cudaGraphExecUpdateSuccess. cudaGraphExecUpdate returns cudaSuccess when the updated was performed successfully. It returns cudaErrorGraphExecUpdateFailure if the graph update was not performed because it included changes which violated constraints specific to instantiated graph update. :param hGraphExec: The executable graph in which to set the specified node :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: Host node from the graph which was used to instantiate graphExec :type node: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorGraphExecUpdateFailure`, * **childGraph** (:py:obj:`~.cudaGraphExecUpdateResultInfo`) -- The graph supplying the updated parameters .. seealso:: :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphNodeGetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphNodeSetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiate` .. rubric:: Notes Currently only kernel, memset and memcpy nodes are supported. Currently only kernel, memset and memcpy nodes are supported.
- cuda.bindings.runtime.cudaGraphLaunch(graphExec, stream)#
Uploads an executable graph in a stream. Uploads `hGraphExec` to the device in `hStream` without executing it. Uploads of the same `hGraphExec` will be serialized. Each upload is ordered behind both any previous work in `hStream` and any previous launches of `hGraphExec`. Uses memory cached by `stream` to back the allocations owned by `graphExec`. Launches an executable graph in a stream Executes `graphExec` in `stream`. Only one instance of `graphExec` may be executing at a time. Each launch is ordered behind both any previous work in `stream` and any previous launches of `graphExec`. To execute a graph concurrently, it must be instantiated multiple times into multiple executable graphs. If any allocations created by `graphExec` remain unfreed (from a previous launch) and `graphExec` was not instantiated with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, the launch will fail with :py:obj:`~.cudaErrorInvalidValue`. :param hGraphExec: Executable graph to upload :type hGraphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param hStream: Stream in which to upload the graph :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphExecDestroy`
- cuda.bindings.runtime.cudaGraphExecDestroy(graphExec)#
Destroys an executable graph. Destroys the executable graph specified by `graphExec`. :param graphExec: Executable graph to destroy :type graphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`
- cuda.bindings.runtime.cudaGraphDestroy(graph)#
Destroys a graph. Destroys the graph specified by `graph`, as well as all of its nodes. :param graph: Graph to destroy :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaGraphDebugDotPrint(graph, char *path, unsigned int flags)#
Write a DOT file describing graph structure. 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. :param graph: The graph to create a DOT file from :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param path: The path to write the DOT file to :type path: bytes :param flags: Flags from cudaGraphDebugDotFlags for specifying which additional node information to write :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOperatingSystem` :rtype: cudaError_t
- cuda.bindings.runtime.cudaUserObjectCreate(
- ptr,
- destroy,
- unsigned int initialRefcount,
- unsigned int flags,
Create a user object. Create a user object with the specified destructor callback and initial reference count. The initial references are owned by the caller. Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they are executed by a shared internal thread. Another thread may be signaled to perform such actions, if it does not block forward progress of tasks scheduled through CUDA. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. :param ptr: The pointer to pass to the destroy function :type ptr: Any :param destroy: Callback to free the user object when it is no longer in use :type destroy: :py:obj:`~.cudaHostFn_t` :param initialRefcount: The initial refcount to create the object with, typically 1. The initial references are owned by the calling thread. :type initialRefcount: unsigned int :param flags: Currently it is required to pass :py:obj:`~.cudaUserObjectNoDestructorSync`, which is the only defined flag. This indicates that the destroy callback cannot be waited on by any CUDA API. Users requiring synchronization of the callback should signal its completion manually. :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` * **object_out** (:py:obj:`~.cudaUserObject_t`) -- Location to return the user object handle .. seealso:: :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaUserObjectRetain(object, unsigned int count)#
Retain a reference to a user object. Retains new references to a user object. The new references are owned by the caller. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. :param object: The object to retain :type object: :py:obj:`~.cudaUserObject_t` :param count: The number of references to retain, typically 1. Must be nonzero and not larger than INT_MAX. :type count: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaUserObjectRelease(object, unsigned int count)#
Release a reference to a user object. Releases user object references owned by the caller. The object's destructor is invoked if the reference count reaches zero. It is undefined behavior to release references not owned by the caller, or to use a user object handle after all references are released. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. :param object: The object to release :type object: :py:obj:`~.cudaUserObject_t` :param count: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX. :type count: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaGraphRetainUserObject(
- graph,
- object,
- unsigned int count,
- unsigned int flags,
Retain a reference to a user object from a graph. Creates or moves user object references that will be owned by a CUDA graph. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. :param graph: The graph to associate the reference with :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param object: The user object to retain a reference for :type object: :py:obj:`~.cudaUserObject_t` :param count: The number of references to add to the graph, typically 1. Must be nonzero and not larger than INT_MAX. :type count: unsigned int :param flags: The optional flag :py:obj:`~.cudaGraphUserObjectMove` transfers references from the calling thread, rather than create new references. Pass 0 to create new references. :type flags: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaUserObjectCreate` py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaGraphReleaseUserObject(graph, object, unsigned int count)#
Release a user object reference from a graph. Releases user object references owned by a graph. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. :param graph: The graph that will release the reference :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param object: The user object to release a reference for :type object: :py:obj:`~.cudaUserObject_t` :param count: The number of references to release, typically 1. Must be nonzero and not larger than INT_MAX. :type count: unsigned int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaUserObjectCreate` py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphCreate`
- cuda.bindings.runtime.cudaGraphAddNode(graph, pDependencies: Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData: Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, cudaGraphNodeParams nodeParams: Optional[cudaGraphNodeParams])#
Adds a node of arbitrary type to a graph. 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 `typename` 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`. :param graph: Graph to which to add the node :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param pDependencies: Dependencies of the node :type pDependencies: list[:py:obj:`~.cudaGraphNode_t`] :param dependencyData: Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies. :type dependencyData: list[:py:obj:`~.cudaGraphEdgeData`] :param numDependencies: Number of dependencies :type numDependencies: size_t :param nodeParams: Specification of the node :type nodeParams: :py:obj:`~.cudaGraphNodeParams` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` * **pGraphNode** (:py:obj:`~.cudaGraphNode_t`) -- Returns newly created node .. seealso:: :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphExecNodeSetParams`
- cuda.bindings.runtime.cudaGraphNodeSetParams(node, cudaGraphNodeParams nodeParams: Optional[cudaGraphNodeParams])#
Update a graph node's parameters. Sets the parameters of graph node `node` to `nodeParams`. The node type specified by `nodeParams->type` must match the type of `node`. `nodeParams` must be fully initialized and all unused bytes (reserved, padding) zeroed. Modifying parameters is not supported for node types cudaGraphNodeTypeMemAlloc and cudaGraphNodeTypeMemFree. :param node: Node to set the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param nodeParams: Parameters to copy :type nodeParams: :py:obj:`~.cudaGraphNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExecNodeSetParams`
- cuda.bindings.runtime.cudaGraphNodeGetParams(node)#
Returns a graph node's parameters. Returns the parameters of graph node `node` in `*nodeParams`. Any pointers returned in `*nodeParams` point to driver-owned memory associated with the node. This memory remains valid until the node is destroyed. Any memory pointed to from `*nodeParams` must not be modified. The returned parameters are a description of the node, but may not be identical to the struct provided at creation and may not be suitable for direct creation of identical nodes. This is because parameters may be partially unspecified and filled in by the driver at creation, may reference non-copyable handles, or may describe ownership semantics or other parameters that govern behavior of node creation but are not part of the final functional descriptor. :param node: Node to get the parameters for :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` * **nodeParams** (:py:obj:`~.cudaGraphNodeParams`) -- Pointer to return the parameters .. seealso:: :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExecNodeSetParams`
- cuda.bindings.runtime.cudaGraphExecNodeSetParams(graphExec, node, cudaGraphNodeParams nodeParams: Optional[cudaGraphNodeParams])#
Update a graph node's parameters in an instantiated graph. Sets the parameters of a node in an executable graph `graphExec`. 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. The modifications only affect future launches of `graphExec`. Already enqueued or running launches of `graphExec` are not affected by this call. `node` is also not modified by this call. Allowed changes to parameters on executable graphs are as follows: **View CUDA Toolkit Documentation for a table example** :param graphExec: The executable graph in which to update the specified node :type graphExec: :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` :param node: Corresponding node from the graph from which graphExec was instantiated :type node: :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` :param nodeParams: Updated Parameters to set :type nodeParams: :py:obj:`~.cudaGraphNodeParams` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphInstantiate`
- cuda.bindings.runtime.cudaGraphConditionalHandleCreate(
- graph,
- unsigned int defaultLaunchValue,
- unsigned int flags,
Create a conditional handle. Creates a conditional handle associated with `hGraph`. 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. :param graph: Graph which will contain the conditional node using this handle. :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param defaultLaunchValue: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if cudaGraphCondAssignDefault is set in `flags`. :type defaultLaunchValue: unsigned int :param flags: Currently must be cudaGraphCondAssignDefault or 0. :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` * **pHandle_out** (:py:obj:`~.cudaGraphConditionalHandle`) -- Pointer used to return the handle to the caller. .. seealso:: :py:obj:`~.cuGraphAddNode`
- cuda.bindings.runtime.cudaGraphConditionalHandleCreate_v2(
- graph,
- ctx,
- unsigned int defaultLaunchValue,
- unsigned int flags,
Create a conditional handle. Creates a conditional handle associated with `hGraph`. 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. :param graph: Graph which will contain the conditional node using this handle. :type graph: :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` :param ctx: Execution context for the handle and associated conditional node. If NULL, current context will be used. :type ctx: :py:obj:`~.cudaExecutionContext_t` :param defaultLaunchValue: Optional initial value for the conditional variable. Applied at the beginning of each graph execution if cudaGraphCondAssignDefault is set in `flags`. :type defaultLaunchValue: unsigned int :param flags: Currently must be cudaGraphCondAssignDefault or 0. :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` * **pHandle_out** (:py:obj:`~.cudaGraphConditionalHandle`) -- Pointer used to return the handle to the caller. .. seealso:: :py:obj:`~.cuGraphAddNode`
Driver Entry Point Access#
This section describes the driver entry point access functions of CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaGetDriverEntryPoint(char *symbol, unsigned long long flags)#
Returns the requested driver API function pointer. [Deprecated] Returns in `**funcPtr` the address of the CUDA driver function for the requested flags. For a requested driver symbol, if the CUDA version in which the driver symbol was introduced is less than or equal to the CUDA runtime version, the API will return the function pointer to the corresponding versioned driver function. The pointer returned by the API should be cast to a function pointer matching the requested driver function's definition in the API header file. The function pointer typedef can be picked up from the corresponding typedefs header file. For example, cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h. The API will return :py:obj:`~.cudaSuccess` and set the returned `funcPtr` if the requested driver function is valid and supported on the platform. The API will return :py:obj:`~.cudaSuccess` and set the returned `funcPtr` to NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the CUDA runtime version or if the driver symbol is invalid. It will also set the optional `driverStatus` to one of the values in :py:obj:`~.cudaDriverEntryPointQueryResult` with the following meanings: - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was succesfully found based on input arguments and `pfn` is valid - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol was not found - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested symbol was found but is not supported by the current runtime version (CUDART_VERSION) The requested flags can be: - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the code is compiled with --default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; :py:obj:`~.cudaEnableLegacyStream` otherwise. - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for all driver symbols that match the requested driver symbol name except the corresponding per-thread versions. - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the search for all driver symbols that match the requested driver symbol name including the per-thread versions. If a per-thread version is not found, the API will return the legacy version of the driver function. :param symbol: The base name of the driver API function to look for. As an example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` would be cuMemAlloc. Note that the API will use the CUDA runtime version to return the address to the most recent ABI compatible driver symbol, :py:obj:`~.cuMemAlloc` or :py:obj:`~.cuMemAlloc_v2`. :type symbol: bytes :param flags: Flags to specify search options. :type flags: unsigned long long :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` * **funcPtr** (*Any*) -- Location to return the function pointer to the requested driver function * **driverStatus** (:py:obj:`~.cudaDriverEntryPointQueryResult`) -- Optional location to store the status of finding the symbol from the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for possible values. .. seealso:: :py:obj:`~.cuGetProcAddress` .. rubric:: Notes This API is deprecated and :py:obj:`~.cudaGetDriverEntryPointByVersion` (with a hardcoded :py:obj:`~.cudaVersion`) should be used instead.
- cuda.bindings.runtime.cudaGetDriverEntryPointByVersion(
- char *symbol,
- unsigned int cudaVersion,
- unsigned long long flags,
Returns the requested driver API function pointer by CUDA version. Returns in `**funcPtr` the address of the CUDA driver function for the requested flags and CUDA driver version. The CUDA version is specified as (1000 * major + 10 * minor), so CUDA 11.2 should be specified as 11020. For a requested driver symbol, if the specified CUDA version is greater than or equal to the CUDA version in which the driver symbol was introduced, this API will return the function pointer to the corresponding versioned function. If the specified CUDA version is greater than the driver version, the API will return :py:obj:`~.cudaErrorInvalidValue`. The pointer returned by the API should be cast to a function pointer matching the requested driver function's definition in the API header file. The function pointer typedef can be picked up from the corresponding typedefs header file. For example, cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h. For the case where the CUDA version requested is greater than the CUDA Toolkit installed, there may not be an appropriate function pointer typedef in the corresponding header file and may need a custom typedef to match the driver function signature returned. This can be done by getting the typedefs from a later toolkit or creating appropriately matching custom function typedefs. The API will return :py:obj:`~.cudaSuccess` and set the returned `funcPtr` if the requested driver function is valid and supported on the platform. The API will return :py:obj:`~.cudaSuccess` and set the returned `funcPtr` to NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the requested version or if the driver symbol is invalid. It will also set the optional `driverStatus` to one of the values in :py:obj:`~.cudaDriverEntryPointQueryResult` with the following meanings: - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was succesfully found based on input arguments and `pfn` is valid - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol was not found - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested symbol was found but is not supported by the specified version `cudaVersion` The requested flags can be: - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the code is compiled with --default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; :py:obj:`~.cudaEnableLegacyStream` otherwise. - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for all driver symbols that match the requested driver symbol name except the corresponding per-thread versions. - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the search for all driver symbols that match the requested driver symbol name including the per-thread versions. If a per-thread version is not found, the API will return the legacy version of the driver function. :param symbol: The base name of the driver API function to look for. As an example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` would be cuMemAlloc. :type symbol: bytes :param cudaVersion: The CUDA version to look for the requested driver symbol :type cudaVersion: unsigned int :param flags: Flags to specify search options. :type flags: unsigned long long :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` * **funcPtr** (*Any*) -- Location to return the function pointer to the requested driver function * **driverStatus** (:py:obj:`~.cudaDriverEntryPointQueryResult`) -- Optional location to store the status of finding the symbol from the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for possible values. .. seealso:: :py:obj:`~.cuGetProcAddress`
Library Management#
This section describes the library management functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaLibraryLoadData(code, jitOptions: Optional[tuple[cudaJitOption] | list[cudaJitOption]], jitOptionsValues: Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions: Optional[tuple[cudaLibraryOption] | list[cudaLibraryOption]], libraryOptionValues: Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions)#
Load a library with specified code and options. Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode: - If module loading is set to EAGER, via the environment variables described in "Module loading", `library` is loaded eagerly into all contexts at the time of the call and future contexts at the time of creation until the library is unloaded with :py:obj:`~.cudaLibraryUnload()`. - If the environment variables are set to LAZY, `library` is not immediately loaded onto all existent contexts and will only be loaded when a function is needed for that context, such as a kernel launch. These environment variables are described in the CUDA programming guide under the "CUDA environment variables" section. The `code` may be a `cubin` or `fatbin` as output by nvcc, or a NULL- terminated `PTX`, either as output by nvcc or hand-written, or `Tile` IR data. A fatbin should also contain relocatable code when doing separate compilation. Please also see the documentation for nvrtc (https://docs.nvidia.com/cuda/nvrtc/index.html), nvjitlink (https://docs.nvidia.com/cuda/nvjitlink/index.html), and nvfatbin (https://docs.nvidia.com/cuda/nvfatbin/index.html) for more information on generating loadable code at runtime. Options are passed as an array via `jitOptions` and any corresponding parameters are passed in `jitOptionsValues`. The number of total JIT options is supplied via `numJitOptions`. Any outputs will be returned via `jitOptionsValues`. Library load options are passed as an array via `libraryOptions` and any corresponding parameters are passed in `libraryOptionValues`. The number of total library load options is supplied via `numLibraryOptions`. :param code: Code to load :type code: Any :param jitOptions: Options for JIT :type jitOptions: list[:py:obj:`~.cudaJitOption`] :param jitOptionsValues: Option values for JIT :type jitOptionsValues: list[Any] :param numJitOptions: Number of options :type numJitOptions: unsigned int :param libraryOptions: Options for loading :type libraryOptions: list[:py:obj:`~.cudaLibraryOption`] :param libraryOptionValues: Option values for loading :type libraryOptionValues: list[Any] :param numLibraryOptions: Number of options for loading :type numLibraryOptions: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorSharedObjectSymbolNotFound`, :py:obj:`~.cudaErrorSharedObjectInitFailed`, :py:obj:`~.cudaErrorJitCompilerNotFound` * **library** (:py:obj:`~.cudaLibrary_t`) -- Returned library .. seealso:: :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryLoadData`
- cuda.bindings.runtime.cudaLibraryLoadFromFile(char *fileName, jitOptions: Optional[tuple[cudaJitOption] | list[cudaJitOption]], jitOptionsValues: Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions: Optional[tuple[cudaLibraryOption] | list[cudaLibraryOption]], libraryOptionValues: Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions)#
Load a library with specified file and options. Takes a pointer `code` and loads the corresponding library `library` based on the application defined library loading mode: - If module loading is set to EAGER, via the environment variables described in "Module loading", `library` is loaded eagerly into all contexts at the time of the call and future contexts at the time of creation until the library is unloaded with :py:obj:`~.cudaLibraryUnload()`. - If the environment variables are set to LAZY, `library` is not immediately loaded onto all existent contexts and will only be loaded when a function is needed for that context, such as a kernel launch. These environment variables are described in the CUDA programming guide under the "CUDA environment variables" section. The file should be a `cubin` file as output by nvcc, or a `PTX` file either as output by nvcc or handwritten, or a `fatbin` file as output by nvcc or hand-written, or `Tile` IR file. A fatbin should also contain relocatable code when doing separate compilation. Please also see the documentation for nvrtc (https://docs.nvidia.com/cuda/nvrtc/index.html), nvjitlink (https://docs.nvidia.com/cuda/nvjitlink/index.html), and nvfatbin (https://docs.nvidia.com/cuda/nvfatbin/index.html) for more information on generating loadable code at runtime. Options are passed as an array via `jitOptions` and any corresponding parameters are passed in `jitOptionsValues`. The number of total options is supplied via `numJitOptions`. Any outputs will be returned via `jitOptionsValues`. Library load options are passed as an array via `libraryOptions` and any corresponding parameters are passed in `libraryOptionValues`. The number of total library load options is supplied via `numLibraryOptions`. :param fileName: File to load from :type fileName: bytes :param jitOptions: Options for JIT :type jitOptions: list[:py:obj:`~.cudaJitOption`] :param jitOptionsValues: Option values for JIT :type jitOptionsValues: list[Any] :param numJitOptions: Number of options :type numJitOptions: unsigned int :param libraryOptions: Options for loading :type libraryOptions: list[:py:obj:`~.cudaLibraryOption`] :param libraryOptionValues: Option values for loading :type libraryOptionValues: list[Any] :param numLibraryOptions: Number of options for loading :type numLibraryOptions: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorSharedObjectSymbolNotFound`, :py:obj:`~.cudaErrorSharedObjectInitFailed`, :py:obj:`~.cudaErrorJitCompilerNotFound` * **library** (:py:obj:`~.cudaLibrary_t`) -- Returned library .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryLoadFromFile`
- cuda.bindings.runtime.cudaLibraryUnload(library)#
Unloads a library. Unloads the library specified with `library` :param library: Library to unload :type library: :py:obj:`~.cudaLibrary_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`
- cuda.bindings.runtime.cudaLibraryGetKernel(library, char *name)#
Returns a kernel handle. Returns in `pKernel` the handle of the kernel with name `name` located in library `library`. If kernel handle is not found, the call returns :py:obj:`~.cudaErrorSymbolNotFound`. :param library: Library to retrieve kernel from :type library: :py:obj:`~.cudaLibrary_t` :param name: Name of kernel to retrieve :type name: bytes :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` * **pKernel** (:py:obj:`~.cudaKernel_t`) -- Returned kernel handle .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryGetKernel`
- cuda.bindings.runtime.cudaLibraryGetGlobal(library, char *name)#
Returns a global device pointer. Returns in `*dptr` and `*bytes` the base pointer and size of the global with name `name` for the requested library `library` and the current device. If no global for the requested name `name` exists, the call returns :py:obj:`~.cudaErrorSymbolNotFound`. One of the parameters `dptr` or `numbytes` (not both) can be NULL in which case it is ignored. The returned `dptr` cannot be passed to the Symbol APIs such as :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaGetSymbolAddress`, or :py:obj:`~.cudaGetSymbolSize`. :param library: Library to retrieve global from :type library: :py:obj:`~.cudaLibrary_t` :param name: Name of global to retrieve :type name: bytes :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorContextIsDestroyed` * **dptr** (*Any*) -- Returned global device pointer for the requested library * **numbytes** (*int*) -- Returned global size in bytes .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetManaged`, :py:obj:`~.cuLibraryGetGlobal`
- cuda.bindings.runtime.cudaLibraryGetManaged(library, char *name)#
Returns a pointer to managed memory. Returns in `*dptr` and `*bytes` the base pointer and size of the managed memory with name `name` for the requested library `library`. If no managed memory with the requested name `name` exists, the call returns :py:obj:`~.cudaErrorSymbolNotFound`. One of the parameters `dptr` or `numbytes` (not both) can be NULL in which case it is ignored. Note that managed memory for library `library` is shared across devices and is registered when the library is loaded. The returned `dptr` cannot be passed to the Symbol APIs such as :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaGetSymbolAddress`, or :py:obj:`~.cudaGetSymbolSize`. :param library: Library to retrieve managed memory from :type library: :py:obj:`~.cudaLibrary_t` :param name: Name of managed memory to retrieve :type name: bytes :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` * **dptr** (*Any*) -- Returned pointer to the managed memory * **numbytes** (*int*) -- Returned memory size in bytes .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetGlobal`, :py:obj:`~.cuLibraryGetManaged`
- cuda.bindings.runtime.cudaLibraryGetUnifiedFunction(library, char *symbol)#
Returns a pointer to a unified function. Returns in `*fptr` the function pointer to a unified function denoted by `symbol`. If no unified function with name `symbol` exists, the call returns :py:obj:`~.cudaErrorSymbolNotFound`. If there is no device with attribute :py:obj:`~.cudaDeviceProp.unifiedFunctionPointers` present in the system, the call may return :py:obj:`~.cudaErrorSymbolNotFound`. :param library: Library to retrieve function pointer memory from :type library: :py:obj:`~.cudaLibrary_t` :param symbol: Name of function pointer to retrieve :type symbol: bytes :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` * **fptr** (*Any*) -- Returned pointer to a unified function .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryGetUnifiedFunction`
- cuda.bindings.runtime.cudaLibraryGetKernelCount(lib)#
Returns the number of kernels within a library. Returns in `count` the number of kernels in `lib`. :param lib: Library to query :type lib: :py:obj:`~.cudaLibrary_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **count** (*unsigned int*) -- Number of kernels found within the library .. seealso:: :py:obj:`~.cudaLibraryEnumerateKernels`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cuLibraryGetKernelCount`
- cuda.bindings.runtime.cudaLibraryEnumerateKernels(unsigned int numKernels, lib)#
Retrieve the kernel handles within a library. Returns in `kernels` a maximum number of `numKernels` kernel handles within `lib`. The returned kernel handle becomes invalid when the library is unloaded. :param numKernels: Maximum number of kernel handles may be returned to the buffer :type numKernels: unsigned int :param lib: Library to query from :type lib: :py:obj:`~.cudaLibrary_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` * **kernels** (list[:py:obj:`~.cudaKernel_t`]) -- Buffer where the kernel handles are returned to .. seealso:: :py:obj:`~.cudaLibraryGetKernelCount`, :py:obj:`~.cuLibraryEnumerateKernels`
- cuda.bindings.runtime.cudaKernelSetAttributeForDevice(
- kernel,
- attr: cudaFuncAttribute,
- int value,
- int device,
Sets information about a kernel. This call sets the value of a specified attribute `attr` on the kernel `kernel` for the requested device `device` to an integer value specified by `value`. This function returns :py:obj:`~.cudaSuccess` if the new value of the attribute could be successfully set. If the set fails, this call will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result in an error (:py:obj:`~.cudaErrorInvalidValue`) Note that attributes set using :py:obj:`~.cudaFuncSetAttribute()` will override the attribute set by this API irrespective of whether the call to :py:obj:`~.cudaFuncSetAttribute()` is made before or after this API call. Because of this and the stricter locking requirements mentioned below it is suggested that this call be used during the initialization path and not on each thread accessing `kernel` such as on kernel launches or on the critical path. Valid values for `attr` are: - :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` - The requested maximum size in bytes of dynamically-allocated shared memory. The sum of this value and the function attribute :py:obj:`~.sharedSizeBytes` cannot exceed the device attribute :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`. The maximal size of requestable dynamic shared memory may differ by GPU architecture. - :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` - On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory. See :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`. This is only a hint, and the driver can choose a different ratio if required to execute the function. - :py:obj:`~.cudaFuncAttributeRequiredClusterWidth`: The required cluster width in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeRequiredClusterHeight`: The required cluster height in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeRequiredClusterDepth`: The required cluster depth in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted. - :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. - :py:obj:`~.cudaFuncAttributeClusterSchedulingPolicyPreference`: The block scheduling policy of a function. The value type is cudaClusterSchedulingPolicy. :param kernel: Kernel to set attribute of :type kernel: :py:obj:`~.cudaKernel_t` :param attr: Attribute requested :type attr: :py:obj:`~.cudaFuncAttribute` :param value: Value to set :type value: int :param device: Device to set attribute of :type device: int :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetKernel`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` .. rubric:: Notes The API has stricter locking requirements in comparison to its legacy counterpart :py:obj:`~.cudaFuncSetAttribute()` due to device-wide semantics. If multiple threads are trying to set the same attribute on the same device simultaneously, the attribute setting will depend on the interleavings chosen by the OS scheduler and memory consistency.
Execution Context Management#
This section describes the execution context management functions of the CUDA runtime application programming interface.
Overview
A CUDA execution context cudaExecutionContext_t serves as an abstraction for the contexts exposed by the CUDA Runtime, specifically green contexts and the primary context, and provides a unified programming model and API interface for contexts in the Runtime.
There are two primary ways today to obtain an execution context:
cudaDeviceGetExecutionCtx: Returns the execution context that corresponds to the primary context of the specified device.
cudaGreenCtxCreate: Creates a green context with the specified resources and returns an execution context.
Once you have an execution context at hand, you can perform context-level operations via the CUDA Runtime APIs. This includes:
Submitting work via streams created with cudaExecutionCtxStreamCreate.
Querying context via cudaExecutionCtxGetDevResource, cudaExecutionCtxGetDevice, etc.
Synchronizing and tracking context-level operations via cudaExecutionCtxSynchronize, cudaExecutionCtxRecordEvent, cudaExecutionCtxWaitEvent.
Performing context-level graph node operations via cudaGraphAddNode by specifying the context in
nodeParams. Note that individual node creation APIs, such as cudaGraphAddKernelNode, do not support specifying an execution context.
Note: The above APIs take in an explicit cudaExecutionContext_t handle and ignores the context that is current to the calling thread. This enables explicit context-based programming without relying on thread-local state. If no context is specified, the APIs return cudaErrorInvalidValue.
Note: Developers should treat cudaExecutionContext_t as an opaque handle and avoid assumptions about its underlying representation. The CUDA Runtime does not provide a way to convert this handle into driver-level contexts, such as ::CUcontext or ::CUgreenCtx.
Lifetime of CUDA Resources
The lifetime of CUDA resources (memory, streams, events, modules, etc) is not tied to the lifetime of the execution context. Their lifetime is tied to the device against which they were created. As such, usage of cudaDeviceReset() should be avoided to persist the lifetime of these resources.
APIs Operating on Current Context
The CUDA runtime does not provide a way to set an execution context as current. Since, the majority of the runtime APIs operate on the current context, we document below how the developer can work with these APIs.
APIs Operating on Device Resources
To work with these APIs (for example, cudaMalloc, cudaEventCreate, etc), developers are expected to call cudaSetDevice() prior to invoking them. Doing so does not impact functional correctness as these APIs operate on resources that are device-wide. If users have a context handle at hand, they can get the device handle from the context handle using cudaExecutionCtxGetDevice().
APIs Operating on Context Resources
These APIs (for example, cudaLaunchKernel, cudaMemcpyAsync, cudaMemsetAsync, etc) take in a stream and resources are inferred from the context bound to the stream at creation. See cudaExecutionCtxStreamCreate for more details. Developers are expected to use the stream-based APIs for context awareness and always pass an explicit stream handle to ensure context-awareness, and avoid reliance on the default NULL stream, which implicitly binds to the current context.
Green Contexts
Green contexts are a lightweight alternative to traditional contexts, that can be used to select a subset of device resources. This allows the developer to, for example, select SMs from distinct spatial partitions of the GPU and target them via CUDA stream operations, kernel launches, etc.
Here are the broad initial steps to follow to get started:
Start with an initial set of resources. For SM resources, they can be fetched via cudaDeviceGetDevResource. In case of workqueues, a new configuration can be used or an existing one queried via the cudaDeviceGetDevResource API.
Modify these resources by either partitioning them (in case of SMs) or changing the configuration (in case of workqueues). To partition SMs, we recommend cudaDevSmResourceSplit. Changing the workqueue configuration can be done directly in place.
Finalize the specification of resources by creating a descriptor via cudaDevResourceGenerateDesc.
Create a green context via cudaGreenCtxCreate. This provisions the resource, such as workqueues (until this step it was only a configuration specification).
Create a stream via cudaExecutionCtxStreamCreate, and use it throughout your application.
SMs
There are two possible partition operations - with cudaDevSmResourceSplitByCount the partitions created have to follow default SM count granularity requirements, so it will often be rounded up and aligned to a default value. On the other hand, cudaDevSmResourceSplit is explicit and allows for creation of non-equal groups. It will not round up automatically - instead it is the developer’s responsibility to query and set the correct values. These requirements can be queried with cudaDeviceGetDevResource to determine the alignment granularity (sm.smCoscheduledAlignment). A general guideline on the default values for each compute architecture:
On Compute Architecture 7.X, 8.X, and all Tegra SoC:
The smCount must be a multiple of 2.
The alignment (and default value of coscheduledSmCount) is 2.
On Compute Architecture 9.0+:
The smCount must be a multiple of 8, or coscheduledSmCount if provided.
The alignment (and default value of coscheduledSmCount) is 8. While the maximum value for coscheduled SM count is 32 on all Compute Architecture 9.0+, it’s recommended to follow cluster size requirements. The portable cluster size and the max cluster size should be used in order to benefit from this co-scheduling.
Workqueues
For cudaDevResourceTypeWorkqueueConfig, the resource specifies the expected maximum number of concurrent stream-ordered workloads via the wqConcurrencyLimit field. The sharingScope field determines how workqueue resources are shared:
cudaDevWorkqueueConfigScopeDeviceCtx:Use all shared workqueue resources across all contexts (default driver behavior).cudaDevWorkqueueConfigScopeGreenCtxBalanced:When possible, use non-overlapping workqueue resources with other balanced green contexts.
The maximum concurrency limit depends on ::CUDA_DEVICE_MAX_CONNECTIONS and can be queried from the device via cudaDeviceGetDevResource. Configurations may exceed this concurrency limit, but the driver will not guarantee that work submission remains non-overlapping.
For cudaDevResourceTypeWorkqueue, the resource represents a pre-existing workqueue that can be retrieved from existing execution contexts. This allows reusing workqueue resources across different execution contexts.
On Concurrency
Even if the green contexts have disjoint SM partitions, it is not guaranteed that the kernels launched in them will run concurrently or have forward progress guarantees. This is due to other resources that could cause a dependency. Using a combination of disjoint SMs and cudaDevWorkqueueConfigScopeGreenCtxBalanced workqueue configurations can provide the best chance of avoiding interference. More resources will be added in the future to provide stronger guarantees.
Additionally, there are two known scenarios, where its possible for the workload to run on more SMs than was provisioned (but never less).
On Volta+ MPS: When
CUDA_MPS_ACTIVE_THREAD_PERCENTAGEis used, the set of SMs that are used for running kernels can be scaled up to the value of SMs used for the MPS client.On Compute Architecture 9.x: When a module with dynamic parallelism (CDP) is loaded, all future kernels running under green contexts may use and share an additional set of 2 SMs.
- cuda.bindings.runtime.cudaDeviceGetDevResource(int device, typename: cudaDevResourceType)#
Get device resources. Get the `typename` resources available to the `device`. This may often be the starting point for further partitioning or configuring of resources. Note: The API is not supported on 32-bit platforms. :param device: Device to get resource for :type device: int :param typename: Type of resource to retrieve :type typename: :py:obj:`~.cudaDevResourceType` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **resource** (:py:obj:`~.cudaDevResource`) -- Output pointer to a cudaDevResource structure .. seealso:: :py:obj:`~.cuDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`
- cuda.bindings.runtime.cudaDevSmResourceSplitByCount(unsigned int nbGroups, cudaDevResource input_: Optional[cudaDevResource], unsigned int flags, unsigned int minCount)#
Splits `cudaDevResourceTypeSm` resources. Splits `cudaDevResourceTypeSm` resources into `nbGroups`, adhering to the minimum SM count specified in `minCount` and the usage flags in `flags`. If `result` is NULL, the API simulates a split and provides the amount of groups that would be created in `nbGroups`. Otherwise, `nbGroups` must point to the amount of elements in `result` and on return, the API will overwrite `nbGroups` with the amount actually created. The groups are written to the array in `result`. `nbGroups` can be less than the total amount if a smaller number of groups is needed. This API is used to spatially partition the input resource. The input resource needs to come from one of :py:obj:`~.cudaDeviceGetDevResource`, or :py:obj:`~.cudaExecutionCtxGetDevResource`. A limitation of the API is that the output results cannot be split again without first creating a descriptor and a green context with that descriptor. When creating the groups, the API will take into account the performance and functional characteristics of the input resource, and guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to fewer groups created than purely dividing the total SM count by the `minCount` due to cluster requirements or alignment and granularity requirements for the minCount. These requirements can be queried with :py:obj:`~.cudaDeviceGetDevResource`, or :py:obj:`~.cudaExecutionCtxGetDevResource` for :py:obj:`~.cudaDevResourceTypeSm`, using the `minSmPartitionSize` and `smCoscheduledAlignment` fields to determine minimum partition size and alignment granularity, respectively. The `remainder` set does not have the same functional or performance guarantees as the groups in `result`. Its use should be carefully planned and future partitions of the `remainder` set are discouraged. The following flags are supported: - `cudaDevSmResourceSplitIgnoreSmCoscheduling` : Lower the minimum SM count and alignment, and treat each SM independent of its hierarchy. This allows more fine grained partitions but at the cost of advanced features (such as large clusters on compute capability 9.0+). - `cudaDevSmResourceSplitMaxPotentialClusterSize` : Compute Capability 9.0+ only. Attempt to create groups that may allow for maximally sized thread clusters. This can be queried post green context creation using :py:obj:`~.cudaOccupancyMaxPotentialClusterSize`. A successful API call must either have: - A valid array of `result` pointers of size passed in `nbGroups`, with `input` of type `cudaDevResourceTypeSm`. Value of `minCount` must be between 0 and the SM count specified in `input`. `remaining` may be NULL. - NULL passed in for `result`, with a valid integer pointer in `nbGroups` and `input` of type `cudaDevResourceTypeSm`. Value of `minCount` must be between 0 and the SM count specified in `input`. `remaining` may be NULL. This queries the number of groups that would be created by the API. Note: The API is not supported on 32-bit platforms. :param nbGroups: This is a pointer, specifying the number of groups that would be or should be created as described below. :type nbGroups: unsigned int :param input: Input SM resource to be split. Must be a valid `cudaDevSmResource` resource. :type input: :py:obj:`~.cudaDevResource` :param flags: Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior. :type flags: unsigned int :param minCount: Minimum number of SMs required :type minCount: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **result** (list[:py:obj:`~.cudaDevResource`]) -- Output array of `cudaDevResource` resources. Can be NULL to query the number of groups. * **nbGroups** (*unsigned int*) -- This is a pointer, specifying the number of groups that would be or should be created as described below. * **remaining** (:py:obj:`~.cudaDevResource`) -- If the input resource cannot be cleanly split among `nbGroups`, the remaining is placed in here. Can be ommitted (NULL) if the user does not need the remaining set. .. seealso:: :py:obj:`~.cuDevSmResourceSplitByCount`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevResourceGenerateDesc`
- cuda.bindings.runtime.cudaDevSmResourceSplit(unsigned int nbGroups, cudaDevResource input_: Optional[cudaDevResource], unsigned int flags, groupParams: Optional[tuple[cudaDevSmResourceGroupParams] | list[cudaDevSmResourceGroupParams]])#
Splits a `cudaDevResourceTypeSm` resource into structured groups. This API will split a resource of :py:obj:`~.cudaDevResourceTypeSm` into `nbGroups` structured device resource groups (the `result` array), as well as an optional `remainder`, according to a set of requirements specified in the `groupParams` array. The term “structured” is a trait that specifies the `result` has SMs that are co-scheduled together. This co-scheduling can be specified via the `coscheduledSmCount` field of the `groupParams` structure, while the `smCount` will specify how many SMs are required in total for that result. The remainder is always “unstructured”, it does not have any set guarantees with respect to co- scheduling and those properties will need to either be queried via the occupancy set of APIs or further split into structured groups by this API. The API has a discovery mode for use cases where it is difficult to know ahead of time what the SM count should be. Discovery happens when the `smCount` field of a given `groupParams` array entry is set to 0 - the smCount will be filled in by the API with the derived SM count according to the provided `groupParams` fields and constraints. Discovery can be used with both a valid result array and with a NULL `result` pointer value. The latter is useful in situations where the smCount will end up being zero, which is an invalid value to create a result entry with, but allowed for discovery purposes when the `result` is NULL. The `groupParams` array is evaluated from index 0 to `nbGroups` - 1. For each index in the `groupParams` array, the API will evaluate which SMs may be a good fit based on constraints and assign those SMs to `result`. This evaluation order is important to consider when using discovery mode, as it helps discover the remaining SMs. For a valid call: - `result` should point to a `cudaDevResource` array of size `nbGroups`, or alternatively, may be NULL, if the developer wishes for only the groupParams entries to be updated - `input` should be a valid :py:obj:`~.cudaDevResourceTypeSm` resource that originates from querying the execution context, or device. - The `remainder` group may be NULL. - There are no API `flags` at this time, so the value passed in should be 0. - A :py:obj:`~.cudaDevSmResourceGroupParams` array of size `nbGroups`. Each entry must be zero-initialized. - `smCount:` must be either 0 or in the range of [2,inputSmCount] where inputSmCount is the amount of SMs the `input` resource has. `smCount` must be a multiple of 2, as well as a multiple of `coscheduledSmCount`. When assigning SMs to a group (and if results are expected by having the `result` parameter set), `smCount` cannot end up with 0 or a value less than `coscheduledSmCount` otherwise :py:obj:`~.cudaErrorInvalidResourceConfiguration` will be returned. - `coscheduledSmCount:` allows grouping SMs together in order to be able to launch clusters on Compute Architecture 9.0+. The default value may be queried from the device’s :py:obj:`~.cudaDevResourceTypeSm` resource (8 on Compute Architecture 9.0+ and 2 otherwise). The maximum is 32 on Compute Architecture 9.0+ and 2 otherwise. - `preferredCoscheduledSmCount:` Attempts to merge `coscheduledSmCount` groups into larger groups, in order to make use of `preferredClusterDimensions` on Compute Architecture 10.0+. The default value is set to `coscheduledSmCount`. - `flags:` - `cudaDevSmResourceGroupBackfill:` lets `smCount` be a non-multiple of `coscheduledSmCount`, filling the difference between SM count and already assigned co-scheduled groupings with other SMs. This lets any resulting group behave similar to the `remainder` group for example. Example params and their effect: A groupParams array element is defined in the following order: **View CUDA Toolkit Documentation for a C++ code example** **View CUDA Toolkit Documentation for a C++ code example** **View CUDA Toolkit Documentation for a C++ code example** **View CUDA Toolkit Documentation for a C++ code example** The difference between a catch-all param group as the last entry and the remainder is in two aspects: - The remainder may be NULL / _TYPE_INVALID (if there are no SMs remaining), while a result group must always be valid. - The remainder does not have a structure, while the result group will always need to adhere to a structure of coscheduledSmCount (even if its just 2), and therefore must always have enough coscheduled SMs to cover that requirement (even with the `cudaDevSmResourceGroupBackfill` flag enabled). Splitting an input into N groups, can be accomplished by repeatedly splitting off 1 group and re-splitting the remainder (a bisect operation). However, it's recommended to accomplish this with a single call wherever possible. :param nbGroups: Specifies the number of groups in `result` and `groupParams` :type nbGroups: unsigned int :param input: Input SM resource to be split. Must be a valid `cudaDevResourceTypeSm` resource. :type input: :py:obj:`~.cudaDevResource` :param flags: Flags specifying how the API should behave. The value should be 0 for now. :type flags: unsigned int :param groupParams: Description of how the SMs should be split and assigned to the corresponding result entry. :type groupParams: list[:py:obj:`~.cudaDevSmResourceGroupParams`] :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **result** (list[:py:obj:`~.cudaDevResource`]) -- Output array of `cudaDevResource` resources. Can be NULL, alongside an smCount of 0, for discovery purpose. * **remainder** (:py:obj:`~.cudaDevResource`) -- If splitting the input resource leaves any SMs, the remainder is placed in here. .. seealso:: :py:obj:`~.cuDevSmResourceSplit`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevResourceGenerateDesc`
- cuda.bindings.runtime.cudaDevResourceGenerateDesc(resources: Optional[tuple[cudaDevResource] | list[cudaDevResource]], unsigned int nbResources)#
Generate a resource descriptor. Generates a single resource descriptor with the set of resources specified in `resources`. The generated resource descriptor is necessary for the creation of green contexts via the :py:obj:`~.cudaGreenCtxCreate` API. Resources of the same type can be passed in, provided they meet the requirements as noted below. A successful API call must have: - A valid output pointer for the `phDesc` descriptor as well as a valid array of `resources` pointers, with the array size passed in `nbResources`. If multiple resources are provided in `resources`, the device they came from must be the same, otherwise :py:obj:`~.cudaErrorInvalidResourceConfiguration` is returned. If multiple resources are provided in `resources` and they are of type :py:obj:`~.cudaDevResourceTypeSm`, they must be outputs (whether `result` or `remaining`) from the same split API instance and have the same smCoscheduledAlignment values, otherwise :py:obj:`~.cudaErrorInvalidResourceConfiguration` is returned. Note: The API is not supported on 32-bit platforms. :param resources: Array of resources to be included in the descriptor :type resources: list[:py:obj:`~.cudaDevResource`] :param nbResources: Number of resources passed in `resources` :type nbResources: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **phDesc** (:py:obj:`~.cudaDevResourceDesc_t`) -- Output descriptor .. seealso:: :py:obj:`~.cuDevResourceGenerateDesc`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaGreenCtxCreate`
- cuda.bindings.runtime.cudaGreenCtxCreate(desc, int device, unsigned int flags)#
Creates a green context with a specified set of resources. This API creates a green context with the resources specified in the descriptor `desc` and returns it in the handle represented by `phCtx`. This API retains the device’s primary context for the lifetime of the green context. The primary context will be released when the green context is destroyed. To avoid the overhead of repeated initialization and teardown, it is recommended to explicitly initialize the device's primary context ahead of time using :py:obj:`~.cudaInitDevice`. This ensures that the primary context remains initialized throughout the program’s lifetime, minimizing overhead during green context creation and destruction. The API does not create a default stream for the green context. Developers are expected to create streams explicitly using :py:obj:`~.cudaExecutionCtxStreamCreate` to submit work to the green context. Note: The API is not supported on 32-bit platforms. :param desc: Descriptor generated via :py:obj:`~.cudaDevResourceGenerateDesc` which contains the set of resources to be used :type desc: :py:obj:`~.cudaDevResourceDesc_t` :param device: Device on which to create the green context. :type device: int :param flags: Green context creation flags. Must be 0, currently reserved for future use. :type flags: unsigned int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **phCtx** (:py:obj:`~.cudaExecutionContext_t`) -- Pointer for the output handle to the green context .. seealso:: :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cudaExecutionCtxStreamCreate`
- cuda.bindings.runtime.cudaExecutionCtxDestroy(ctx)#
Destroy a execution context. Destroys the specified execution context `ctx`. It is the responsibility of the caller to ensure that no API call issues using `ctx` while :py:obj:`~.cudaExecutionCtxDestroy()` is executing or subsequently. If `ctx` is a green context, any resources provisioned for it (that were initially available via the resource descriptor) are released as well. The API does not destroy streams created via :py:obj:`~.cudaExecutionCtxStreamCreate`. Users are expected to destroy these streams explicitly using :py:obj:`~.cudaStreamDestroy` to avoid resource leaks. Once the execution context is destroyed, any subsequent API calls involving these streams will return :py:obj:`~.cudaErrorStreamDetached` with the exception of the following APIs: - :py:obj:`~.cudaStreamDestroy`. Note this is only supported on CUDA drivers 13.1 and above. Additionally, the API will invalidate all active captures on these streams. Passing in a `ctx` that was not explicitly created via CUDA Runtime APIs is not allowed and will result in undefined behavior. :param ctx: Execution context to destroy (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGreenCtxCreate`
- cuda.bindings.runtime.cudaExecutionCtxGetDevResource(ctx, typename: cudaDevResourceType)#
Get context resources. Get the `typename` resources available to context represented by `ctx`. Note: The API is not supported on 32-bit platforms. :param ctx: Execution context to get resource for (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :param typename: Type of resource to retrieve :type typename: :py:obj:`~.cudaDevResourceType` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **resource** (:py:obj:`~.cudaDevResource`) -- Output pointer to a cudaDevResource structure .. seealso:: :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cudaGreenCtxCreate`
- cuda.bindings.runtime.cudaExecutionCtxGetDevice(ctx)#
Returns the device handle for the execution context. Returns in `*device` the handle of the specified execution context's device. The execution context should not be NULL. :param ctx: Execution context for which to obtain the device (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted` * **device** (*int*) -- Returned device handle for the specified execution context .. seealso:: :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cuCtxGetDevice`
- cuda.bindings.runtime.cudaExecutionCtxGetId(ctx)#
Returns the unique Id associated with the execution context supplied. Returns in `ctxId` the unique Id which is associated with a given context. The Id is unique for the life of the program for this instance of CUDA. The execution context should not be NULL. :param ctx: Context for which to obtain the Id (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted` * **ctxId** (*unsigned long long*) -- Pointer to store the Id of the context .. seealso:: :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaExecutionCtxGetDevice`, :py:obj:`~.cuCtxGetId`
- cuda.bindings.runtime.cudaExecutionCtxStreamCreate(ctx, unsigned int flags, int priority)#
Creates a stream and initializes it for the given execution context. The API creates a CUDA stream with the specified `flags` and `priority`, initializing it with resources as defined at the time of creating the specified `ctx`. Additionally, the API also enables work submitted to to the stream to be tracked under `ctx`. The supported values for `flags` are: - :py:obj:`~.cudaStreamDefault`: Default stream creation flag. This would be :py:obj:`~.cudaStreamNonBlocking` for streams created on a green context. - :py:obj:`~.cudaStreamNonBlocking`: Specifies that work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and that the created stream should perform no implicit synchronization with stream 0 Specifying `priority` affects the scheduling priority of work in the stream. Priorities provide a hint to preferentially run work with higher priority when possible, but do not preempt already-running work or provide any other functional guarantee on execution order. `priority` follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful numerical priorities can be queried using :py:obj:`~.cudaDeviceGetStreamPriorityRange`. If the specified priority is outside the numerical range returned by :py:obj:`~.cudaDeviceGetStreamPriorityRange`, it will automatically be clamped to the lowest or the highest number in the range. :param ctx: Execution context to initialize the stream with (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :param flags: Flags for stream creation :type flags: unsigned int :param priority: Stream priority :type priority: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` * **phStream** (:py:obj:`~.cudaStream_t`) -- Returned stream handle .. seealso:: :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback` .. rubric:: Notes In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations.
- cuda.bindings.runtime.cudaExecutionCtxSynchronize(ctx)#
Block for the specified execution context's tasks to complete. Blocks until the specified execution context has completed all preceding requested tasks. If the specified execution context is the device (primary) context obtained via :py:obj:`~.cudaDeviceGetExecutionCtx`, green contexts that have been created on the device will also be synchronized. The API returns an error if one of the preceding tasks failed. :param ctx: Execution context to synchronize (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorInvalidValue` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaDeviceSynchronize`, :py:obj:`~.cuCtxSynchronize_v2`
- cuda.bindings.runtime.cudaStreamGetDevResource(hStream, typename: cudaDevResourceType)#
Get stream resources. Get the `typename` resources available to the `hStream` and store them in `resource`. Note: The API will return :py:obj:`~.cudaErrorInvalidResourceType` is `typename` is `cudaDevResourceTypeWorkqueueConfig` or `cudaDevResourceTypeWorkqueue`. :param hStream: Stream to get resource for :type hStream: :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` :param typename: Type of resource to retrieve :type typename: :py:obj:`~.cudaDevResourceType` :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCallRequiresNewerDriver`, * **resource** (:py:obj:`~.cudaDevResource`) -- Output pointer to a cudaDevResource structure .. seealso:: :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxStreamCreate`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cuStreamGetDevResource`
- cuda.bindings.runtime.cudaExecutionCtxRecordEvent(ctx, event)#
Records an event for the specified execution context. Captures in `event` all the activities of the execution context `ctx` at the time of this call. `event` and `ctx` must be from the same CUDA device, otherwise :py:obj:`~.cudaErrorInvalidHandle` will be returned. Calls such as :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaExecutionCtxWaitEvent()` will then examine or wait for completion of the work that was captured. Uses of `ctx` after this call do not modify `event`. If the execution context passed to `ctx` is the device (primary) context obtained via :py:obj:`~.cudaDeviceGetExecutionCtx()`, `event` will capture all the activities of the green contexts created on the device as well. :param ctx: Execution context to record event for (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :param event: Event to record :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaExecutionCtxWaitEvent`, :py:obj:`~.cuCtxRecordEvent`, :py:obj:`~.cuGreenCtxRecordEvent` .. rubric:: Notes The API will return :py:obj:`~.cudaErrorStreamCaptureUnsupported` if the specified execution context `ctx` has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures.
- cuda.bindings.runtime.cudaExecutionCtxWaitEvent(ctx, event)#
Make an execution context wait on an event. Makes all future work submitted to execution context `ctx` wait for all work captured in `event`. The synchronization will be performed on the device and will not block the calling CPU thread. See :py:obj:`~.cudaExecutionCtxRecordEvent()` for details on what is captured by an event. If the execution context passed to `ctx` is the device (primary) context obtained via :py:obj:`~.cudaDeviceGetExecutionCtx()`, all green contexts created on the device will wait for `event` as well. :param ctx: Execution context to wait for (required parameter, see note below) :type ctx: :py:obj:`~.cudaExecutionContext_t` :param event: Event to wait on :type event: :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` :returns: :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaExecutionCtxRecordEvent`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuCtxWaitEvent`, :py:obj:`~.cuGreenCtxWaitEvent` .. rubric:: Notes `event` may be from a different execution context or device than `ctx`. The API will return :py:obj:`~.cudaErrorStreamCaptureUnsupported` and invalidate the capture if the specified event `event` is part of an ongoing capture sequence or if the specified execution context `ctx` has a stream in the capture mode.
- cuda.bindings.runtime.cudaDeviceGetExecutionCtx(int device)#
Returns the execution context for a device. Returns in `ctx` the execution context for the specified device. This is the device's primary context. The returned context can then be passed to APIs that take in a cudaExecutionContext_t enabling explicit context-based programming without relying on thread-local state. Passing the returned execution context to :py:obj:`~.cudaExecutionCtxDestroy()` is not allowed and will result in undefined behavior. :param device: Device to get the execution context for :type device: int :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` * **ctx** (:py:obj:`~.cudaExecutionContext_t`) -- Returns the device execution context .. seealso:: :py:obj:`~.cudaExecutionCtxGetDevice`, :py:obj:`~.cudaExecutionCtxGetId`
C++ API Routines#
C++-style interface built on top of CUDA runtime API. impl_private
This section describes the C++ high level API functions of the CUDA runtime application programming interface. To use these functions, your application needs to be compiled with the nvcc compiler.
Interactions with the CUDA Driver API#
This section describes the interactions between the CUDA Driver API and the CUDA Runtime API
Execution Contexts
The CUDA Runtime provides cudaExecutionContext_t as an abstraction over driver-level contexts—specifically, green contexts and the primary context.
There are two primary ways to obtain an execution context:
cudaDeviceGetExecutionCtx: Returns the execution context that corresponds to the primary context of the specified device.
cudaGreenCtxCreate: Creates a green context with the specified resources and returns an execution context.
Note: Developers should treat cudaExecutionContext_t as an opaque handle and avoid assumptions about its underlying representation. The CUDA Runtime does not provide a way to convert this handle into a ::CUcontext or ::CUgreenCtx.
Primary Context (aka Device Execution Context)
The primary context is the default execution context associated with a device in the Runtime. It can be obtained via a call to cudaDeviceGetExecutionCtx(). There is a one-to-one mapping between CUDA devices in the runtime and their primary contexts within a process.
From the CUDA Runtime’s perspective, a device and its primary context are functionally synonymous.
Unless explicitly overridden, either by making a different context current via the Driver API (e.g., ::cuCtxSetCurrent()) or by using an explicit execution context handle, the Runtime will implicitly initialize and use the primary context for API calls as needed.
Initialization and Tear-Down
Unless an explicit execution context is specified (see “Execution Context Management” for APIs), CUDA Runtime API calls operate on the CUDA Driver ::CUcontext which is current to the calling host thread. If no ::CUcontext is current to the calling thread when a CUDA Runtime API call which requires an active context is made, then the primary context (device execution context) for a device will be selected, made current to the calling thread, and initialized. The context will be initialized using the parameters specified by the CUDA Runtime API functions cudaSetDeviceFlags(), ::cudaD3D9SetDirect3DDevice(), ::cudaD3D10SetDirect3DDevice(), ::cudaD3D11SetDirect3DDevice(), cudaGLSetGLDevice(), and cudaVDPAUSetVDPAUDevice(). Note that these functions will fail with cudaErrorSetOnActiveProcess if they are called when the primary context for the specified device has already been initialized, except for cudaSetDeviceFlags() which will simply overwrite the previous settings.
The function cudaInitDevice() ensures that the primary context is initialized for the requested device but does not make it current to the calling thread.
The function cudaSetDevice() initializes the primary context for the specified device and makes it current to the calling thread by calling ::cuCtxSetCurrent().
Primary contexts will remain active until they are explicitly deinitialized using cudaDeviceReset(). The function cudaDeviceReset() will deinitialize the primary context for the calling thread’s current device immediately. The context will remain current to all of the threads that it was current to. The next CUDA Runtime API call on any thread which requires an active context will trigger the reinitialization of that device’s primary context.
Note that primary contexts are shared resources. It is recommended that the primary context not be reset except just before exit or to recover from an unspecified launch failure.
CUcontext Interoperability
Note that the use of multiple ::CUcontext s per device within a single process will substantially degrade performance and is strongly discouraged. Instead, it is highly recommended to either use execution contexts cudaExecutionContext_t or the implicit one-to-one device-to-primary context mapping for the process provided by the CUDA Runtime API.
If a non-primary ::CUcontext created by the CUDA Driver API is current to a thread then the CUDA Runtime API calls to that thread will operate on that ::CUcontext, with some exceptions listed below. Interoperability between data types is discussed in the following sections.
The function cudaDeviceEnablePeerAccess() and the rest of the peer access API may not be called when a non-primary CUcontext is current. To use the peer access APIs with a context created using the CUDA Driver API, it is necessary that the CUDA Driver API be used to access these features.
All CUDA Runtime API state (e.g, global variables’ addresses and values) travels with its underlying ::CUcontext. In particular, if a ::CUcontext is moved from one thread to another then all CUDA Runtime API state will move to that thread as well.
Please note that attaching to legacy CUcontext (those with a version of 3010 as returned by ::cuCtxGetApiVersion()) is not possible. The CUDA Runtime will return cudaErrorIncompatibleDriverContext in such cases.
Interactions between CUstream and cudaStream_t
The types ::CUstream and cudaStream_t are identical and may be used interchangeably.
Interactions between CUevent and cudaEvent_t
The types ::CUevent and cudaEvent_t are identical and may be used interchangeably.
Interactions between CUarray and cudaArray_t
The types ::CUarray and struct ::cudaArray * represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a ::CUarray in a CUDA Runtime API function which takes a struct ::cudaArray *, it is necessary to explicitly cast the ::CUarray to a struct ::cudaArray *.
In order to use a struct ::cudaArray * in a CUDA Driver API function which takes a ::CUarray, it is necessary to explicitly cast the struct ::cudaArray * to a ::CUarray .
Interactions between CUgraphicsResource and cudaGraphicsResource_t
The types ::CUgraphicsResource and cudaGraphicsResource_t represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a ::CUgraphicsResource in a CUDA Runtime API function which takes a cudaGraphicsResource_t, it is necessary to explicitly cast the ::CUgraphicsResource to a cudaGraphicsResource_t.
In order to use a cudaGraphicsResource_t in a CUDA Driver API function which takes a ::CUgraphicsResource, it is necessary to explicitly cast the cudaGraphicsResource_t to a ::CUgraphicsResource.
Interactions between CUtexObject and cudaTextureObject_t
The types ::CUtexObject and cudaTextureObject_t represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a ::CUtexObject in a CUDA Runtime API function which takes a cudaTextureObject_t, it is necessary to explicitly cast the ::CUtexObject to a cudaTextureObject_t.
In order to use a cudaTextureObject_t in a CUDA Driver API function which takes a ::CUtexObject, it is necessary to explicitly cast the cudaTextureObject_t to a ::CUtexObject.
Interactions between CUsurfObject and cudaSurfaceObject_t
The types ::CUsurfObject and cudaSurfaceObject_t represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a ::CUsurfObject in a CUDA Runtime API function which takes a cudaSurfaceObject_t, it is necessary to explicitly cast the ::CUsurfObject to a cudaSurfaceObject_t.
In order to use a cudaSurfaceObject_t in a CUDA Driver API function which takes a ::CUsurfObject, it is necessary to explicitly cast the cudaSurfaceObject_t to a ::CUsurfObject.
Interactions between CUfunction and cudaFunction_t
The types ::CUfunction and cudaFunction_t represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a cudaFunction_t in a CUDA Driver API function which takes a ::CUfunction, it is necessary to explicitly cast the cudaFunction_t to a ::CUfunction.
Interactions between CUkernel and cudaKernel_t
The types ::CUkernel and cudaKernel_t represent the same data type and may be used interchangeably by casting the two types between each other.
In order to use a cudaKernel_t in a CUDA Driver API function which takes a ::CUkernel, it is necessary to explicitly cast the cudaKernel_t to a ::CUkernel.
- cuda.bindings.runtime.cudaGetKernel(entryFuncAddr)#
Get pointer to device kernel that matches entry function `entryFuncAddr`. Returns in `kernelPtr` the device kernel corresponding to the entry function `entryFuncAddr`. Note that it is possible that there are multiple symbols belonging to different translation units with the same `entryFuncAddr` registered with this CUDA Runtime and so the order which the translation units are loaded and registered with the CUDA Runtime can lead to differing return pointers in `kernelPtr` . Suggested methods of ensuring uniqueness are to limit visibility of global device functions by using static or hidden visibility attribute in the respective translation units. :param entryFuncAddr: Address of device entry function to search kernel for :type entryFuncAddr: Any :returns: * *cudaError_t* -- :py:obj:`~.cudaSuccess` * **kernelPtr** (:py:obj:`~.cudaKernel_t`) -- Returns the device kernel .. seealso:: :obj:`cudaGetKernel`
Profiler Control#
This section describes the profiler control functions of the CUDA runtime application programming interface.
- cuda.bindings.runtime.cudaProfilerStart()#
Enable profiling. Enables profile collection by the active profiling tool for the current context. If profiling is already enabled, then :py:obj:`~.cudaProfilerStart()` has no effect. cudaProfilerStart and cudaProfilerStop APIs are used to programmatically control the profiling granularity by allowing profiling to be done only on selective pieces of code. :returns: :py:obj:`~.cudaSuccess` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaProfilerStop`, :py:obj:`~.cuProfilerStart`
- cuda.bindings.runtime.cudaProfilerStop()#
Disable profiling. Disables profile collection by the active profiling tool for the current context. If profiling is already disabled, then :py:obj:`~.cudaProfilerStop()` has no effect. cudaProfilerStart and cudaProfilerStop APIs are used to programmatically control the profiling granularity by allowing profiling to be done only on selective pieces of code. :returns: :py:obj:`~.cudaSuccess` :rtype: cudaError_t .. seealso:: :py:obj:`~.cudaProfilerStart`, :py:obj:`~.cuProfilerStop`