Additional examples
The bundle ships the public examples under examples/src. Each example is a standalone find_package(ClikaRT CONFIG) project on the public API only, and each builds its topic up one chapter at a time, starting at 00_hello_world. Every example directory has its own README.md walk-through.
Read roughly top to bottom; each row assumes a little of the ones above it.
| Example | What it shows | Chapters |
|---|---|---|
version | The smallest consumer: link the bundle, print GetVersionInfo() | 00_hello_world |
compute | The tensor/op engine: tensors and dtypes, device properties, data movement, the ops:: library, the async model, zero-copy .to(device), hardware probes, a distributed matmul, the profiler, cast chains | 00_hello_world · 01_tensors · 02_devices · 03_data_movement · 04_operators · 05_async · 06_zero_copy · 07_hardware · 08_distributed_matmul · 09_profiler · 10_cast_chain |
async | The async execution model in depth: dispatch vs ready, safe host reads, on_complete, the synchronous scope, tracing | 00_dispatch_vs_ready · 01_safe_reads · 02_on_complete · 03_sync_scope · 04_tracing_scope |
runtime | The serving runtime: nodes and phases, per-session state, continuous batching, pipelines, vision models, the interface layer, a two-stage model, an encoder with a stateful decoder | 00_functional_api · 01_model_api · 02_stateful_functional_api · 03_stateful_model_api · 04_pipeline · 05_simple_vision_model · 06_interface · 07_two_stage_vision_model · 08_encoder_and_stateful_decoder |
nn | Neural-network modules: make with plain counts, bind weights, forward; Linear, Conv, and a KV cache bound straight into the attention op | 00_linear · 01_conv · 02_attention_kvcache |
processor | Image and audio pre-processing: resize, rescale and normalize a generated image; log-mel features from a synthesized waveform | 00_image · 01_audio |
json | A small JSON value for payloads: parse, typed getters, build with operator[], dump round trip | 00_hello_world |
errors | The failure vocabulary: unwrap, CLIKART_TRY capture, CLIKART_TRY_OR_RETURN propagation, and code_name(), the stable machine-readable failure name | 00_result |
cli | Typed argument parsing: options and flags, subcommands, validators, shell completion | 00_hello_world · 01_args · 02_subcommands · 03_completion |
logging | Structured logging: levels, the level filter, named subsystem loggers | 00_hello_world · 01_levels · 02_named |
progress | Terminal progress: bars (bytes, ETA, rate), spinners, multi-bar groups | 00_hello_world · 01_bytes_eta_rate · 02_spinner · 03_group |
templating | Jinja2-compatible rendering: variables, logic, filters, chat prompts | 00_hello_world · 01_logic · 02_filters · 03_chat_prompts |
tokenizer | Text to token ids and back: HF tokenizer.json, byte offsets, batching and vocab, chat templates | 00_hello_world · 01_offsets · 02_batch_and_vocab · 03_huggingface |
tables | A columnar dataframe: CSV, dtypes, select/filter/sort, group-by/join, transforms, GPU acceleration | 00_hello_world · 01_columns_and_dtypes · 02_csv · 03_select_filter_sort · 04_groupby_join · 05_transform · 06_acceleration |
tables_benchmark | The pandas-vs-ClikaRT performance sibling of tables | one standalone project |
io | Loading data and weights: NumPy .npy, safetensors, GGUF, images, and the ONNX model stack (guide) | 00_hello_world · 01_safetensors · 02_gguf · 03_image · 04_onnx |
http_server | An HTTP service: routing, JSON APIs, middleware, a templated site, SSE streaming, an image-upload endpoint that runs compute | 00_hello_world · 01_routing · 02_json_api · 03_middleware · 04_serve_a_website · 05_sse · 06_image_compute |
download | A download tool combining CLI, progress bar and HTTP client | 00_hello_world · 01_multi_file |
flash_attention | A hand-written CUDA kernel on ClikaRT streams: upstream Flash Attention ported, not rewritten, dispatched through the custom-op interface | one project (main.cpp + the ported kernel) |
Beyond C++
The binding lanes carry their own chapter sets, written to the same standard (each chapter teaches one thing and asserts its own results):
- Python: sixteen self-asserting scripts over the
clika-runtimewheel, from the NumPy boundary throughnn.Module, ONNX compile-and-run, tokenizers, processors, and tracing. The set doubles as a smoke suite for an installed wheel. - C: one narrated strict-C99 chapter over the raw ABI (
dlopen, the api-table handshake, ops, typed errors), the same program the Kotlin and Rust hello chapters run through their bindings. - Kotlin and Rust: six chapters each, from the ABI hello through tensor ops, an
nnMLP, and consuming or authoring ONNX graphs.
Use ClikaRT from Python and Call ClikaRT from C walk the first steps of those lanes.
Build and run
cmake -S "$CLIKART_BUNDLE_DIR/examples/src/compute" -B build-compute \
-DClikaRT_DIR="$CLIKART_BUNDLE_DIR/cmake"
cmake --build build-compute
./build-compute/compute_00_hello_world
Or build them all at once from the top-level project: cmake -S "$CLIKART_BUNDLE_DIR/examples/src" -B build -DClikaRT_DIR="$CLIKART_BUNDLE_DIR/cmake". The top-level project adapts to the distribution it is built against; it skips an example the distribution cannot build rather than failing.
On platforms where the bundle carries pre-built example binaries (examples/bin), run them in place: they find the libraries through a relative rpath and need no environment setup.