From 8d733b99f51f15a42de0a49bdf297d647d87b29c Mon Sep 17 00:00:00 2001 From: mmcky Date: Sun, 30 Nov 2025 12:14:28 +1100 Subject: [PATCH 1/3] Add centralized GPU admonition for JAX lectures - Create _admonition/gpu.md for single-source GPU notice - Update jax_intro.md to use include directive - Update numpy_vs_numba_vs_jax.md to use include directive This makes it easier to maintain consistent GPU notices across all JAX-related lectures. --- lectures/_admonition/gpu.md | 11 +++++++++++ lectures/jax_intro.md | 11 +---------- lectures/numpy_vs_numba_vs_jax.md | 11 +---------- 3 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 lectures/_admonition/gpu.md diff --git a/lectures/_admonition/gpu.md b/lectures/_admonition/gpu.md new file mode 100644 index 00000000..765fbf21 --- /dev/null +++ b/lectures/_admonition/gpu.md @@ -0,0 +1,11 @@ +```{admonition} GPU +:class: warning + +This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and target JAX for GPU programming. + +Free GPUs are available on Google Colab. +To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU. + +Alternatively, if you have your own GPU, you can follow the [instructions](https://github.com/google/jax) for installing JAX with GPU support. +If you would like to install JAX running on the `cpu` only you can use `pip install jax[cpu]` +``` diff --git a/lectures/jax_intro.md b/lectures/jax_intro.md index f8fe265d..188db041 100644 --- a/lectures/jax_intro.md +++ b/lectures/jax_intro.md @@ -33,16 +33,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie !pip install jax quantecon ``` -```{admonition} GPU -:class: warning - -This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and target JAX for GPU programming. - -Free GPUs are available on Google Colab. -To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU. - -Alternatively, if you have your own GPU, you can follow the [instructions](https://github.com/google/jax) for installing JAX with GPU support. -If you would like to install JAX running on the `cpu` only you can use `pip install jax[cpu]` +```{include} _admonition/gpu.md ``` ## JAX as a NumPy Replacement diff --git a/lectures/numpy_vs_numba_vs_jax.md b/lectures/numpy_vs_numba_vs_jax.md index 1fa83116..aa9c85a9 100644 --- a/lectures/numpy_vs_numba_vs_jax.md +++ b/lectures/numpy_vs_numba_vs_jax.md @@ -48,16 +48,7 @@ tags: [hide-output] !pip install quantecon jax ``` -```{admonition} GPU -:class: warning - -This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and target JAX for GPU programming. - -Free GPUs are available on Google Colab. -To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU. - -Alternatively, if you have your own GPU, you can follow the [instructions](https://github.com/google/jax) for installing JAX with GPU support. -If you would like to install JAX running on the `cpu` only you can use `pip install jax[cpu]` +```{include} _admonition/gpu.md ``` We will use the following imports. From 88333827bcc8ebde8a6ecefd65c5ed2a317bd07f Mon Sep 17 00:00:00 2001 From: mmcky Date: Sun, 30 Nov 2025 12:15:37 +1100 Subject: [PATCH 2/3] Fix grammar: target -> targets --- lectures/_admonition/gpu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/_admonition/gpu.md b/lectures/_admonition/gpu.md index 765fbf21..0cdd886f 100644 --- a/lectures/_admonition/gpu.md +++ b/lectures/_admonition/gpu.md @@ -1,7 +1,7 @@ ```{admonition} GPU :class: warning -This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and target JAX for GPU programming. +This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and targets JAX for GPU programming. Free GPUs are available on Google Colab. To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU. From 53d48a81e3b7ebdcf8f36fa99f871e291bf0deb1 Mon Sep 17 00:00:00 2001 From: mmcky Date: Sun, 30 Nov 2025 12:17:24 +1100 Subject: [PATCH 3/3] Simplify GPU admonition text --- lectures/_admonition/gpu.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lectures/_admonition/gpu.md b/lectures/_admonition/gpu.md index 0cdd886f..dd218be3 100644 --- a/lectures/_admonition/gpu.md +++ b/lectures/_admonition/gpu.md @@ -1,11 +1,5 @@ ```{admonition} GPU :class: warning -This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and targets JAX for GPU programming. - -Free GPUs are available on Google Colab. -To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU. - -Alternatively, if you have your own GPU, you can follow the [instructions](https://github.com/google/jax) for installing JAX with GPU support. -If you would like to install JAX running on the `cpu` only you can use `pip install jax[cpu]` +This lecture is designed to run on a GPU. To use Google Colab's free GPUs, click the play icon top right, select Colab, and set the runtime to include a GPU. For local GPU setup, see the [JAX installation guide](https://github.com/google/jax). ```