jorisvandenbossche commented on code in PR #40699:
URL: https://github.com/apache/arrow/pull/40699#discussion_r1537895899
##########
cpp/src/arrow/gpu/cuda_memory.cc:
##########
@@ -501,5 +502,27 @@ Result<std::shared_ptr<MemoryManager>>
DefaultMemoryMapper(ArrowDeviceType devic
}
}
+Result<std::shared_ptr<MemoryManager>> DefaultGPUMemoryMapper(int64_t
device_id) {
+ ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
+ return device->default_memory_manager();
+}
+
+Status RegisterCUDADeviceInternal() {
+ RETURN_NOT_OK(
+ RegisterDeviceMemoryManager(DeviceAllocationType::kCUDA,
DefaultGPUMemoryMapper));
+ RETURN_NOT_OK(RegisterDeviceMemoryManager(DeviceAllocationType::kCUDA_HOST,
+ DefaultGPUMemoryMapper));
+
RETURN_NOT_OK(RegisterDeviceMemoryManager(DeviceAllocationType::kCUDA_MANAGED,
+ DefaultGPUMemoryMapper));
+ return Status::OK();
+}
+
+std::once_flag cuda_registered;
+
+Status RegisterCUDADevice() {
Review Comment:
To be honest, I am not fully sure on what possible use cases would be. So
from my point of view of enabling importing CUDA data in pyarrow, registering
the CUDA device automatically is perfectly fine.
I assume it's quite unlikely that someone might want to register a different
CUDA device from C++?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]