nvidia/cuda: Add functions to get device name, UUId and LUId

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-17 11:43:28 +02:00
parent b4c7d5f91c
commit 1a5dad8d97
2 changed files with 31 additions and 1 deletions

View file

@ -114,7 +114,9 @@ streamfx::nvidia::cuda::cuda::cuda() : _library()
{ // 3. Load remaining functions.
// Device Management
// - Not yet needed.
P_CUDA_LOAD_SYMBOL(cuDeviceGetName);
P_CUDA_LOAD_SYMBOL(cuDeviceGetLuid);
P_CUDA_LOAD_SYMBOL(cuDeviceGetUuid);
// Primary Context Management
P_CUDA_LOAD_SYMBOL(cuDevicePrimaryCtxRetain);

View file

@ -162,6 +162,31 @@ namespace streamfx::nvidia::cuda {
uint32_t reserved[16];
};
struct uuid_t {
union {
char bytes[16];
struct {
uint32_t a;
uint16_t b;
uint16_t c;
uint16_t d;
uint16_t e;
uint32_t f;
} uuid;
};
};
struct luid_t {
union {
char bytes[8];
struct {
uint32_t low;
int32_t high;
} parts;
uint64_t luid;
};
};
class cuda_error : public std::exception {
::streamfx::nvidia::cuda::result _code;
@ -192,6 +217,9 @@ namespace streamfx::nvidia::cuda {
P_CUDA_DEFINE_FUNCTION(cuDriverGetVersion, int32_t* driverVersion);
// Device Management
P_CUDA_DEFINE_FUNCTION(cuDeviceGetName, char* name, int32_t length, device_t device);
P_CUDA_DEFINE_FUNCTION(cuDeviceGetLuid, luid_t* luid, uint32_t* device_node_mask, device_t device);
P_CUDA_DEFINE_FUNCTION(cuDeviceGetUuid, uuid_t* uuid, device_t device);
// - Not yet needed.
// Primary Context Management