Skip to content

How to check which backend is active

From Python, inspect the backend module:

from marple.backend import HAS_BACKEND, np

if HAS_BACKEND:
    print(f"Backend: {np.__name__}")
else:
    print("No backend (pure Python)")

From the MARPLE REPL, you can check via I-Beam. Create a small helper:

# checkbackend.py
from marple.arraymodel import APLArray
from marple.backend import HAS_BACKEND, np

def check(right: APLArray) -> APLArray:
    if HAS_BACKEND:
        name = np.__name__
    else:
        name = "none"
    return APLArray([len(name)], list(name))
      ('checkbackend.check') 0
numpy

See also: NumPy backend, Writing fast code