-
-
Notifications
You must be signed in to change notification settings - Fork 6
Update inventory ssd #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update inventory ssd #229
Conversation
✅ Deploy Preview for incomparable-parfait-2417f8 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Could someone please review? On my laptop I get a huge compile time on the first run, not sure why. Also note the use of |
|
Many thanks @jstac! It looks great to me! For compilation and execution time, I got on Tesla T4, which are reasonable to me. I just pushed some minor cosmetic changes and applied |
|
Hi @jstac, I just had another look, and I think I can optmize this slightly more. I will work on it and report back! |
|
@HumphreyYang I have noticed the preview is referencing |
Looking forward to seeing the new version :-) |
|
Please find my updated code in the gist below: It is 4x faster than the old code for compile + run, and 5x faster for reruns on my GPU: The solutions generated are identical. My main motivation (and change) was that we applied double Once we remove One downside is that the resulting code also follows the math in a less "operator-like" but more "matrix-like" way, just as you’ve accused me of in meetings : ) I have to admit, the operator approach is always more concise, elegant, and easy to understand. Due to the trade-off, I didn’t push it to the branch, but please let me know which version you would prefer. |
|
Thanks @HumphreyYang, this is very cool. Daisuke Oyama used the same strategy for the DP code in quantecon.py -- precompting reward and transition matrices to reduce execution time. As you show, the speed gain can be really impressive. Nonetheless, I think we should resist this approach here, since, as you point out, memory issues can be a problem (some people ran into this limitation when using the QE library) and the code is a bit further away from the maths. (The vmap code is also messy in some ways, but the right hand side of the bellman equation is still easy to understand.) (Let's also resist adding methods to our Model class in all QE lectures, just to keep everything as consistent as possible. Once we start adding methods, it's not clear where to stop.) One small issue that needs to be fixed: we use z as the discount factor without explanation. Somewhere we need to add that we use beta(z) = z. |
|
Many thanks @jstac, I agree! Making it clear should be our priority for lectures! I will keep your suggestions in mind when reviewing lectures. I will push a minor edit incorprating your suggestion and merge this PR. |
|
Thanks @HumphreyYang, I appreciate it. |
Misc improvements -- make it nicer
Finish py file and then convert back to myst with jupytext
Clean up the vectorization stuff and different versions of B.
Get the plot working again and add some brief comments at the end.