-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I think it would be nice to not have to completely change my virtual environment every time I want to test simphony with or without JAX installed. So I was thinking we could just have a environment variable available for those who have JAX installed to optionally use the numpy environment. I was thinking something like this:
import os
backend = os.environ.get("SIMPHONY_BACKEND", "numpy")
JAX_AVAILABLE = False
if backend == "jax":
try:
import jax
import jax.numpy as jnp
JAX_AVAILABLE = True
except ImportError:
print("JAX not found, falling back to NumPy backend")
backend = "numpy"
if backend == "numpy":
import numpy as jnp
from simphony.utils import jax Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request