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

Wrapper for CUDA device properties with cached values. More...

Public Member Functions

 CudaDeviceProps (int device_id)
 Constructs device properties for specified CUDA device.
std::pair< int, int > getComputeCapability () const
 Gets compute capability as major/minor version pair.
std::string getName () const
 Gets the device name.

Public Attributes

int clockRate { 0 }
int l2CacheSize { 0 }
int major { 0 }
int maxGridSize [3] { 0, 0, 0 }
int maxThreadsDim [3] { 0, 0, 0 }
int maxThreadsPerBlock { 0 }
int memoryBusWidth { 0 }
int memoryClockRate { 0 }
int minor { 0 }
int multiProcessorCount { 0 }
std::string name
int pciBusID { 0 }
int pciDeviceID { 0 }
int pciDomainID { 0 }
size_t sharedMemPerBlock { 0 }
size_t totalGlobalMem { 0 }
int warpSize { 0 }

Detailed Description

Wrapper for CUDA device properties with cached values.

Queries and caches CUDA device properties on construction. The underlying cudaDeviceProp struct is used only during construction as a local variable and is not retained as a member to keep this class safe to import from any module that exports a class template.

CUDA 13.0+ Compatibility:

  • clockRate and memoryClockRate fields are deprecated (always 0).
  • Uses cudaDeviceGetAttribute for clock rates instead.

Constructor & Destructor Documentation

◆ CudaDeviceProps()

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

Constructs device properties for specified CUDA device.

Queries CUDA runtime for device properties and caches all needed values. For CUDA 13.0+, clock rates are queried via device attributes.

Parameters
device_idCUDA device ID (0-based).
Exceptions
std::runtime_errorIf device properties query fails.

Member Function Documentation

◆ getComputeCapability()

std::pair< int, int > Mila::Dnn::Compute::CudaDeviceProps::getComputeCapability ( ) const
inline

Gets compute capability as major/minor version pair.

Returns
std::pair<int, int> e.g. {8, 9} for SM 8.9.

◆ getName()

std::string Mila::Dnn::Compute::CudaDeviceProps::getName ( ) const
inline

Gets the device name.

Returns
std::string Device name.

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