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

Function gpu_areAnyNodesBoundToSameGpu

quest/src/gpu/gpu_config.cpp:394–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392
393
394bool gpu_areAnyNodesBoundToSameGpu() {
395#if COMPILE_CUDA
396 assert_gpuHasBeenBound(hasGpuBeenBound);
397
398 if (!comm_isInit())
399 return false;
400
401 // obtain bound GPU's UUID; a unique identifier 16-char identifier
402 auto uuidStr = getBoundGpuUuid();
403
404 // we can repurpose string-to-root sending to collect all uuids
405 auto allUuids = comm_gatherStringsToRoot(uuidStr.data(), uuidStr.size());
406 auto uniqueUuids = std::set<std::string>(allUuids.begin(), allUuids.end());
407
408 // and assess whether they're all unique (non-root's bools are overwritten)
409 bool localGpusAreUnique = allUuids.size() == uniqueUuids.size();
410 bool globalGpusAreUnique = comm_isTrueOnRootNode(localGpusAreUnique);
411 return ! globalGpusAreUnique;
412
413#else
414 error_gpuQueriedButGpuNotCompiled();
415 return false;
416#endif
417}
418
419
420void gpu_sync() {

Callers 1

Calls 6

assert_gpuHasBeenBoundFunction · 0.85
comm_isInitFunction · 0.85
getBoundGpuUuidFunction · 0.85
comm_gatherStringsToRootFunction · 0.85
comm_isTrueOnRootNodeFunction · 0.85

Tested by

no test coverage detected