From 13856fc673b9446bc498854754070de02953db81 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 26 Sep 2022 05:18:48 +0900 Subject: [PATCH] ARROW-17823: [C++] Revert std::make_shared change for CUDA This is a follow-up of #14216. We can't use std::make_shared for CUDA related classes because their constructors aren't public. --- cpp/src/arrow/gpu/cuda_context.cc | 10 +++++----- cpp/src/arrow/gpu/cuda_memory.cc | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/src/arrow/gpu/cuda_context.cc b/cpp/src/arrow/gpu/cuda_context.cc index c0c271f399148..f754c07d13c89 100644 --- a/cpp/src/arrow/gpu/cuda_context.cc +++ b/cpp/src/arrow/gpu/cuda_context.cc @@ -169,7 +169,7 @@ class CudaContext::Impl { "cuIpcGetMemHandle", cuIpcGetMemHandle(&cu_handle, reinterpret_cast(data))); } - return std::make_shared(size, &cu_handle); + return std::shared_ptr(new CudaIpcMemHandle(size, &cu_handle)); } Status OpenIpcBuffer(const CudaIpcMemHandle& ipc_handle, uint8_t** out) { @@ -247,14 +247,14 @@ std::shared_ptr CudaDevice::default_memory_manager() { Result> CudaDevice::GetContext() { // XXX should we cache a default context in CudaDevice instance? - auto context = std::make_shared(); + auto context = std::shared_ptr(new CudaContext()); auto self = checked_pointer_cast(shared_from_this()); RETURN_NOT_OK(context->impl_->Init(self)); return context; } Result> CudaDevice::GetSharedContext(void* handle) { - auto context = std::make_shared(); + auto context = std::shared_ptr(new CudaContext()); auto self = checked_pointer_cast(shared_from_this()); RETURN_NOT_OK(context->impl_->InitShared(self, reinterpret_cast(handle))); return context; @@ -286,7 +286,7 @@ Result> AsCudaDevice(const std::shared_ptr& std::shared_ptr CudaMemoryManager::Make( const std::shared_ptr& device) { - return std::make_shared(device); + return std::shared_ptr(new CudaMemoryManager(device)); } std::shared_ptr CudaMemoryManager::cuda_device() const { @@ -476,7 +476,7 @@ class CudaDeviceManager::Impl { Result> MakeDevice(int device_number) { DeviceProperties props; RETURN_NOT_OK(props.Init(device_number)); - return std::make_shared({std::move(props)}); + return std::shared_ptr(new CudaDevice({std::move(props)})); } private: diff --git a/cpp/src/arrow/gpu/cuda_memory.cc b/cpp/src/arrow/gpu/cuda_memory.cc index 9c357ba35db56..297e4dcf71e44 100644 --- a/cpp/src/arrow/gpu/cuda_memory.cc +++ b/cpp/src/arrow/gpu/cuda_memory.cc @@ -73,7 +73,7 @@ CudaIpcMemHandle::~CudaIpcMemHandle() {} Result> CudaIpcMemHandle::FromBuffer( const void* opaque_handle) { - return std::make_shared(opaque_handle); + return std::shared_ptr(new CudaIpcMemHandle(opaque_handle)); } Result> CudaIpcMemHandle::Serialize(MemoryPool* pool) const {