lecture-jax
lecture-jax copied to clipboard
Not timing properly
In this lecture, when we do the timings, we do not use block_until_ready
and we don't run twice to eliminate compile time.
https://jax.quantecon.org/opt_savings_1.html
I think this is probably true in a few other lectures.
We need a review of all timings, to make sure that we run twice, noting the time on both occasions, and that we block until ready.
Required actions:
- [x] search for and list all lectures where we time JAX execution without
block_until_ready
- [x] insert
block_until_ready
as required - [x] check the timings of all lectures, particularly in dynamic programming, and make sure that we run executing twice, showing the timing with compile time and the timing without
I did a thorough search: all Jax lectures except for mle have the issues of either not using block_until_ready
or running twice to eliminate compilation time. (So I will not list them here)
Edit: given so many lectures, I list them here for tracking the modification progress:
- [x] jax_intro
- [x] newtons_method
- [x] inventory_dynamics
- [x] kesten_processes
- [x] wealth_dynamics
- [x] lucas_model
- [x] markov_asset
- [x] opt_savings_1
- [x] opt_savings_2
- [x] short_path
- [x] opt_invest
- [x] inventory_ssd
- [x] ifp_egm
- [x] cake_eating_numerical
- [x] arellano
- [x] aiyagari_jax
- [x] ReEdit: check it again before review
I spotted two extra issues during the searching:
- when we time the code, we use our timing methods
tic/toc
and Python time magic interchangeably in different lectures, - we'd like to compare the timing of Jax code with our previous Numba code, but we do not eliminate the compilation time for Numba code
Regarding issue 1, I suggest we use our timing methods, tic/toc
, for all Jax lectures.
Regarding issue 2, I suggest we also run the Numba code twice to eliminate the compilation.
Thanks @shlff , these are good suggestions.
I suggest we use our timing methods, tic/toc, for all Jax lectures.
Actually I suggest that we use %time and %%time when possible --- unless we are recording the time to compare it to something later. If we are recording the time, let's use time.time()
, since it's conventional in Python.
Thanks for your comments @jstac . That's a better idea!