InfiniOps keeps small runnable examples under examples/. They are intended
for development and smoke validation of common API surfaces, not as installed
downstream consumer projects.
Run the Python GEMM example after installing the InfiniOps wheel:
python examples/gemm.pyThe example creates CPU tensors with PyTorch, calls infini.ops.gemm, and
prints the InfiniOps result next to torch.mm.
C++ examples are built by the raw CMake project when Python binding generation is disabled:
cmake -S . -B build \
-DINFINI_RT_ROOT=/path/to/infini-rt-prefix \
-DWITH_CPU=ON \
-DGENERATE_PYTHON_BINDINGS=OFF
cmake --build build -jThe generated executables are written under the CMake build tree. Exact paths depend on the generator, but common targets include:
tensordata_typegemmgemm_dispatch
Build one example target explicitly:
cmake --build build --target gemm| Example | Language | Purpose | Backend notes |
|---|---|---|---|
examples/gemm.py |
Python | Calls infini.ops.gemm on PyTorch tensors. |
CPU by default. |
examples/tensor.cc |
C++ | Creates and prints an infini::ops::Tensor view. |
CPU host memory only. |
examples/data_type.cc |
C++ | Prints data type names and element sizes. | Backend independent. |
examples/gemm/gemm.cc |
C++ | Allocates backend memory and calls Gemm::Call. |
Uses the enabled backend selected by examples/runtime_api.h. |
examples/gemm/gemm_dispatch.cc |
C++ | Compares two NVIDIA GEMM implementation indexes. | Requires WITH_NVIDIA=ON; exits early on other builds. |
The current C++ examples include in-tree development headers such as
tensor.h, runtime_api.h, and backend implementation headers. A fully
installed downstream CMake consumer example should be added separately once the
installed C++ package boundary is tested.