C++ · Installation

Installation

8.0.0-rc.1 · b1f866ab

With CMake FetchContent:

include(FetchContent)

FetchContent_Declare(
    numkong
    GIT_REPOSITORY https://github.com/ashvardanian/NumKong.git
    GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(numkong)

target_link_libraries(my_target PRIVATE numkong::header) # or numkong::static, numkong::shared

Vendored:

add_subdirectory(external/NumKong)
target_link_libraries(my_target PRIVATE numkong::header) # or numkong::static, numkong::shared

numkong::static and numkong::shared exist when NUMKONG_BUILD_SHARED is on, the default only for a top-level build. An installed NumKong provides the same targets through find_package(numkong CONFIG REQUIRED).

By default the headers declare every public function and the library defines it, each kernel once, in the unit of its capability. numkong::header sets NUMKONG_HEADER_ONLY=1 instead: every kernel compiles into your translation unit, and every dispatch point and finder returns nk_missing_library_k, so a header-only build calls a capability’s kernel, like nk_dot_f32_haswell, directly.

§ Building and Cross-Compiling

The build enforces C99 for the C layer and C++20 for the C++ layer. CONTRIBUTING.md lists the CMake presets and options, and its cross-compilation section the toolchain files in cmake/ with a recipe for each target. A translation unit linking numkong::static or numkong::shared sees declarations only, while numkong::header defines NUMKONG_HEADER_ONLY=1 and compiles the kernels inline. The library compiles every capability whose probe in probes/ compiles, each scoped to its kernels by target pragmas, and dispatches between them by runtime detection. LASX and POWER9 scope that way only under GCC 15 or newer; Clang’s intrinsics headers stay closed without -mlasx or -mcpu=power9. Header-only units enable the capabilities their own flags name.