| 431 | } |
| 432 | |
| 433 | Result<std::unique_ptr<Buffer>> CudaMemoryManager::CopyNonOwnedTo( |
| 434 | const Buffer& buf, const std::shared_ptr<MemoryManager>& to) { |
| 435 | if (to->is_cpu()) { |
| 436 | auto sync_event = buf.device_sync_event(); |
| 437 | if (sync_event) { |
| 438 | RETURN_NOT_OK(sync_event->Wait()); |
| 439 | } |
| 440 | |
| 441 | // Device-to-CPU copy |
| 442 | std::unique_ptr<Buffer> dest; |
| 443 | ARROW_ASSIGN_OR_RAISE(auto from_context, cuda_device()->GetContext()); |
| 444 | ARROW_ASSIGN_OR_RAISE(dest, to->AllocateBuffer(buf.size())); |
| 445 | RETURN_NOT_OK( |
| 446 | from_context->CopyDeviceToHost(dest->mutable_data(), buf.address(), buf.size())); |
| 447 | return dest; |
| 448 | } |
| 449 | return nullptr; |
| 450 | } |
| 451 | |
| 452 | Result<std::shared_ptr<Buffer>> CudaMemoryManager::CopyBufferFrom( |
| 453 | const std::shared_ptr<Buffer>& buf, const std::shared_ptr<MemoryManager>& from) { |
nothing calls this directly
no test coverage detected