cuda v0.1.0

Why use this package

Reach for this package when a vāṇī program needs to run numeric work on an NVIDIA GPU -- large elementwise operations, custom kernels, anything where the data parallelism is wide enough that host-CPU execution is the bottleneck. vani-cuda does NOT give vāṇī the ability to generate GPU code itself (no such backend exists or is planned -- see vani-compiler's docs/missing_features.md); instead it binds the CUDA Runtime API's host-side orchestration calls (allocate device memory, copy data across the PCIe bus, launch a kernel, synchronize, free), so you write your actual number-crunching kernel in CUDA C/C++ (compiled separately by nvcc) and drive it from vāṇī. If you don't have an NVIDIA GPU, or your workload is small enough that host-CPU execution is already fast enough, this package has nothing to offer -- reach for the numeric tier (vani-matrix, vani-tensor, etc.) instead.

**Read this before using anything below**: this package was written from CUDA's documented Runtime API contract, not verified against real hardware -- the development environment had no NVIDIA GPU and no CUDA Toolkit installed. Every binding type-checks and every generated symbol reference is confirmed correct; actual on-device numerical behavior is unverified. See the README's "Hardware verification status" section before relying on this in anything that matters.

This is an auto-generated API reference for the cuda vāṇī package -- every public function's signature paired with a real usage example pulled from this package's own tests and examples, generated by tools/gen_api_tutorial.py on every push to main.

See API Reference for every function.

Source: https://github.com/enthusiasticgeek/vani-cuda

API Reference

Auto-generated from src/lib.vani, tests/, and examples/ -- every function and struct is listed in source declaration order, each with its signature, its preceding // comment (if any), and a real usage line pulled from this package's own tests or examples (if any). Coverage this run: 1/1 functions have a comment, 1/1 have a found usage example.

Functions

cuda_check

fn cuda_check(err: i32) -> OwnedStr

cuda\_malloc/cuda\_memcpy\_\*/etc. all return a raw i32 error code (0 = success) rather than a vāṇी Result, matching the rest of this package's "thin, uniform wrapper" design and this ecosystem's existing FFI convention (see 09_ffi.md: "The FFI bridge is usually a thin vāṇī wrapper around the C call that converts [it] into a Result variant. You write the wrapper once."). This is that one wrapper -- turn any of the i32 codes above into a message, or "" on success, so a caller doesn't have to remember cuda_error_string's exact name at every call site.

Example (from tests/test_bindings_typecheck.vani):

let msg: OwnedStr = cuda_check(rc1);