MCPcopy Create free account
hub / github.com/apache/arrow / ToDeviceData

Method ToDeviceData

cpp/src/arrow/c/bridge_test.cc:5202–5222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5200class TestArrayDeviceStreamRoundtrip : public BaseArrayStreamTest {
5201 public:
5202 static Result<std::shared_ptr<ArrayData>> ToDeviceData(
5203 const std::shared_ptr<MemoryManager>& mm, const ArrayData& data) {
5204 arrow::BufferVector buffers;
5205 for (const auto& buf : data.buffers) {
5206 if (buf) {
5207 ARROW_ASSIGN_OR_RAISE(auto dest, mm->CopyBuffer(buf, mm));
5208 buffers.push_back(dest);
5209 } else {
5210 buffers.push_back(nullptr);
5211 }
5212 }
5213
5214 arrow::ArrayDataVector children;
5215 for (const auto& child : data.child_data) {
5216 ARROW_ASSIGN_OR_RAISE(auto dest, ToDeviceData(mm, *child));
5217 children.push_back(dest);
5218 }
5219
5220 return ArrayData::Make(data.type, data.length, buffers, children, data.null_count,
5221 data.offset);
5222 }
5223
5224 static Result<std::shared_ptr<Array>> ToDevice(const std::shared_ptr<MemoryManager>& mm,
5225 const ArrayData& data) {

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
MakeFunction · 0.50

Tested by

no test coverage detected