From 69d0aa974697233178f2bbbcc8da9a3a61eda8ce Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 17 Jun 2021 11:44:04 +0200 Subject: [PATCH] nvidia/cuda/context: Log the current device name, UUId und LUId --- source/nvidia/cuda/nvidia-cuda-context.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source/nvidia/cuda/nvidia-cuda-context.cpp b/source/nvidia/cuda/nvidia-cuda-context.cpp index e0baef41..c6c7d95d 100644 --- a/source/nvidia/cuda/nvidia-cuda-context.cpp +++ b/source/nvidia/cuda/nvidia-cuda-context.cpp @@ -90,6 +90,29 @@ streamfx::nvidia::cuda::context::context(ID3D11Device* device) : context() throw std::runtime_error("Failed to acquire primary device context."); } + // Log some information. + std::string device_name; + uuid_t device_uuid; + luid_t device_luid; + uint32_t device_luid_mask; + { + // Device Name + std::vector name(256, 0); + _cuda->cuDeviceGetName(name.data(), name.size() - 1, _device); + device_name = std::string(name.data(), name.data() + strlen(name.data())); + + // Device LUID + _cuda->cuDeviceGetLuid(&device_luid, &device_luid_mask, _device); + + // Device UUID + _cuda->cuDeviceGetUuid(&device_uuid, _device); + } + + D_LOG_INFO("Initialized CUDA on device '%s' (%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-%04" PRIx16 "-%04" PRIx16 + "%08" PRIx32 ", %08" PRIx64 ", %" PRIu32 ").", + device_name.c_str(), device_uuid.uuid.a, device_uuid.uuid.b, device_uuid.uuid.c, device_uuid.uuid.d, + device_uuid.uuid.e, device_uuid.uuid.f, device_luid.luid, device_luid_mask); + _has_device = true; } #endif