From b804fbe384e6f6c9fe96322ec0e92d48bccd0a42 Mon Sep 17 00:00:00 2001 From: Milot Mirdita Date: Sat, 18 Jan 2025 19:17:22 +0900 Subject: [PATCH] Include CUDA_VISIBLE_DEVICES into shm hash, so same db can be loaded into multiple GPUs --- src/commons/GpuUtil.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commons/GpuUtil.h b/src/commons/GpuUtil.h index deb354a9..8f42ad76 100644 --- a/src/commons/GpuUtil.h +++ b/src/commons/GpuUtil.h @@ -41,6 +41,10 @@ struct GPUSharedMemory { static std::string getShmHash(const std::string& db) { std::string dbpath = FileUtil::getRealPathFromSymLink(PrefilteringIndexReader::dbPathWithoutIndex(db)); + char* visibleDevices = getenv("CUDA_VISIBLE_DEVICES"); + if (visibleDevices) { + dbpath.append(visibleDevices); + } size_t hash = Util::hash(dbpath.c_str(), dbpath.length()); return SSTR(hash); }