fortran-nlp-kernels

Exact lexical and dense-vector similarity search for Python with Fortran backends, CPU autotuning, and workload-aware runtime dispatch.

fortran-nlp-kernels provides a Python API for exact word-shingle Jaccard search and exact dense-vector search while executing the computational kernels in compiled Fortran, OpenMP, and OpenBLAS code.

The stable 0.1.0 release introduces benchmark-informed CPU autotuning and workload-aware runtime dispatch, optional machine-specific thread calibration, versioned calibration profiles, runtime memory guardrails, and temporary OpenMP/OpenBLAS thread control. The shipped fallback policy is based on CPU performance experiments conducted on the perf-eval branch against the 0.1.0b2 implementation.

Installation

PyPI

Install the latest available stable release:

python -m pip install fortran-nlp-kernels

Run machine-specific thread calibration:

fortran-nlp-calibrate

Architecture

Python public API
        ↓
Runtime workload descriptor
        ↓
Backend resolver:-
        +-- Level 1: explicit backend override
        +-- Level 2: compatible machine calibration profile
        +-- Level 3: packaged fallback policy
        ↓
BackendDecision
        ↓
OpenMP / OpenBLAS runtime controller
        ↓
Python validation, preprocessing, and orchestration
        ↓
nanobind C++ extension
        ↓
stable C ABI
        ↓
Fortran / OpenMP / OpenBLAS kernels

Repository and Usage documentation: https://github.com/suwesh/fortran-nlp-kernels