Skip to content

Commit

Permalink
Delete Raft Handle (facebookresearch#3435)
Browse files Browse the repository at this point in the history
Summary:
Small Raft related modification to StandardGpuResources:
if the stream for a particular device is modified by a user, delete the Raft handle for that device. On any subsequent call to `getRaftHandle(device)`, a new raft handle with the updated stream will be created.
Closes facebookresearch#3424

Pull Request resolved: facebookresearch#3435

Reviewed By: ramilbakhshyiev

Differential Revision: D57640976

Pulled By: junjieqi

fbshipit-source-id: 41e2898a39250b7e52e920b71e819fc21ca9fc85
  • Loading branch information
tarang-jain authored and abhinavdangeti committed Jul 12, 2024
1 parent 6cbaa69 commit 22232d7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions faiss/gpu/StandardGpuResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 it2 = raftHandles_.find(device);
if (it2 != raftHandles_.end()) {
raftHandles_.erase(it2);
}
#endif
}

userDefaultStreams_[device] = stream;
Expand All @@ -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 it2 = raftHandles_.find(device);
if (it2 != raftHandles_.end()) {
raftHandles_.erase(it2);
}
#endif
}

userDefaultStreams_.erase(device);
Expand Down

0 comments on commit 22232d7

Please sign in to comment.