Embed a transform in a native application#

Install a native development prefix#

  1. With CMake 3.24 or later, configure the native package with CUGEO_PROJ_LIBRARY_FILE set to the existing absolute path of a Cargo-built Proj shared library. Install the library, headers and package targets.

  2. Point your application’s CMake search path at that installation and find cugeo_proj. Link cugeo::proj for a C consumer with host columns, or cugeo::proj_cpp for the C++ wrapper used with CUDA device columns.

For a C target, the application’s CMake configuration can use the following.

find_package(cugeo_proj CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE cugeo::proj)

Replace your_target with your application target. The package definitions are in CMakeLists.txt and cmake/cugeo_proj-targets.cmake.in.

Choose a submission path#

Your columns

Follow

Submission

Host buffers

examples/native.c

Create a plan and call cugeo_proj_transform_host with host buffers.

CUDA device buffers

examples/cpp_cuda.cu

Create a plan, prepare it for the context, make a capacity-sized workspace and enqueue on an explicit stream. Retain the execution handle.

Check one point#

Adapt either example to one XY row: longitude 3° and latitude 0°, from EPSG:4326 to EPSG:32631. Give each input and output column a count of one and a stride matching its element storage, and provide one row-status slot.

On CUDA, keep the context, stream, prepared transform, workspace and buffers live through the wait. After waiting, copy the easting and status back. For either path, print the status and easting in metres before releasing the result storage. Check for OK and approximately 500000 m.

Bind Arrow Device arrays#

When using the optional Arrow Device binding, pass the input, output and status array roots and their three schemas. On successful binding, ownership of those roots and schemas transfers to the binding. Keep the binding and backing storage live through completion.

For exact child types, offsets, validity layout and borrowed-handle rules, see Native API and device interchange.