zeroshade commented on code in PR #37365:
URL: https://github.com/apache/arrow/pull/37365#discussion_r1307713872
##########
cpp/src/arrow/gpu/cuda_context.cc:
##########
@@ -293,11 +334,32 @@ std::shared_ptr<CudaDevice>
CudaMemoryManager::cuda_device() const {
return checked_pointer_cast<CudaDevice>(device_);
}
+Result<std::shared_ptr<Device::SyncEvent>>
CudaMemoryManager::MakeDeviceSyncEvent() {
+ ARROW_ASSIGN_OR_RAISE(auto context, cuda_device()->GetContext());
+ ContextSaver set_temporary((CUcontext)(context.get()->handle()));
+
+ // TODO: event creation flags??
+ CUevent ev;
+ CU_RETURN_NOT_OK("cuEventCreate", cuEventCreate(&ev, CU_EVENT_DEFAULT));
+
+ return std::shared_ptr<Device::SyncEvent>(
+ new CudaDevice::SyncEvent(context, new CUevent(ev), [](void* ev) {
+ auto typed_event = reinterpret_cast<CUevent*>(ev);
+ auto result = cuEventDestroy(*typed_event);
+ if (result != CUDA_SUCCESS) {
+ // should we throw? I think that would automatically terminate
+ // if you throw in a destructor. What should we do with this error?
Review Comment:
Thoughts on using `DCHECK_OK` instead? Or should I just do the
ARROW_LOG(warning)?
--
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]