Device buffers, streams and ownership#

Find the call that produced or imported your data, then keep its owner and any required stream or lease alive until the consumer has finished.

Geometry and result views#

Call or handle

Ownership and release

cugeo_geometry_cuda_geometry_borrow_storage_device

Borrows device geometry storage through a lease. Release the lease with cugeo_geometry_cuda_device_lease_release.

cugeo_geometry_cuda_geometry_borrow_row_states_device

Borrows device row states through a lease. Release the lease with cugeo_geometry_cuda_device_lease_release.

Typed cugeo_geometry_cuda_result_borrow_* views

Borrow device result storage through a lease. Release the lease with cugeo_geometry_cuda_device_lease_release.

Rust DeviceLease and RowDeviceLease

Represent device leases for their respective borrowed views.

cugeo_geometry_cudf_result_borrow_cuda

Borrows CUDA storage with a separately releasable lease.

cugeo_geometry_cudf_result_export_arrow_device

Returns an exported owner. Follow the export-mode readiness and lifetime rules below.

cugeo_geometry_cudf_result_to_host

Makes an explicit host copy.

Result-stream next-page, schema and close calls have separate lifetimes. The adapter retains session-bound resources through the last consumer read. Release follows completion of consumer work. Failed retirement is retried or quarantined.

Arrow export readiness and lifetime#

Export or object

Readiness and lifetime

Independently owned device export

Can outlive its result and session.

Unbound consumer

Wait on sync_event before reading.

Bound consumer

Keep the bound stream live through release.

Capturing consumer stream

Binding it yields CUGEO_GEOMETRY_CUDF_INVALID_ARGUMENT in the covered case. An unbound export can be made and released on that thread with capture intact.

Schema root, array root and moved-out child

Treat each as a separate lifetime entry.

arrow_schema()

Returns an independently owned host schema. It can survive result and session closure even if device-array allocation is refused.

Arrow import and geometry layout#

Session.table_from_arrow selects the first available protocol in this order: device array, device stream, host array, host stream. Host batches upload. A single CUDA batch is normally borrowed unless copy=True. Same-session results use retained storage.

For native Arrow geometry import and export and host or device WKB decode, check the context, producer event, pointer range, dimensions, SRID, validity bitmap, sliced offsets and empty offsets. Pair views have ordinal bounds. Use their gather lookup to retrieve the corresponding entries.

Allocators and statuses#

cugeo_geometry_cuda_context_options supplies device and pinned allocation callbacks and byte ceilings. Keep callbacks alive through final child release. Observe the stream-ordered deallocation and non-reentrancy contracts.

Status

Check

CUGEO_GEOMETRY_CUDA_CAPACITY

Sizing.

CUGEO_GEOMETRY_CUDA_HOST_ALLOCATION_FAILED

Host allocation.

CUGEO_GEOMETRY_CUDA_DEVICE_ERROR

Device runtime failure.