Class OpenCLBackendPlugin
- Namespace
- DotCompute.Backends.OpenCL
- Assembly
- DotCompute.Backends.OpenCL.dll
OpenCL backend plugin for DotCompute framework. Provides registration and lifecycle management for OpenCL compute backend.
public sealed class OpenCLBackendPlugin : IBackendPlugin, IDisposable
- Inheritance
-
OpenCLBackendPlugin
- Implements
- Inherited Members
- Extension Methods
Constructors
OpenCLBackendPlugin(ILogger<OpenCLBackendPlugin>)
Initializes a new instance of the OpenCLBackendPlugin class.
public OpenCLBackendPlugin(ILogger<OpenCLBackendPlugin> logger)
Parameters
loggerILogger<OpenCLBackendPlugin>Logger for diagnostic information.
Properties
Author
Gets the author of this plugin.
public string Author { get; }
Property Value
Capabilities
Gets the capabilities supported by this OpenCL backend plugin.
public PluginCapabilities Capabilities { get; }
Property Value
Description
Gets the description of the OpenCL backend capabilities.
public string Description { get; }
Property Value
Health
Gets the current health status of the plugin.
public PluginHealth Health { get; }
Property Value
Id
Gets the unique identifier for this OpenCL backend plugin.
public string Id { get; }
Property Value
Name
Gets the display name of the OpenCL backend plugin.
public string Name { get; }
Property Value
State
Gets the current operational state of the plugin.
public PluginState State { get; }
Property Value
Version
Gets the version of this plugin implementation.
public Version Version { get; }
Property Value
Methods
ConfigureServices(IServiceCollection, IConfiguration)
Configures services for dependency injection.
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
Parameters
servicesIServiceCollectionThe service collection to configure.
configurationIConfigurationThe configuration for the plugin.
Dispose()
Disposes the OpenCL backend plugin.
public void Dispose()
GetConfigurationSchema()
Gets the plugin's configuration schema as a JSON string.
public string GetConfigurationSchema()
Returns
- string
Configuration schema for the OpenCL backend plugin.
GetMetrics()
Gets the OpenCL backend plugin's performance metrics.
public PluginMetrics GetMetrics()
Returns
- PluginMetrics
Performance metrics for the plugin.
InitializeAsync(IServiceProvider, CancellationToken)
Initializes the OpenCL backend plugin asynchronously. Performs OpenCL runtime availability checks and device enumeration.
public Task InitializeAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken = default)
Parameters
serviceProviderIServiceProviderThe service provider for dependency resolution.
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- Task
A task representing the asynchronous initialization operation.
OnConfigurationChangedAsync(IConfiguration, CancellationToken)
Handles configuration changes at runtime.
public Task OnConfigurationChangedAsync(IConfiguration configuration, CancellationToken cancellationToken = default)
Parameters
configurationIConfigurationThe new configuration.
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- Task
A completed task.
StartAsync(CancellationToken)
Starts the OpenCL backend plugin asynchronously.
public Task StartAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- Task
A task representing the asynchronous start operation.
StopAsync(CancellationToken)
Stops the OpenCL backend plugin asynchronously.
public Task StopAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- Task
A task representing the asynchronous stop operation.
Validate()
Validates the OpenCL backend plugin's configuration and dependencies. Checks for OpenCL runtime availability and compatible devices.
public PluginValidationResult Validate()
Returns
- PluginValidationResult
A validation result indicating whether OpenCL is available and usable.
Events
ErrorOccurred
Event raised when the plugin encounters an error.
public event EventHandler<PluginErrorEventArgs>? ErrorOccurred
Event Type
HealthChanged
Event raised when the plugin's health status changes.
public event EventHandler<PluginHealthChangedEventArgs>? HealthChanged
Event Type
StateChanged
Event raised when the plugin's state changes.
public event EventHandler<PluginStateChangedEventArgs>? StateChanged