InfiniRT is the runtime library of the InfiniCore project. It provides a stable runtime API for device management and memory operations across supported backends such as CPU and NVIDIA.
The recommended public entry is:
#include <infini/rt.h>Configure, build, and install InfiniRT with CMake:
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/infini-rt-prefix
cmake --build build -j
cmake --install buildinfini-rt-prefix means the installation prefix used by CMake. After installation, headers and libraries are placed under this prefix, for example:
/path/to/infini-rt-prefix/include
/path/to/infini-rt-prefix/lib
Common options include:
-DWITH_CPU=ON
-DWITH_NVIDIA=ON
-DINFINI_RT_BUILD_TESTING=ONExample CPU build:
cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX=/path/to/infini-rt-prefix \
-DWITH_CPU=ON \
-DINFINI_RT_BUILD_TESTING=ON
cmake --build build -j
ctest --test-dir build --output-on-failure
cmake --install buildExample NVIDIA build:
cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX=/path/to/infini-rt-prefix \
-DWITH_NVIDIA=ON \
-DINFINI_RT_BUILD_TESTING=ON
cmake --build build -j
ctest --test-dir build --output-on-failure
cmake --install build#include <cstddef>
#include <infini/rt.h>
int main() {
infini::rt::SetDevice({infini::rt::Device::Type::kCpu, 0});
constexpr std::size_t size = 1024;
void* ptr = nullptr;
infini::rt::Malloc(&ptr, size);
infini::rt::Memset(ptr, 0, size);
infini::rt::Free(ptr);
return 0;
}For NVIDIA:
infini::rt::SetDevice({infini::rt::Device::Type::kNvidia, 0});Downstream projects should consume the installed headers and libraries instead of depending on the InfiniRT source tree.
Typical include and library paths are:
/path/to/infini-rt-prefix/include
/path/to/infini-rt-prefix/lib
A simple compile command may look like:
c++ main.cc \
-I/path/to/infini-rt-prefix/include \
-L/path/to/infini-rt-prefix/lib \
-linfinirtAt runtime, make sure the dynamic linker can find libinfinirt.so, for example:
export LD_LIBRARY_PATH=/path/to/infini-rt-prefix/lib:$LD_LIBRARY_PATHEnable C++ tests with:
-DINFINI_RT_BUILD_TESTING=ONThen run:
ctest --test-dir build --output-on-failureC++ code should be formatted with clang-format.
Python scripts should be checked and formatted with Ruff:
ruff format --check .
ruff check .Please follow the repository's CONTRIBUTING.md.