Table of Contents

Interface IAcceleratorManager

Namespace
DotCompute.Abstractions
Assembly
DotCompute.Abstractions.dll

Manages accelerator devices and their lifecycle.

public interface IAcceleratorManager : IAsyncDisposable
Inherited Members

Properties

AvailableAccelerators

Gets all available accelerators.

IReadOnlyList<IAccelerator> AvailableAccelerators { get; }

Property Value

IReadOnlyList<IAccelerator>

Count

Gets the number of available accelerators.

int Count { get; }

Property Value

int

DefaultAccelerator

Gets the default accelerator instance.

IAccelerator DefaultAccelerator { get; }

Property Value

IAccelerator

Methods

CreateContext(IAccelerator)

Creates a new accelerator context for the specified accelerator.

AcceleratorContext CreateContext(IAccelerator accelerator)

Parameters

accelerator IAccelerator

The accelerator to create a context for.

Returns

AcceleratorContext

A new accelerator context.

GetAccelerator(int)

Gets an accelerator by index.

IAccelerator GetAccelerator(int index)

Parameters

index int

The index of the accelerator.

Returns

IAccelerator

The accelerator at the specified index.

GetAcceleratorById(string)

Gets an accelerator by its unique identifier.

IAccelerator? GetAcceleratorById(string id)

Parameters

id string

The unique identifier of the accelerator.

Returns

IAccelerator

The accelerator with the specified ID, or null if not found.

GetAcceleratorsAsync(AcceleratorType, CancellationToken)

Gets accelerators of a specific type asynchronously.

Task<IEnumerable<IAccelerator>> GetAcceleratorsAsync(AcceleratorType type, CancellationToken cancellationToken = default)

Parameters

type AcceleratorType

The type of accelerators to get.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IEnumerable<IAccelerator>>

A task representing the async operation that returns accelerators of the specified type.

GetAcceleratorsAsync(CancellationToken)

Gets all available accelerators asynchronously.

Task<IEnumerable<IAccelerator>> GetAcceleratorsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IEnumerable<IAccelerator>>

A task representing the async operation that returns all available accelerators.

GetAcceleratorsByType(AcceleratorType)

Gets accelerators of a specific type.

IEnumerable<IAccelerator> GetAcceleratorsByType(AcceleratorType type)

Parameters

type AcceleratorType

The type of accelerators to get.

Returns

IEnumerable<IAccelerator>

A list of accelerators of the specified type.

GetBestAcceleratorAsync(AcceleratorType?, CancellationToken)

Gets the best accelerator for the specified type asynchronously.

Task<IAccelerator?> GetBestAcceleratorAsync(AcceleratorType? type = null, CancellationToken cancellationToken = default)

Parameters

type AcceleratorType?

The preferred accelerator type, or null for any type.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IAccelerator>

A task representing the async operation that returns the best matching accelerator, or null if none match.

InitializeAsync(CancellationToken)

Discovers and initializes all available accelerators.

ValueTask InitializeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

A task representing the async operation.

RefreshAsync(CancellationToken)

Refreshes the list of available accelerators.

ValueTask RefreshAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

A task representing the async operation.

RegisterProvider(IAcceleratorProvider)

Registers a custom accelerator provider.

void RegisterProvider(IAcceleratorProvider provider)

Parameters

provider IAcceleratorProvider

The accelerator provider to register.

SelectBest(AcceleratorSelectionCriteria)

Selects the best accelerator based on the given criteria.

IAccelerator? SelectBest(AcceleratorSelectionCriteria criteria)

Parameters

criteria AcceleratorSelectionCriteria

The selection criteria.

Returns

IAccelerator

The best matching accelerator, or null if none match.