| 1424 | void SetUp() override { pool_ = default_memory_pool(); } |
| 1425 | |
| 1426 | static Result<std::shared_ptr<ArrayData>> ToDeviceData( |
| 1427 | const std::shared_ptr<MemoryManager>& mm, const ArrayData& data) { |
| 1428 | arrow::BufferVector buffers; |
| 1429 | for (const auto& buf : data.buffers) { |
| 1430 | if (buf) { |
| 1431 | ARROW_ASSIGN_OR_RAISE(auto dest, mm->CopyBuffer(buf, mm)); |
| 1432 | buffers.push_back(dest); |
| 1433 | } else { |
| 1434 | buffers.push_back(nullptr); |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | arrow::ArrayDataVector children; |
| 1439 | for (const auto& child : data.child_data) { |
| 1440 | ARROW_ASSIGN_OR_RAISE(auto dest, ToDeviceData(mm, *child)); |
| 1441 | children.push_back(dest); |
| 1442 | } |
| 1443 | |
| 1444 | return ArrayData::Make(data.type, data.length, buffers, children, data.null_count, |
| 1445 | data.offset); |
| 1446 | } |
| 1447 | |
| 1448 | static Result<std::shared_ptr<Array>> ToDevice(const std::shared_ptr<MemoryManager>& mm, |
| 1449 | const ArrayData& data) { |