Mila 0.13.48
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 }

Private Attributes

int device_id_ { 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.
Here is the call graph for this function:

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.

Member Data Documentation

◆ clockRate

int Mila::Dnn::Compute::CudaDeviceProps::clockRate { 0 }

◆ device_id_

int Mila::Dnn::Compute::CudaDeviceProps::device_id_ { 0 }
private

◆ l2CacheSize

int Mila::Dnn::Compute::CudaDeviceProps::l2CacheSize { 0 }

◆ major

int Mila::Dnn::Compute::CudaDeviceProps::major { 0 }

◆ maxGridSize

int Mila::Dnn::Compute::CudaDeviceProps::maxGridSize[3] { 0, 0, 0 }

◆ maxThreadsDim

int Mila::Dnn::Compute::CudaDeviceProps::maxThreadsDim[3] { 0, 0, 0 }

◆ maxThreadsPerBlock

int Mila::Dnn::Compute::CudaDeviceProps::maxThreadsPerBlock { 0 }

◆ memoryBusWidth

int Mila::Dnn::Compute::CudaDeviceProps::memoryBusWidth { 0 }

◆ memoryClockRate

int Mila::Dnn::Compute::CudaDeviceProps::memoryClockRate { 0 }

◆ minor

int Mila::Dnn::Compute::CudaDeviceProps::minor { 0 }

◆ multiProcessorCount

int Mila::Dnn::Compute::CudaDeviceProps::multiProcessorCount { 0 }

◆ name

std::string Mila::Dnn::Compute::CudaDeviceProps::name

◆ pciBusID

int Mila::Dnn::Compute::CudaDeviceProps::pciBusID { 0 }

◆ pciDeviceID

int Mila::Dnn::Compute::CudaDeviceProps::pciDeviceID { 0 }

◆ pciDomainID

int Mila::Dnn::Compute::CudaDeviceProps::pciDomainID { 0 }

◆ sharedMemPerBlock

size_t Mila::Dnn::Compute::CudaDeviceProps::sharedMemPerBlock { 0 }

◆ totalGlobalMem

size_t Mila::Dnn::Compute::CudaDeviceProps::totalGlobalMem { 0 }

◆ warpSize

int Mila::Dnn::Compute::CudaDeviceProps::warpSize { 0 }

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