Read the interop matrix

Read the interop matrix#

See which array libraries RAPTOR officially supports, straight from the code — no table to trust blind.

Time: ~5 min · Runs on: CPU, no GPU needed, raptor alone (no cupy/torch/warp required) · You need: raptor-core; read first: Implement a protocol

Colab or Kaggle: run this first cell (it installs the packages and downloads the helper files this notebook uses). Elsewhere it only checks the imports.

Hide code cell source

# Colab setup, generated by python -m raptor_docs.nb colab_setup (do not edit).
import os

try:
    import google.colab  # noqa: F401
    HOSTED = True  # a Colab runtime
except ImportError:
    HOSTED = "KAGGLE_KERNEL_RUN_TYPE" in os.environ  # a Kaggle kernel

if HOSTED:
    import importlib.metadata, pathlib, re, shutil, subprocess, sys, urllib.request

    gpu = bool(shutil.which("nvidia-smi")) and subprocess.run(["nvidia-smi", "-L"], capture_output=True).returncode == 0
    extra = ""
    if gpu:
        # the CUDA major the runtime already has: a CuPy that is installed, else torch's, else the driver's
        major = None
        for m in ("13", "12"):
            try:
                importlib.metadata.version(f"cupy-cuda{m}x")
                major = m
                break
            except importlib.metadata.PackageNotFoundError:
                pass
        if major is None:
            try:
                import torch
                major = "13" if str(torch.version.cuda).startswith("13") else None
            except ImportError:
                pass
        if major is None:
            smi = re.search(r"CUDA Version: (\d+)", subprocess.run(["nvidia-smi"], capture_output=True, text=True).stdout)
            major = "13" if smi and int(smi.group(1)) >= 13 else "12"
        extra = f"[cuda{major}]"
        print(f"GPU found: installing the {extra} extras to match this runtime.")
    pre = ["--pre"] if os.environ.get("RAPTOR_PRE") else []  # optional: test a release candidate
    ref = os.environ.get("RAPTOR_REF", "main")  # optional: fetch the helper files from this git ref
    if pre or "RAPTOR_REF" in os.environ:
        print(f"Pre-release test: installing with --pre, helper files from {ref}.")
    # our packages with --upgrade, so a runtime that kept an older release gets the current one
    subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "--upgrade", *pre, "raptor-core"])
    subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "matplotlib"])
    base = os.environ.get("RAPTOR_RAW_BASE", "https://raw.githubusercontent.com")  # optional: a local mirror
    top = os.environ.get("RAPTOR_WORKDIR") or ("/kaggle/working" if "KAGGLE_KERNEL_RUN_TYPE" in os.environ else "/content")
    root = pathlib.Path(top) / "raptor"
    for rel in (
        "docs/content/_shared/nb_diagrams.py",
        "docs/content/_shared/themed_figure.py",
    ):
        (root / rel).parent.mkdir(parents=True, exist_ok=True)
        urllib.request.urlretrieve(f"{base}/amasat01/raptor/{ref}/{rel}", root / rel)
    (root / "docs/content/tutorials").mkdir(parents=True, exist_ok=True)
    os.chdir(root / "docs/content/tutorials")
    if not gpu:
        print("Running on the CPU (no GPU in this runtime). For a GPU: " + ("Settings → Accelerator → GPU T4 x2." if "KAGGLE_KERNEL_RUN_TYPE" in os.environ else "Runtime → Change runtime type → T4 GPU."))

try:
    import raptor  # noqa: F401
except ImportError as err:
    raise ImportError(
        "raptor not found. Install with `pip install matplotlib raptor-core`."
    ) from err

Hide code cell source

import sys; sys.path.insert(0, "../_shared")
from raptor.conformance import interop
from nb_diagrams import rows_by_framework_bar
rows_by_framework_bar(interop.ROWS)
Chart: 51 declared rows, by framework

The code#

raptor.conformance.interop declares two things, as plain tuples: which frameworks are CERTIFIED today, and which are ROADMAP — declared, not yet built:

from raptor.conformance import interop

print("certified:", interop.CERTIFIED)
print("roadmap  :", interop.ROADMAP)
certified: ('numpy', 'cupy', 'torch', 'warp', 'jax')
roadmap  : ('tensorflow',)

Five certified frameworks today, one more on the roadmap — reading this costs nothing, with none of them installed.

Check which of the certified ones this environment actually has, the plain way — no test framework needed, just whether each one imports:

import importlib.util

for fw in interop.CERTIFIED:
    found = importlib.util.find_spec(fw) is not None
    print(f"{fw:<10} {'found' if found else 'missing'}")
numpy      found
cupy       found
torch      found
warp       found
jax        found

raptor itself needs none of these — this cell just reports what else happens to be installed here.

The same idea for ROADMAP: tensorflow is declared absent today. roadmap_framework checks both directions — declared-absent AND actually-absent must agree, or it is a failure, not a quiet pass:

for fw in interop.ROADMAP:
    try:
        interop.roadmap_framework(fw)
        print(f"{fw}: absent, as declared")
    except AssertionError as exc:
        print(f"{fw}: unexpectedly installed in this environment -- {exc}")
tensorflow: absent, as declared

Finally, look up one row directly in ROWS — the full declaration every claim on the matrix page cites:

decl = interop.ROWS["T-IN-CUDA-ALIAS"]
print(f"T-IN-CUDA-ALIAS -> framework={decl.framework} owner={decl.owner_repo} kind={decl.kind}")
T-IN-CUDA-ALIAS -> framework=torch owner=eagle kind=ALIAS

.framework/.owner_repo/.kind are the three fields every declared row carries. kind is how data crosses between the two sides — ALIAS (seen above) means the same memory, no copy; the matrix page defines the other four kinds (COPY, STREAM, ENV, INVARIANCE) in full.

What just happened#

  • Reading CERTIFIED/ROADMAP/ROWS costs nothing: no certified framework needs to be installed just to read the declaration.

  • Checking whether a framework is actually present only needs importlib.util.find_spec — the same plain check interop uses internally, no extra install required.

  • ROWS names, for every crossing the family certifies, which repository’s test suite proves it and how data crosses (ALIAS, COPY, STREAM, ENV or INVARIANCE).

Try this#

Look up a row you have not seen yet, e.g. interop.ROWS["T-DEVICE-FAILLOUD"], and read its .framework/.owner_repo/ .kind straight from the object instead of this page.

Next#

Interoperability is the full, human-readable matrix — every row, what it certifies, and the ALIAS/COPY transfer laws every crossing on this page obeys. Want to add a crossing of your own? See Contributing a certification row for the two-repository process and the hygiene scanners its gate runs.