This guide installs InfiniOps and runs a minimal Python operator call. InfiniOps depends on an installed InfiniRT prefix.
- C++17 compatible compiler
- CMake 3.18 or newer
- Python 3.10 or newer
- A backend SDK for the target device, such as CUDA Toolkit, DTK, MUSA Toolkit, Cambricon Neuware, or Ascend CANN
- An installed InfiniRT prefix containing
include/infini/rt.handlib/libinfinirt.so
Build and install InfiniRT into a prefix outside the InfiniOps source tree. The exact backend options should match the device you want InfiniOps to use.
cmake -S /path/to/InfiniRT -B /tmp/infinirt-build \
-DCMAKE_INSTALL_PREFIX=/path/to/infini-rt-prefix \
-DWITH_CPU=ON
cmake --build /tmp/infinirt-build -j
cmake --install /tmp/infinirt-buildThe prefix should contain:
/path/to/infini-rt-prefix/include/infini/rt.h
/path/to/infini-rt-prefix/lib/libinfinirt.so
For a CPU build:
python -m pip install . \
--config-settings=cmake.define.INFINI_RT_ROOT=/path/to/infini-rt-prefix \
--config-settings=cmake.define.WITH_CPU=ONFor development, install the optional dependencies:
python -m pip install .[dev] \
--config-settings=cmake.define.INFINI_RT_ROOT=/path/to/infini-rt-prefix \
--config-settings=cmake.define.WITH_CPU=ONInfiniOps can also auto-detect available backends:
python -m pip install .[dev] \
--config-settings=cmake.define.INFINI_RT_ROOT=/path/to/infini-rt-prefixUse explicit backend options when auto-detection is not appropriate for the target machine.
import infini.ops
import torch
m, n, k = 2, 3, 4
x = torch.randn(m, k, device="cpu")
y = torch.randn(k, n, device="cpu")
z = torch.empty(m, n, device="cpu")
infini.ops.gemm(x, y, z)
print(z)The repository also contains examples/gemm.py for a runnable Python example.
See Examples for the full example inventory.
The common public include entry is:
#include <infini/ops.h>Most C++ examples in this repository currently exercise in-tree development headers and backend implementations. See Examples for build commands and backend notes. A consumer CMake example should be added as a follow-up once the installed C++ package boundary is documented and tested.
See Build and Test for backend options and smoke test commands, and Operators for the operator dispatch model.