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

Function ExportDeviceArray

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

Source from the content-addressed store, hash-verified

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