nvidia/cuda/context: Log the current device name, UUId und LUId

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-17 11:44:04 +02:00 committed by Xaymar
parent 90194ade6f
commit 69d0aa9746

View file

@ -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<char> 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