-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add some benchmarking code with Stan and Nimble #214
Conversation
Pull Request Test Coverage Report for Build 11163678764Details
💛 - Coveralls |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.5.0 to /home/runner/.bridgestan/bridgestan-2.5.0
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@yebai a new CI for benchmark is set up and it reports something like #214 (comment). I didn't add nimble to the benchmark to be run on PR, but the code is in the repo (we just don't run it), because running Nimble requires more dependency through R etc, and the comparison to Stan should be sufficient information (nimble is 2-3x slower than Stan). I am merging this now, can start another PR for further improvement. |
The scripts can be used to run examples from Volume 1 of WinBUGS examples.
Stan examples are more optimized (vectorized computation, human effort went into transformed data and generated quantities, etc.).
Regardless, on these smaller problems, we should be able to match it's performance when compilation works.WithReverseDiff
compiled tape, JuliaBUGS gradient and density computation is several times (5- 10x) slower than Stan.ReverseDiff
is quite optimized, but it still has some fundamental overhead with the tape. To get comparable performance as Stan, I think we need to generate Julia code and useMooncake
orEnzyme
.Nimble's interface is a bit more tricky, the logp and gradient computation code is from Chapter 17. (code from Chapter 16 runs slowly). I am a bit confused by how to write
nimblefunction
. But the speed is good and it seems to work. Nimble's BUGS examples are a bit out-of-date, it looks to me some examples are from WinBUGS 0.5 era. But the models are generally the same.I think moving forward, use Stan as the target is good, easy to setup and also a good performance aim.