From cb5a93a80f0b39ba542021051b0ab10e78c85176 Mon Sep 17 00:00:00 2001 From: Piper Fowler-Wright Date: Sun, 10 Nov 2024 08:00:37 -0800 Subject: [PATCH] Note on setting OQUPY_BACKEND variable --- DEVELOPMENT.md | 2 ++ docs/pages/gpu_features.rst | 3 +++ examples/simple_dynamics_jax.py | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 10fa0f6..ce02df3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -24,6 +24,8 @@ To enable experimental features switch to the `dev/jax` branch and use from oqupy.backends import enable_jax_features enable_jax_features() ``` +Alternatively, the `OQUPY_BACKEND` environmental variable may be set to `jax` to +initialize the jax backend by default. ### Contributing Guidelines diff --git a/docs/pages/gpu_features.rst b/docs/pages/gpu_features.rst index c055c88..5dd2a15 100644 --- a/docs/pages/gpu_features.rst +++ b/docs/pages/gpu_features.rst @@ -25,6 +25,9 @@ To enable experimental features, switch to the ``dev/jax`` branch and use from oqupy.backends import enable_jax_features enable_jax_features() +Alternatively, the `OQUPY_BACKEND` environmental variable may be set to `jax` to +initialize the jax backend by default. + Contributing Guidelines ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/simple_dynamics_jax.py b/examples/simple_dynamics_jax.py index e3f2de5..5a7f8d1 100644 --- a/examples/simple_dynamics_jax.py +++ b/examples/simple_dynamics_jax.py @@ -8,8 +8,8 @@ import oqupy from oqupy.backends import enable_jax_features # import NumPy from numerical_backend -from oqupy.backends.numerical_backend import np -enable_jax_features() +#from oqupy.backends.numerical_backend import np +#enable_jax_features() import matplotlib.pyplot as plt sigma_x = oqupy.operators.sigma("x") @@ -39,5 +39,5 @@ plt.plot(t, s_z, label=r'$\alpha=0.3$') plt.xlabel(r'$t\,\Omega$') plt.ylabel(r'$\langle\sigma_z\rangle$') -#plt.savefig('simple_dynamics.png') -plt.show() +plt.savefig('simple_dynamics_jax.png') +#plt.show()