Skip to content

Commit 13856fc

Browse files
committed
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.
1 parent 7808280 commit 13856fc

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎cpp/src/arrow/gpu/cuda_context.cc‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class CudaContext::Impl {
169169
"cuIpcGetMemHandle",
170170
cuIpcGetMemHandle(&cu_handle, reinterpret_cast<CUdeviceptr>(data)));
171171
}
172-
return std::make_shared<CudaIpcMemHandle>(size, &cu_handle);
172+
return std::shared_ptr<CudaIpcMemHandle>(new CudaIpcMemHandle(size, &cu_handle));
173173
}
174174

175175
Status OpenIpcBuffer(const CudaIpcMemHandle& ipc_handle, uint8_t** out) {
@@ -247,14 +247,14 @@ std::shared_ptr<MemoryManager> CudaDevice::default_memory_manager() {
247247

248248
Result<std::shared_ptr<CudaContext>> CudaDevice::GetContext() {
249249
// XXX should we cache a default context in CudaDevice instance?
250-
auto context = std::make_shared<CudaContext>();
250+
auto context = std::shared_ptr<CudaContext>(new CudaContext());
251251
auto self = checked_pointer_cast<CudaDevice>(shared_from_this());
252252
RETURN_NOT_OK(context->impl_->Init(self));
253253
return context;
254254
}
255255

256256
Result<std::shared_ptr<CudaContext>> CudaDevice::GetSharedContext(void* handle) {
257-
auto context = std::make_shared<CudaContext>();
257+
auto context = std::shared_ptr<CudaContext>(new CudaContext());
258258
auto self = checked_pointer_cast<CudaDevice>(shared_from_this());
259259
RETURN_NOT_OK(context->impl_->InitShared(self, reinterpret_cast<CUcontext>(handle)));
260260
return context;
@@ -286,7 +286,7 @@ Result<std::shared_ptr<CudaDevice>> AsCudaDevice(const std::shared_ptr<Device>&
286286

287287
std::shared_ptr<CudaMemoryManager> CudaMemoryManager::Make(
288288
const std::shared_ptr<Device>& device) {
289-
return std::make_shared<CudaMemoryManager>(device);
289+
return std::shared_ptr<CudaMemoryManager>(new CudaMemoryManager(device));
290290
}
291291

292292
std::shared_ptr<CudaDevice> CudaMemoryManager::cuda_device() const {
@@ -476,7 +476,7 @@ class CudaDeviceManager::Impl {
476476
Result<std::shared_ptr<CudaDevice>> MakeDevice(int device_number) {
477477
DeviceProperties props;
478478
RETURN_NOT_OK(props.Init(device_number));
479-
return std::make_shared<CudaDevice>({std::move(props)});
479+
return std::shared_ptr<CudaDevice>(new CudaDevice({std::move(props)}));
480480
}
481481

482482
private:

‎cpp/src/arrow/gpu/cuda_memory.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ CudaIpcMemHandle::~CudaIpcMemHandle() {}
7373

7474
Result<std::shared_ptr<CudaIpcMemHandle>> CudaIpcMemHandle::FromBuffer(
7575
const void* opaque_handle) {
76-
return std::make_shared<CudaIpcMemHandle>(opaque_handle);
76+
return std::shared_ptr<CudaIpcMemHandle>(new CudaIpcMemHandle(opaque_handle));
7777
}
7878

7979
Result<std::shared_ptr<Buffer>> CudaIpcMemHandle::Serialize(MemoryPool* pool) const {

0 commit comments

Comments
 (0)