cuda.bindings._v2.driver.import_external_semaphore#
- cuda.bindings._v2.driver.import_external_semaphore(sem_handle_desc) intptr_t#
Imports an external semaphore.
Imports an externally allocated synchronization object and returns a handle to that in
ext_sem_out. The properties of the handle being imported must be described insem_handle_desc. TheCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESCis defined as follows:. **View CUDA Toolkit Documentation for a C++ code example**. whereCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typespecifies the type of handle being imported.CUexternalSemaphoreHandleTypeis defined as:. **View CUDA Toolkit Documentation for a C++ code example**. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.fdmust 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32, then exactly one ofCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleandCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.namemust not be NULL. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleis 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.nameis not NULL, then it must name a valid synchronization object. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handlemust be non-NULL andCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.namemust 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE, then exactly one ofCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleandCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.namemust not be NULL. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleis 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.nameis not NULL, then it must name a valid synchronization object that refers to a valid ID3D12Fence object. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handlerepresents a valid shared NT handle that is returned by ID3D11Fence::CreateSharedHandle. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.nameis not NULL, then it must name a valid synchronization object that refers to a valid ID3D11Fence object. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.nvSciSyncObjrepresents a valid NvSciSyncObj.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handlerepresents a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.nameis not NULL, then it must name a valid synchronization object that refers to a valid IDXGIKeyedMutex object. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handlerepresents a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object andCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.namemust be NULL. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD, thenCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.fdmust 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.typeisCU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32, then exactly one ofCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleandCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.namemust not be NULL. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handleis 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. IfCUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.nameis not NULL, then it must name a valid synchronization object.- Parameters:
sem_handle_desc (intptr_t) – Semaphore import handle descriptor.
- Returns:
Returned handle to an external semaphore.
- Return type:
intptr_t
See also
cuImportExternalSemaphore