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

Function ExportDeviceArray

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

Source from the content-addressed store, hash-verified

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