Class DotComputeBackendProvider
- Namespace
- Orleans.GpuBridge.Backends.DotCompute
- Assembly
- Orleans.GpuBridge.Backends.DotCompute.dll
DotCompute backend provider implementation for Orleans.GpuBridge. Provides GPU acceleration via CUDA, OpenCL, Metal, and CPU with attribute-based kernel definition.
public sealed class DotComputeBackendProvider : IGpuBackendProvider, IDisposable
- Inheritance
-
DotComputeBackendProvider
- Implements
- Inherited Members
Constructors
DotComputeBackendProvider(ILogger<DotComputeBackendProvider>, ILoggerFactory, IOptions<DotComputeOptions>)
Initializes a new instance of the DotComputeBackendProvider class.
public DotComputeBackendProvider(ILogger<DotComputeBackendProvider> logger, ILoggerFactory loggerFactory, IOptions<DotComputeOptions> options)
Parameters
loggerILogger<DotComputeBackendProvider>Logger for provider operations.
loggerFactoryILoggerFactoryFactory for creating component loggers.
optionsIOptions<DotComputeOptions>DotCompute configuration options.
Properties
Capabilities
Backend capabilities supported by DotCompute.
public BackendCapabilities Capabilities { get; }
Property Value
DisplayName
Human-readable display name for this provider.
public string DisplayName { get; }
Property Value
ProviderId
Unique identifier for this backend provider.
public string ProviderId { get; }
Property Value
Version
Version of the backend provider
public Version Version { get; }
Property Value
Methods
CheckHealthAsync(CancellationToken)
Performs a health check on the backend and all compute devices.
public Task<HealthCheckResult> CheckHealthAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<HealthCheckResult>
Health check result indicating overall backend health.
CreateContext(int)
Creates a compute context for the specified device.
public Task<object> CreateContext(int deviceIndex = 0)
Parameters
deviceIndexintIndex of the device to create a context for (default: 0).
Returns
Dispose()
Disposes of resources used by the backend provider.
public void Dispose()
GetDeviceManager()
Gets the device manager for enumerating and managing compute devices.
public IDeviceManager GetDeviceManager()
Returns
- IDeviceManager
The device manager instance.
Exceptions
- InvalidOperationException
Thrown if the provider is not initialized.
GetKernelCompiler()
Gets the kernel compiler for compiling compute kernels.
public IKernelCompiler GetKernelCompiler()
Returns
- IKernelCompiler
The kernel compiler instance.
Exceptions
- InvalidOperationException
Thrown if the provider is not initialized.
GetKernelExecutor()
Gets the kernel executor for executing compiled kernels.
public IKernelExecutor GetKernelExecutor()
Returns
- IKernelExecutor
The kernel executor instance.
Exceptions
- InvalidOperationException
Thrown if the provider is not initialized.
GetMemoryAllocator()
Gets the memory allocator for managing device memory.
public IMemoryAllocator GetMemoryAllocator()
Returns
- IMemoryAllocator
The memory allocator instance.
Exceptions
- InvalidOperationException
Thrown if the provider is not initialized.
GetMetricsAsync(CancellationToken)
Gets backend-specific metrics including device utilization, memory usage, and performance statistics.
public Task<IReadOnlyDictionary<string, object>> GetMetricsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyDictionary<string, object>>
A dictionary containing backend metrics.
InitializeAsync(BackendConfiguration, CancellationToken)
Initializes the DotCompute backend provider and discovers available compute devices.
public Task InitializeAsync(BackendConfiguration configuration, CancellationToken cancellationToken = default)
Parameters
configurationBackendConfigurationBackend configuration parameters.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the initialization operation.
IsAvailable()
Checks whether the DotCompute backend is available for use (synchronous version).
public bool IsAvailable()
Returns
- bool
True if at least one compute device is available; otherwise, false.
IsAvailableAsync(CancellationToken)
Checks whether the DotCompute backend is available for use.
public Task<bool> IsAvailableAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.