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

Function ExportDeviceArray

cpp/src/arrow/c/bridge.cc:761–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759} // namespace
760
761Status ExportDeviceArray(const Array& array, std::shared_ptr<Device::SyncEvent> sync,
762 struct ArrowDeviceArray* out, struct ArrowSchema* out_schema) {
763 void* sync_event = sync ? sync->get_raw() : nullptr;
764
765 SchemaExportGuard guard(out_schema);
766 if (out_schema != nullptr) {
767 RETURN_NOT_OK(ExportType(*array.type(), out_schema));
768 }
769
770 ARROW_ASSIGN_OR_RAISE(auto device_info, ValidateDeviceInfo(*array.data()));
771 if (!device_info.first) {
772 out->device_type = ARROW_DEVICE_CPU;
773 } else {
774 out->device_type = static_cast<ArrowDeviceType>(*device_info.first);
775 }
776 out->device_id = device_info.second;
777
778 ArrayExporter exporter(/*device_interface*/ true);
779 RETURN_NOT_OK(exporter.Export(array.data()));
780 exporter.Finish(&out->array);
781
782 auto* pdata = reinterpret_cast<ExportedArrayPrivateData*>(out->array.private_data);
783 pdata->sync_ = std::move(sync);
784 out->sync_event = sync_event;
785
786 guard.Detach();
787 return Status::OK();
788}
789
790Status ExportDeviceRecordBatch(const RecordBatch& batch,
791 std::shared_ptr<Device::SyncEvent> sync,

Callers 5

TestWithArrayFactoryMethod · 0.85
TestWithArrayFactoryMethod · 0.85
TEST_FFunction · 0.85
TestWithArrayFactoryMethod · 0.85
ExportStreamNextFunction · 0.85

Calls 8

ExportTypeFunction · 0.70
OKFunction · 0.50
get_rawMethod · 0.45
typeMethod · 0.45
ExportMethod · 0.45
dataMethod · 0.45
FinishMethod · 0.45
DetachMethod · 0.45

Tested by 4

TestWithArrayFactoryMethod · 0.68
TestWithArrayFactoryMethod · 0.68
TEST_FFunction · 0.68
TestWithArrayFactoryMethod · 0.68