Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Compute::CudaDevice Class Referenceexport

Class representing a CUDA compute device. More...

Inheritance diagram for Mila::Dnn::Compute::CudaDevice:
Collaboration diagram for Mila::Dnn::Compute::CudaDevice:

Public Types

using MANAGED_MR = CudaManagedMemoryResource
 Type alias for managed memory resource.
 
using MR = CudaMemoryResource
 Type alias for device memory resource.
 
using PINNED_MR = CudaPinnedMemoryResource
 Type alias for pinned memory resource.
 

Public Member Functions

 CudaDevice (int device_id)
 Constructs a CudaDevice with specified device ID.
 
int getDeviceId () const
 Gets the CUDA device ID.
 
constexpr DeviceType getDeviceType () const override
 Gets the type of this compute device.
 
std::string getName () const override
 Gets the name of this CUDA device.
 
const DevicePropsgetProperties () const
 Gets the properties of this CUDA device.
 
bool isFp16Supported ()
 Checks if the device supports FP16 precision.
 
bool isFp4Supported ()
 Checks if the device supports FP4 precision.
 
bool isFp8Supported ()
 Checks if the device supports FP8 precision.
 
- Public Member Functions inherited from Mila::Dnn::Compute::ComputeDevice
virtual ~ComputeDevice ()=default
 Virtual destructor.
 

Static Public Member Functions

static void registerDevices ()
 Registers all available CUDA devices with the DeviceRegistry.
 

Private Attributes

int device_id_
 The CUDA device ID.
 
DeviceProps props_
 Device properties.
 

Static Private Attributes

static bool registered_ { false }
 Flag indicating if devices have been registered.
 

Detailed Description

Class representing a CUDA compute device.

This class provides an interface to interact with NVIDIA CUDA-capable GPUs within the Mila framework. It handles device properties retrieval and registration in the DeviceRegistry. Device activation is managed by the DeviceContext class.

Member Typedef Documentation

◆ MANAGED_MR

Type alias for managed memory resource.

◆ MR

Type alias for device memory resource.

◆ PINNED_MR

Type alias for pinned memory resource.

Constructor & Destructor Documentation

◆ CudaDevice()

Mila::Dnn::Compute::CudaDevice::CudaDevice ( int  device_id)
inlineexplicit

Constructs a CudaDevice with specified device ID.

Parameters
device_idThe CUDA device ID to initialize.

Member Function Documentation

◆ getDeviceId()

int Mila::Dnn::Compute::CudaDevice::getDeviceId ( ) const
inline

Gets the CUDA device ID.

Returns
int The device ID for this CUDA device.

◆ getDeviceType()

constexpr DeviceType Mila::Dnn::Compute::CudaDevice::getDeviceType ( ) const
inlineconstexproverridevirtual

Gets the type of this compute device.

Returns
DeviceType The device type (CUDA).

Implements Mila::Dnn::Compute::ComputeDevice.

◆ getName()

std::string Mila::Dnn::Compute::CudaDevice::getName ( ) const
inlineoverridevirtual

Gets the name of this CUDA device.

Returns
std::string The device name in format "CUDA:<device_id>".

Implements Mila::Dnn::Compute::ComputeDevice.

◆ getProperties()

const DeviceProps & Mila::Dnn::Compute::CudaDevice::getProperties ( ) const
inline

Gets the properties of this CUDA device.

Returns
const DeviceProps& Reference to the device properties.

◆ isFp16Supported()

bool Mila::Dnn::Compute::CudaDevice::isFp16Supported ( )
inline

Checks if the device supports FP16 precision.

Returns
bool True if FP16 is supported, false otherwise.

◆ isFp4Supported()

bool Mila::Dnn::Compute::CudaDevice::isFp4Supported ( )
inline

Checks if the device supports FP4 precision.

Returns
bool True if FP4 is supported, false otherwise.

◆ isFp8Supported()

bool Mila::Dnn::Compute::CudaDevice::isFp8Supported ( )
inline

Checks if the device supports FP8 precision.

Returns
bool True if FP8 is supported, false otherwise.

◆ registerDevices()

static void Mila::Dnn::Compute::CudaDevice::registerDevices ( )
inlinestatic

Registers all available CUDA devices with the DeviceRegistry.

This method discovers all CUDA devices in the system and registers them with the DeviceRegistry for later instantiation. It performs the registration only once, even if called multiple times.

Here is the call graph for this function:

Member Data Documentation

◆ device_id_

int Mila::Dnn::Compute::CudaDevice::device_id_
private

The CUDA device ID.

◆ props_

DeviceProps Mila::Dnn::Compute::CudaDevice::props_
private

Device properties.

◆ registered_

bool Mila::Dnn::Compute::CudaDevice::registered_ { false }
inlinestaticprivate

Flag indicating if devices have been registered.


The documentation for this class was generated from the following file: