|
Mila 0.13.48
Deep Neural Network Library
|
Abstract interface for compute device implementations. More...

Public Member Functions | |
| virtual | ~Device ()=default |
| virtual DeviceId | getDeviceId () const =0 |
| Gets the device identifier. | |
| virtual std::string | getDeviceName () const =0 |
| Gets the human-readable device name. | |
| virtual constexpr DeviceType | getDeviceType () const =0 |
| Gets the device type. | |
Static Public Member Functions | |
| 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. | |
Abstract interface for compute device implementations.
Defines the common interface for all compute device types (CPU, CUDA, Metal, ROCm, etc.). Concrete device implementations inherit from this class and are registered with DeviceRegistry for runtime discovery.
This class also serves as the primary factory for DeviceId values via static methods, providing a clean API: Device::Cuda(0), Device::Cpu().
|
virtualdefault |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Create CUDA device identifier.
| index | Zero-based CUDA device index (0, 1, 2, ...). |

|
pure virtual |
Gets the device identifier.
Implemented in Mila::Dnn::Compute::CpuDevice, and Mila::Dnn::Compute::CudaDevice.
|
inlinestaticconstexprnoexcept |
|
pure virtual |
Gets the human-readable device name.
Implemented in Mila::Dnn::Compute::CpuDevice, and Mila::Dnn::Compute::CudaDevice.
|
constexprpure virtual |
Gets the device type.
Implemented in Mila::Dnn::Compute::CpuDevice, and Mila::Dnn::Compute::CudaDevice.
|
inlinestaticconstexprnoexcept |
Create Metal device identifier.
| index | Zero-based Metal device index. |
|
inlinestaticconstexprnoexcept |
Create ROCm device identifier.
| index | Zero-based ROCm device index. |