nvidia/cuda: Print the Driver CUDA version to the log

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-04-26 02:34:19 +02:00
parent 3c05d892e6
commit 70f54b312b

View file

@ -132,6 +132,19 @@ nvidia::cuda::cuda::cuda() : _library()
CUDA_LOAD_SYMBOL(cuGraphicsD3D11RegisterResource);
#endif
// Log found CUDA version.
{
int32_t cuda_version = 0;
if (cuDriverGetVersion(&cuda_version) == result::SUCCESS) {
int32_t major = cuda_version / 1000;
int32_t minor = (cuda_version % 1000) / 10;
int32_t patch = (cuda_version % 10);
D_LOG_INFO("Driver reported CUDA version: %" PRId32 ".%" PRId32 ".%" PRId32, major, minor, patch);
} else {
D_LOG_WARNING("Failed to query NVIDIA CUDA Driver for version.", 0);
}
}
// Initialize CUDA
cuInit(0);
}