Table of Contents

Class CudaDeviceManager

Namespace
DotCompute.Backends.CUDA.DeviceManagement
Assembly
DotCompute.Backends.CUDA.dll

Production-grade CUDA device manager with comprehensive device enumeration, capability detection, multi-GPU coordination, and P2P support.

public sealed class CudaDeviceManager : IDisposable
Inheritance
CudaDeviceManager
Implements
Inherited Members
Extension Methods

Constructors

CudaDeviceManager(ILogger<CudaDeviceManager>)

Initializes a new instance of the CudaDeviceManager class.

public CudaDeviceManager(ILogger<CudaDeviceManager> logger)

Parameters

logger ILogger<CudaDeviceManager>

The logger.

Exceptions

ArgumentNullException

logger

Properties

CurrentDevice

Gets or sets the current device for CUDA operations.

public int CurrentDevice { get; set; }

Property Value

int

DeviceCount

Gets the number of available CUDA devices.

public int DeviceCount { get; }

Property Value

int

Devices

Gets information about all available devices.

public IReadOnlyList<CudaDeviceInfo> Devices { get; }

Property Value

IReadOnlyList<CudaDeviceInfo>

Methods

CanAccessPeer(int, int)

Checks if P2P access is available between two devices.

public bool CanAccessPeer(int fromDevice, int toDevice)

Parameters

fromDevice int
toDevice int

Returns

bool

DisablePeerAccess(int, int)

Disables P2P access between two devices.

public void DisablePeerAccess(int fromDevice, int toDevice)

Parameters

fromDevice int
toDevice int

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

EnablePeerAccess(int, int)

Enables P2P access between two devices if available.

public void EnablePeerAccess(int fromDevice, int toDevice)

Parameters

fromDevice int
toDevice int

GetDevice(int)

Gets device information by ID.

public CudaDeviceInfo GetDevice(int deviceId)

Parameters

deviceId int

Returns

CudaDeviceInfo

ResetAllDevices()

Resets all devices.

public void ResetAllDevices()

SelectBestDevice(DeviceSelectionCriteria)

Selects the best device based on criteria.

public int SelectBestDevice(DeviceSelectionCriteria criteria)

Parameters

criteria DeviceSelectionCriteria

Returns

int

SetDevice(int)

Sets the current CUDA device for operations.

public void SetDevice(int deviceId)

Parameters

deviceId int

SynchronizeAllDevices()

Synchronizes all devices.

public void SynchronizeAllDevices()