Skip to content

Commit f28b8eb

Browse files
committed
update gpu warning and reduce the length
1 parent 01412e3 commit f28b8eb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lectures/kesten_processes.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ kernelspec:
1919

2020
# Kesten Processes and Firm Dynamics
2121

22-
```{admonition} GPU Warning
23-
:class: dropdown, warning
22+
```{admonition} GPU in use
23+
:class: warning
2424
25-
This lecture is built using [hardware](status:machine-details) that has access to a GPU and uses JAX for GPU programming. As a result, the lecture will be slower when running on a machine without a GPU.
25+
This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and JAX for GPU programming.
2626
2727
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.
2828
@@ -728,9 +728,12 @@ def generate_draws(μ_a=-0.5,
728728
729729
# Perform the calculations in a vectorized manner for T periods
730730
for t in range(T):
731+
exp_a = jnp.exp(a_random[t, :])
732+
exp_b = jnp.exp(b_random[t, :])
733+
exp_e = jnp.exp(e_random[t, :])
731734
s = s.at[:, t+1].set(jnp.where(s[:, t] < s_bar,
732-
jnp.exp(e_random[t, :]),
733-
jnp.exp(a_random[t, :]) * s[:, t] + jnp.exp(b_random[t, :])))
735+
exp_e,
736+
exp_a * s[:, t] + exp_b))
734737
735738
return s[:, -1]
736739

0 commit comments

Comments
 (0)