ImFusion SDK 4.3
CudaDeviceManager Class Referencefinal

#include <ImFusion/ML/CudaUtils.h>

Singleton class that helps getting a compatible CUDA device. More...

Detailed Description

Singleton class that helps getting a compatible CUDA device.

Classes

struct  CudaDeviceProp
 Abstracted and stripped down version of cudaDeviceProp. More...
 

Public Member Functions

std::optional< int > getCompatibleCudaDevice (std::optional< std::vector< std::string > > supportedArchitectures, std::optional< std::vector< int > > deviceIndices=std::nullopt)
 Returns the index of the first compatible CUDA device if there is one (otherwise returns std::nullopt).
 
int getDeviceCount () const
 Wrapper around the cudaGetDeviceCount function.
 
std::optional< CudaDevicePropgetDeviceProperties (int deviceIndex) const
 Wrapper around the cudaGetDeviceProperties function.
 
std::optional< int > getCudaRuntimeVersion () const
 Wrapper around the cudaRuntimeGetVersion function.
 

Static Public Member Functions

static CudaDeviceManagerinstance ()
 Get the singleton instance.
 

Member Function Documentation

◆ getCompatibleCudaDevice()

std::optional< int > getCompatibleCudaDevice ( std::optional< std::vector< std::string > > supportedArchitectures,
std::optional< std::vector< int > > deviceIndices = std::nullopt )

Returns the index of the first compatible CUDA device if there is one (otherwise returns std::nullopt).

If supportedArchitectures is provided (e.g. {"7.0", "8.0"}), the function will only consider CUDA devices that are supported. If deviceIndices is provided, the function will only check the specified devices (assumed to be ordered by preference) and return the first index which corresponds to a CUDA compatible device.

◆ getDeviceCount()

int getDeviceCount ( ) const

Wrapper around the cudaGetDeviceCount function.

Can be replaced by a mock for testing purposes.

◆ getDeviceProperties()

std::optional< CudaDeviceProp > getDeviceProperties ( int deviceIndex) const

Wrapper around the cudaGetDeviceProperties function.

Can be replaced by a mock for testing purposes.

◆ getCudaRuntimeVersion()

std::optional< int > getCudaRuntimeVersion ( ) const

Wrapper around the cudaRuntimeGetVersion function.

Can be replaced by a mock for testing purposes.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close