Skip to content
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

NCCLAllocator: Fix build failure #1818

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions apex/contrib/csrc/nccl_allocator/NCCLAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ c10::cuda::CUDACachingAllocator::SnapshotInfo NCCLAllocator::snapshot() {
return result;
}

c10::cuda::CUDACachingAllocator::ShareableHandle NCCLAllocator::
shareIpcHandle(void* ptr) {
TORCH_CHECK(
false,
"CUDAPluggableAllocator does not yet support shareIPcHandle. "
"If you need it, please file an issue describing your use case.");
}

std::shared_ptr<void> NCCLAllocator::getIpcDevPtr(std::string handle) {
TORCH_CHECK(
false,
Expand Down Expand Up @@ -432,4 +440,10 @@ void NCCLAllocator::copy_data(void* dest, const void* src, std::size_t count)
cudaMemcpy(dest, src, count, cudaMemcpyKind::cudaMemcpyDeviceToDevice));
}

void NCCLAllocator::enable(bool) {}

bool NCCLAllocator::isEnabled() const {
return true;
}

} // namespace nccl_allocator::cuda
4 changes: 4 additions & 0 deletions apex/contrib/csrc/nccl_allocator/NCCLAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ struct NCCLAllocator
override;
void releasePool(c10::DeviceIndex device, c10::cuda::MempoolId_t mempool_id) override;
std::shared_ptr<void> getIpcDevPtr(std::string handle) override;
c10::cuda::CUDACachingAllocator::ShareableHandle shareIpcHandle(
void*) override;
void recordHistory(
bool enabled,
c10::cuda::CUDACachingAllocator::CreateContextFn context_recorder,
Expand All @@ -85,6 +87,8 @@ struct NCCLAllocator
bool p2p_enabled) override;
std::string name() override;
void copy_data(void* dest, const void* src, std::size_t count) const;
void enable(bool) override;
bool isEnabled() const override;

protected:
std::function<void(int)> init_fn_;
Expand Down