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

Class representing a CPU compute device. More...

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

Public Member Functions

 CpuDevice (DeviceConstructionKey key)
 Construct CPU device.
constexpr DeviceId getDeviceId () const override
 Gets the device identifier.
std::string getDeviceName () const override
 Gets the device name.
constexpr DeviceType getDeviceType () const override
 Gets the device type.
Public Member Functions inherited from Mila::Dnn::Compute::Device
virtual ~Device ()=default

Additional Inherited Members

Static Public Member Functions inherited from Mila::Dnn::Compute::Device
static constexpr DeviceId Cpu () noexcept
 Create CPU device identifier.
static constexpr DeviceId Cuda (int index) noexcept
 Create CUDA device identifier.
template<DeviceType TDeviceType>
static constexpr DeviceId getDeviceId (int index) noexcept
static constexpr DeviceId Metal (int index) noexcept
 Create Metal device identifier.
static constexpr DeviceId Rocm (int index) noexcept
 Create ROCm device identifier.

Detailed Description

Class representing a CPU compute device.

Provides an interface to interact with CPU compute resources. CPU is treated as a single logical device without numeric indexing (always index 0).

Device instances are created exclusively by DeviceRegistry. Users should obtain devices through DeviceRegistry::getDevice().

Constructor & Destructor Documentation

◆ CpuDevice()

Mila::Dnn::Compute::CpuDevice::CpuDevice ( DeviceConstructionKey key)
inlineexplicit

Construct CPU device.

Parameters
keyConstruction key ensuring only DeviceRegistry can create instances

Member Function Documentation

◆ getDeviceId()

DeviceId Mila::Dnn::Compute::CpuDevice::getDeviceId ( ) const
inlineconstexproverridevirtual

Gets the device identifier.

For CPU, this always returns Device::Cpu() (type=Cpu, index=0).

Returns
DeviceId The CPU device identifier.

Implements Mila::Dnn::Compute::Device.

Here is the call graph for this function:

◆ getDeviceName()

std::string Mila::Dnn::Compute::CpuDevice::getDeviceName ( ) const
inlineoverridevirtual

Gets the device name.

Returns
std::string The device name ("CPU:0").

Implements Mila::Dnn::Compute::Device.

◆ getDeviceType()

DeviceType Mila::Dnn::Compute::CpuDevice::getDeviceType ( ) const
inlineconstexproverridevirtual

Gets the device type.

Returns
DeviceType The device type (Cpu).

Implements Mila::Dnn::Compute::Device.


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