cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Classes | Namespaces | Macros | Typedefs | Functions
versions.hpp File Reference

Wrappers for Runtime API functions involving versions - of the CUDA runtime and of the CUDA driver. More...

#include <cuda/api/error.hpp>
#include <ostream>
#include <utility>
Include dependency graph for versions.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cuda::version_t
 CUDA Runtime version. More...
 

Namespaces

 cuda
 All definitions and functionality wrapping the CUDA Runtime API.
 

Typedefs

using cuda::combined_version_t = int
 

Functions

constexpr version_t cuda::version_numbers::none () noexcept
 This "value" is what the Runtime API returns if no version is supported by the driver. More...
 
version_t cuda::version_numbers::make (combined_version_t combined_version) noexcept
 Convert an integer representing a major and minor number (e.g. More...
 
version_t cuda::version_numbers::make (int major, int minor) noexcept
 Convert a pair integer representing a major and minor number (e.g. More...
 
version_t cuda::version_numbers::driver ()
 Obtains the maximum version of the CUDA Runtime supported by the driver currently loaded by the operating system. More...
 
version_t cuda::version_numbers::runtime ()
 Obtains the CUDA Runtime version. More...
 

Detailed Description

Wrappers for Runtime API functions involving versions - of the CUDA runtime and of the CUDA driver.

Also defines a cuda::version_t class for working with such versions (as they are not really single numbers) - which is what the wrappers return.

Function Documentation

◆ driver()

version_t cuda::version_numbers::driver ( )
inline

Obtains the maximum version of the CUDA Runtime supported by the driver currently loaded by the operating system.

Todo:
In future CUDA versions which support C++17 - return an optional
Returns
If an nVIDIA GPU driver is installed on this system, the maximum CUDA version it supports is returned. If no version is supported, version_numbers::none() is returned.

◆ make() [1/2]

version_t cuda::version_numbers::make ( combined_version_t  combined_version)
inlinenoexcept

Convert an integer representing a major and minor number (e.g.

55 for major version 5, minor version 5) into the version type we use (version_t).

◆ make() [2/2]

version_t cuda::version_numbers::make ( int  major,
int  minor 
)
inlinenoexcept

Convert a pair integer representing a major and minor number (e.g.

5 and 5) into the version type we use (version_t).

◆ none()

constexpr version_t cuda::version_numbers::none ( )
noexcept

This "value" is what the Runtime API returns if no version is supported by the driver.

Note
this is super-ugly, I'd rather n ot use it at all

◆ runtime()

version_t cuda::version_numbers::runtime ( )
inline

Obtains the CUDA Runtime version.

Note
unlike {driver()}, the value of none() cannot be returned, as we are actually using the runtime to obtain the version.