![]() |
ImFusion SDK 4.3
|
#include <ImFusion/ML/CudaUtils.h>
Singleton class that helps getting a compatible CUDA device. More...
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< CudaDeviceProp > | getDeviceProperties (int deviceIndex) const |
| Wrapper around the cudaGetDeviceProperties function. | |
| std::optional< int > | getCudaRuntimeVersion () const |
| Wrapper around the cudaRuntimeGetVersion function. | |
Static Public Member Functions | |
| static CudaDeviceManager & | instance () |
| Get the singleton instance. | |
| 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.
| int getDeviceCount | ( | ) | const |
Wrapper around the cudaGetDeviceCount function.
Can be replaced by a mock for testing purposes.
| std::optional< CudaDeviceProp > getDeviceProperties | ( | int | deviceIndex | ) | const |
Wrapper around the cudaGetDeviceProperties function.
Can be replaced by a mock for testing purposes.
| std::optional< int > getCudaRuntimeVersion | ( | ) | const |
Wrapper around the cudaRuntimeGetVersion function.
Can be replaced by a mock for testing purposes.