Table of Contents

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

logger ILogger<OpenCLBackendPlugin>

Logger for diagnostic information.

Properties

Author

Gets the author of this plugin.

public string Author { get; }

Property Value

string

Capabilities

Gets the capabilities supported by this OpenCL backend plugin.

public PluginCapabilities Capabilities { get; }

Property Value

PluginCapabilities

Description

Gets the description of the OpenCL backend capabilities.

public string Description { get; }

Property Value

string

Health

Gets the current health status of the plugin.

public PluginHealth Health { get; }

Property Value

PluginHealth

Id

Gets the unique identifier for this OpenCL backend plugin.

public string Id { get; }

Property Value

string

Name

Gets the display name of the OpenCL backend plugin.

public string Name { get; }

Property Value

string

State

Gets the current operational state of the plugin.

public PluginState State { get; }

Property Value

PluginState

Version

Gets the version of this plugin implementation.

public Version Version { get; }

Property Value

Version

Methods

ConfigureServices(IServiceCollection, IConfiguration)

Configures services for dependency injection.

public void ConfigureServices(IServiceCollection services, IConfiguration configuration)

Parameters

services IServiceCollection

The service collection to configure.

configuration IConfiguration

The 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

serviceProvider IServiceProvider

The service provider for dependency resolution.

cancellationToken CancellationToken

Cancellation 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

configuration IConfiguration

The new configuration.

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task

A completed task.

StartAsync(CancellationToken)

Starts the OpenCL backend plugin asynchronously.

public Task StartAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation 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

cancellationToken CancellationToken

Cancellation 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

EventHandler<PluginErrorEventArgs>

HealthChanged

Event raised when the plugin's health status changes.

public event EventHandler<PluginHealthChangedEventArgs>? HealthChanged

Event Type

EventHandler<PluginHealthChangedEventArgs>

StateChanged

Event raised when the plugin's state changes.

public event EventHandler<PluginStateChangedEventArgs>? StateChanged

Event Type

EventHandler<PluginStateChangedEventArgs>