Skip to content

Fix #509 #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/mscclpp/gpu_utils.hpp
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ class GpuStream {

/// A pool of managed GPU streams. Only provides non-blocking streams.
/// This is intended to be used for reusing temporal streams.
class GpuStreamPool : public std::enable_shared_from_this<GpuStreamPool> {
class GpuStreamPool {
public:
GpuStreamPool();

13 changes: 9 additions & 4 deletions src/gpu_utils.cc
Original file line number Diff line number Diff line change
@@ -39,16 +39,21 @@ GpuStream GpuStreamPool::getStream() {
if (!streams_.empty()) {
auto stream = streams_.back();
streams_.pop_back();
return GpuStream(shared_from_this(), stream);
return GpuStream(gpuStreamPool(), stream);
}
return GpuStream(shared_from_this(), std::make_shared<CudaStreamWithFlags>(cudaStreamNonBlocking));
return GpuStream(gpuStreamPool(), std::make_shared<CudaStreamWithFlags>(cudaStreamNonBlocking));
}

void GpuStreamPool::clear() { streams_.clear(); }

// A global pool instance
std::shared_ptr<GpuStreamPool> gGpuStreamPool_;

std::shared_ptr<GpuStreamPool> gpuStreamPool() {
static std::shared_ptr<GpuStreamPool> pool = std::make_shared<GpuStreamPool>();
return pool;
if (!gGpuStreamPool_) {
gGpuStreamPool_ = std::make_shared<GpuStreamPool>();
}
return gGpuStreamPool_;
}

namespace detail {
Loading
Oops, something went wrong.