Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 2.67 KB

File metadata and controls

102 lines (73 loc) · 2.67 KB

Getting Started

This guide installs InfiniOps and runs a minimal Python operator call. InfiniOps depends on an installed InfiniRT prefix.

Prerequisites

  • 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.h and lib/libinfinirt.so

Install InfiniRT First

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-build

The prefix should contain:

/path/to/infini-rt-prefix/include/infini/rt.h
/path/to/infini-rt-prefix/lib/libinfinirt.so

Install InfiniOps

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=ON

For 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=ON

InfiniOps can also auto-detect available backends:

python -m pip install .[dev] \
  --config-settings=cmake.define.INFINI_RT_ROOT=/path/to/infini-rt-prefix

Use explicit backend options when auto-detection is not appropriate for the target machine.

Minimal Python Call

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.

Minimal C++ Include

The formal C++ API entry point is:

#include <infini/ops.h>

This header exposes the documented core types and generated operator call surface. Downstream C++ code should use this installed entry point. Repository examples may use narrower headers or implementation details to exercise specific components; see Examples for build commands and backend notes. An installed-consumer CMake example would add packaging validation, but is not a prerequisite for treating the documented C++ interface as public API.

Next Steps

See Build and Test for backend options and smoke test commands, and Operators for the operator dispatch model.