nvidia/cuda: Add function to query version directly

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-04-26 04:05:44 +02:00
parent f316e0aa70
commit 47ef5dd995
2 changed files with 10 additions and 0 deletions

View file

@ -238,6 +238,13 @@ nvidia::cuda::cuda::cuda() : _library()
cuInit(0); cuInit(0);
} }
int32_t nvidia::cuda::cuda::version()
{
int32_t v = 0;
cuDriverGetVersion(&v);
return v;
}
std::shared_ptr<nvidia::cuda::cuda> nvidia::cuda::cuda::get() std::shared_ptr<nvidia::cuda::cuda> nvidia::cuda::cuda::get()
{ {
static std::weak_ptr<nvidia::cuda::cuda> instance; static std::weak_ptr<nvidia::cuda::cuda> instance;

View file

@ -19,6 +19,7 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <tuple>
#include "util/util-bitmask.hpp" #include "util/util-bitmask.hpp"
#include "util/util-library.hpp" #include "util/util-library.hpp"
@ -181,6 +182,8 @@ namespace nvidia::cuda {
~cuda(); ~cuda();
cuda(); cuda();
int32_t version();
public: public:
// Initialization // Initialization
CUDA_DEFINE_FUNCTION(cuInit, int32_t flags); CUDA_DEFINE_FUNCTION(cuInit, int32_t flags);