Class CudaComputeContext
Production CUDA compute context implementation
public sealed class CudaComputeContext : IComputeContext, IDisposable
- Inheritance
-
CudaComputeContext
- Implements
- Inherited Members
Constructors
CudaComputeContext(ILogger)
Initializes a new instance of the CudaComputeContext class
public CudaComputeContext(ILogger logger)
Parameters
loggerILoggerLogger instance for diagnostics
Properties
Backend
Gets the compute backend type (CUDA)
public GpuBackend Backend { get; }
Property Value
DeviceIndex
Gets the CUDA device index
public int DeviceIndex { get; }
Property Value
Methods
CompileKernel(string, string)
Compiles a CUDA compute kernel
public IComputeKernel CompileKernel(string source, string entryPoint)
Parameters
Returns
- IComputeKernel
A compiled CUDA kernel instance
CreateBuffer<T>(int, BufferUsage)
Creates a new CUDA compute buffer
public IComputeBuffer<T> CreateBuffer<T>(int size, BufferUsage usage) where T : unmanaged
Parameters
sizeintNumber of elements in the buffer
usageBufferUsageUsage flags for the buffer
Returns
- IComputeBuffer<T>
A new CUDA compute buffer instance
Type Parameters
TThe unmanaged element type
Dispose()
Disposes the CUDA compute context
public void Dispose()
Execute(IComputeKernel, int)
Executes a CUDA compute kernel
public void Execute(IComputeKernel kernel, int workSize)
Parameters
kernelIComputeKernelThe kernel to execute
workSizeintNumber of work items to execute
Synchronize()
Synchronizes the CUDA context
public void Synchronize()