Samples: Add DLPack CUDA sample and CSV output for ZividBenchmark - #293
Merged
Conversation
csu-bot-zivid
force-pushed
the
2026-07-10-update-cpp-samples
branch
14 times, most recently
from
July 20, 2026 09:28
9c15b73 to
cca15c4
Compare
csu-bot-zivid
force-pushed
the
2026-07-10-update-cpp-samples
branch
15 times, most recently
from
July 28, 2026 12:56
f9b31f4 to
c5cba2a
Compare
csu-bot-zivid
force-pushed
the
2026-07-10-update-cpp-samples
branch
from
July 28, 2026 20:30
c5cba2a to
99a28f8
Compare
New sample: - CaptureAndConvertToDlpackTensorOnCuda: capture a 2D+3D frame and build DLPack tensors directly from the Zivid DeviceArrays on the CUDA device, for both the point cloud (PointXYZ) and the color image (ColorRGBA_SRGB). It builds a DLManagedTensor from the device pointer, shape, strides in elements, element data type and CUDA device, and validates the result. A consumer such as PyTorch, CuPy or JAX can then import the tensor for zero-copy GPU processing. The DeviceArray is kept alive for as long as the consumer holds the tensor. - The sample is off by default. Build it with -DUSE_DLPACK=ON alongside -DUSE_CUDA=ON, and point DLPACK_INCLUDE_DIR at the directory containing dlpack/dlpack.h. ZividBenchmark: - A run now also writes its results to a CSV file, so results can be archived and compared across machines or cameras. Each row carries a timestamp, test category, test name, iteration, median and mean time in milliseconds, the settings used, and the camera model and serial number. API version, OS and compute device are recorded too. - The file is named zivid_benchmark_results_<date>_<time>.csv by default; pass --csv-output <filename> to choose the name. - The six capture-ordering tests (2D then 3D, 3D then 2D, and 3D including 2D, each with and without the projector) now run only when you pass --extended, so a default run is shorter. Docs: - The HALCON compatibility list now also covers Ubuntu 26.04.
torbsorb
force-pushed
the
2026-07-10-update-cpp-samples
branch
from
July 29, 2026 06:34
99a28f8 to
c3333c6
Compare
torbsorb
approved these changes
Jul 29, 2026
torbsorb
left a comment
Collaborator
There was a problem hiding this comment.
No changes from the internal version; except improved README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New sample: DLPack tensors from Zivid DeviceArrays
source/Applications/Advanced/Cuda/CaptureAndConvertToDlpackTensorOnCudacaptures a combined 2D+3D frame and builds DLPack tensors directly from
the Zivid
DeviceArrays on the CUDA device — both the point cloud(
PointXYZ) and the color image (ColorRGBA_SRGB).The sample constructs a
DLManagedTensorfrom the building blocks eachDeviceArrayexposes (device pointer, shape, strides in elements,element data type, CUDA device) and validates its fields. The DLPack
data type is derived from the Zivid format's
ValueType, so one codepath handles both float point data and 8-bit color. This is the
producer side of DLPack: a consumer such as PyTorch
(
torch.from_dlpack), CuPy or JAX imports the resulting tensor forzero-copy GPU processing. The
DeviceArrayis kept alive by thetensor's manager context and released only when the consumer is done
with it, so the GPU memory stays valid as long as the tensor is held.
Building it. The sample is off by default. Configure with
-DUSE_DLPACK=ONin addition to-DUSE_CUDA=ON, and pointDLPACK_INCLUDE_DIRat the directory containingdlpack/dlpack.h(headers from https://github.com/dmlc/dlpack). CMake fails with a clear
message if the path is missing or wrong.
ZividBenchmark: CSV output
A benchmark run now also writes its results to a CSV file, so a run can
be archived, shared, or compared across machines and cameras instead of
only being read off the console.
timestamp,test_category,test_name,iteration,median_ms,mean_ms,settings,camera_model,serial_number.filters used for that test, so rows stay interpretable later.
compute device — is written to the file as well.
zivid_benchmark_results_<date>_<time>.csv; pass--csv-output <filename>to choose your own.ZividBenchmark: capture-ordering tests are now opt-in
The six capture-ordering tests — 2D then 3D, 3D then 2D, and 3D
including 2D, each with and without the projector — now run only when
you pass
--extended. A default run covers connect/disconnect, 3D, 2D,3D+2D, 2D+3D, copy-data and save, and finishes correspondingly sooner.
Pass
--extendedto get the previous full set.Docs
The HALCON compatibility list now also covers Ubuntu 26.04.