MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / getBoundGpuUuid

Function getBoundGpuUuid

quest/src/gpu/gpu_config.cpp:334–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332
333
334std::array<char,17> getBoundGpuUuid() {
335#if COMPILE_CUDA
336 assert_gpuHasBeenBound(hasGpuBeenBound);
337
338 constexpr int numUuidChars = 16;
339 constexpr int numOutChars = numUuidChars + 1; // terminal char
340
341 std::array<char,numOutChars> out;
342 cudaUUID_t uuid;
343
344 // ROCm v5's cudaDeviceProp doesn't have a uuid field
345 #if defined(__HIP__)
346 hipDevice_t device;
347 CUDA_CHECK( hipDeviceGet(&device, getBoundGpuId()) );
348 CUDA_CHECK( hipDeviceGetUuid(&uuid, device) );
349 #else
350 cudaDeviceProp prop;
351 CUDA_CHECK( cudaGetDeviceProperties(&prop, getBoundGpuId()) );
352 uuid = prop.uuid;
353 #endif
354
355 // copy char[16] to out[17] (not human readable)
356 std::copy_n(uuid.bytes, numUuidChars, out.begin());
357
358 // include terminal char so that subsequent to-string
359 // operations will succeed without knowing string length
360 out[numOutChars-1] = '\0';
361 return out;
362
363#else
364 error_gpuQueriedButGpuNotCompiled();
365 return {};
366#endif
367}
368
369
370void gpu_bindLocalGPUsToNodes() {

Callers 1

Calls 3

assert_gpuHasBeenBoundFunction · 0.85
getBoundGpuIdFunction · 0.85

Tested by

no test coverage detected