From 895ea1fb99c21cc20dd4bb4ba8331db01d7b0cd8 Mon Sep 17 00:00:00 2001 From: Tarang Jain Date: Tue, 14 May 2024 11:19:40 -0700 Subject: [PATCH 1/2] fix raft handle --- faiss/gpu/StandardGpuResources.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/faiss/gpu/StandardGpuResources.cpp b/faiss/gpu/StandardGpuResources.cpp index 004f80a27e..e6d49a9254 100644 --- a/faiss/gpu/StandardGpuResources.cpp +++ b/faiss/gpu/StandardGpuResources.cpp @@ -257,6 +257,14 @@ void StandardGpuResourcesImpl::setDefaultStream( if (prevStream != stream) { streamWait({stream}, {prevStream}); } +#if defined USE_NVIDIA_RAFT + // delete the raft handle for this device, which will be initialized + // with the updated stream during any subsequent calls to getRaftHandle + auto it = raftHandles_.find(device); + if (it != raftHandles_.end()) { + raftHandles_.erase(it); + } +#endif } userDefaultStreams_[device] = stream; @@ -275,6 +283,14 @@ void StandardGpuResourcesImpl::revertDefaultStream(int device) { streamWait({newStream}, {prevStream}); } +#if defined USE_NVIDIA_RAFT + // delete the raft handle for this device, which will be initialized + // with the updated stream during any subsequent calls to getRaftHandle + auto it = raftHandles_.find(device); + if (it != raftHandles_.end()) { + raftHandles_.erase(it); + } +#endif } userDefaultStreams_.erase(device); From 2fca37748abcd211f6aa9d5fea30dc57cb96af31 Mon Sep 17 00:00:00 2001 From: Tarang Jain Date: Tue, 14 May 2024 13:11:50 -0700 Subject: [PATCH 2/2] compilation error --- faiss/gpu/StandardGpuResources.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/faiss/gpu/StandardGpuResources.cpp b/faiss/gpu/StandardGpuResources.cpp index e6d49a9254..78336b4994 100644 --- a/faiss/gpu/StandardGpuResources.cpp +++ b/faiss/gpu/StandardGpuResources.cpp @@ -260,9 +260,9 @@ void StandardGpuResourcesImpl::setDefaultStream( #if defined USE_NVIDIA_RAFT // delete the raft handle for this device, which will be initialized // with the updated stream during any subsequent calls to getRaftHandle - auto it = raftHandles_.find(device); - if (it != raftHandles_.end()) { - raftHandles_.erase(it); + auto it2 = raftHandles_.find(device); + if (it2 != raftHandles_.end()) { + raftHandles_.erase(it2); } #endif } @@ -286,9 +286,9 @@ void StandardGpuResourcesImpl::revertDefaultStream(int device) { #if defined USE_NVIDIA_RAFT // delete the raft handle for this device, which will be initialized // with the updated stream during any subsequent calls to getRaftHandle - auto it = raftHandles_.find(device); - if (it != raftHandles_.end()) { - raftHandles_.erase(it); + auto it2 = raftHandles_.find(device); + if (it2 != raftHandles_.end()) { + raftHandles_.erase(it2); } #endif }