Table of Contents

Class CudaPrimaryExecutionContext

Namespace
JYPPX.CudaSharp
Assembly
JYPPX.CudaSharp.dll

Owns a bridge wrapper for a CUDA device primary execution context. 拥有 CUDA 设备主执行上下文的 bridge 包装器。

public sealed class CudaPrimaryExecutionContext : IDisposable
Inheritance
CudaPrimaryExecutionContext
Implements
Inherited Members

Remarks

Disposing this object releases only the bridge wrapper. The CUDA primary context is device-owned and is never passed to cudaExecutionCtxDestroy. 释放此对象只会释放 bridge 包装器;CUDA 主上下文由设备拥有,绝不会传给 cudaExecutionCtxDestroy。

Properties

DeviceOrdinal

Gets the device ordinal reported by CUDA for this context. 获取 CUDA 为此上下文报告的设备序号。

public int DeviceOrdinal { get; }

Property Value

int

Id

Gets the process-unique CUDA execution-context id. 获取进程内唯一的 CUDA 执行上下文 ID。

public ulong Id { get; }

Property Value

ulong

IsPrimary

Gets whether this wrapper represents the device primary context. 获取此包装器是否表示设备主上下文。

public bool IsPrimary { get; }

Property Value

bool

Methods

CreateStream(CudaStreamCreationFlags, int)

Creates a stream explicitly bound to this primary execution context. 创建显式绑定到此主执行上下文的 stream。

public CudaStream CreateStream(CudaStreamCreationFlags flags = CudaStreamCreationFlags.Default, int priority = 0)

Parameters

flags CudaStreamCreationFlags

CUDA stream creation flags. CUDA stream 创建标志。

priority int

CUDA stream priority. CUDA stream 优先级。

Returns

CudaStream

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetDevResourceSnapshot(CudaDevResourceType)

Gets a pointer-free CUDA 13 resource snapshot associated with this context. 获取与此执行上下文关联的 CUDA 13 资源无指针快照。

public CudaDevResourceSnapshot GetDevResourceSnapshot(CudaDevResourceType resourceType)

Parameters

resourceType CudaDevResourceType

Returns

CudaDevResourceSnapshot

RecordEvent(CudaEvent)

Records all currently tracked context work into an event. 将当前上下文已跟踪的工作记录到 event。

public void RecordEvent(CudaEvent cudaEvent)

Parameters

cudaEvent CudaEvent

The bridge-owned CUDA event. Bridge 拥有的 CUDA event。

Synchronize()

Blocks until work tracked by this execution context completes. 阻塞直到此执行上下文跟踪的工作完成。

public void Synchronize()

WaitEvent(CudaEvent)

Makes future context work wait for an event without blocking the CPU. 让后续上下文工作等待 event,且不阻塞 CPU。

public void WaitEvent(CudaEvent cudaEvent)

Parameters

cudaEvent CudaEvent

The bridge-owned CUDA event. Bridge 拥有的 CUDA event。