Table of Contents

Class CpuComputeContext

Namespace
Orleans.GpuBridge.Runtime
Assembly
Orleans.GpuBridge.Runtime.dll

CPU compute context implementation providing fallback compute capabilities

public sealed class CpuComputeContext : IComputeContext, IDisposable
Inheritance
CpuComputeContext
Implements
Inherited Members

Constructors

CpuComputeContext(ILogger)

Initializes a new instance of the CpuComputeContext class

public CpuComputeContext(ILogger logger)

Parameters

logger ILogger

Logger instance for diagnostics

Properties

Backend

Gets the compute backend type (CPU)

public GpuBackend Backend { get; }

Property Value

GpuBackend

DeviceIndex

Gets the device index (always 0 for CPU)

public int DeviceIndex { get; }

Property Value

int

Methods

CompileKernel(string, string)

Compiles a compute kernel for CPU execution

public IComputeKernel CompileKernel(string source, string entryPoint)

Parameters

source string

Kernel source code

entryPoint string

Entry point function name

Returns

IComputeKernel

A compiled CPU kernel instance

CreateBuffer<T>(int, BufferUsage)

Creates a new CPU compute buffer

public IComputeBuffer<T> CreateBuffer<T>(int size, BufferUsage usage) where T : unmanaged

Parameters

size int

Number of elements in the buffer

usage BufferUsage

Usage flags for the buffer

Returns

IComputeBuffer<T>

A new CPU compute buffer instance

Type Parameters

T

The unmanaged element type

Dispose()

Disposes the CPU compute context

public void Dispose()

Execute(IComputeKernel, int)

Executes a CPU compute kernel

public void Execute(IComputeKernel kernel, int workSize)

Parameters

kernel IComputeKernel

The kernel to execute

workSize int

Number of work items to execute

Synchronize()

Synchronizes the CPU compute context (no-op for CPU)

public void Synchronize()