-
-
Notifications
You must be signed in to change notification settings - Fork 193
Simplifying existing autodiff to prepare for adding var_value<Matrix<T, R, C>>
support to rev/fun
#2019
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
Conversation
…4.1 (tags/RELEASE_600/final)
…4.1 (tags/RELEASE_600/final)
…var_value's grad so that it is only available when the value_type of the var_value is not a container
…4.1 (tags/RELEASE_600/final)
…/math into vari_base_ops_partials # Conflicts: # stan/math/rev/functor/ad_stack_matrix.hpp
…4.1 (tags/RELEASE_600/final)
…/math into vari_base_ops_partials
…4.1 (tags/RELEASE_600/final)
…4.1 (tags/RELEASE_600/final)
…vari_base_ops_partials
…4.1 (tags/RELEASE_600/final)
return {new internal::determinant_vari<T::RowsAtCompileTime, | ||
T::ColsAtCompileTime>(m)}; | ||
auto arena_m = to_arena(m); | ||
auto m_lu = arena_m.val().partialPivLu(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same algorithm that was being used previously. The implementation just looks different, see #2120
@SteveBronder this is ready for review. I'm gonna work on the red light, but I tried to go through everything and update the code style to be like what we're converging on. I also benchmarked and optimized everything. It should be good to go. I'm going to update the benchmarks overnight. You can browse them as of last night here (they're pretty okay): https://bbbales2.shinyapps.io/math-shiny-perf/ I wrote these things to be as fast as possible for |
…v/math into feature/convert_to_tadj1
…4.1 (tags/RELEASE_600/final)
Running through these now. Because it's a larger PR it's a bit easier for me to make another branch with suggested changes I'm working on / benching over here feature/convert_to_tadj1...feature/convert-to-tadj1-changes The tl;dr so far is that there's a good few functions here we know for a fact are much better and should port them into a separate PR so they can go in this release. But there's a handful of functions that I'm wishy washy on (gp_exp_quad_cov and the like among them) and need more work. Why don't we cherry pick the ones that are much faster and are probably used a lot like
|
Yo you around for a call? I don't like breaking this up. The point was to convert stuff over. If there is something that is too slow, let's fix it now while we're going through it. I see |
I checked out the benchmarks for this. The comparison we want I think is this branch vs. develop. So on the benchmark page (https://bbbales2.shinyapps.io/math-shiny-perf/) Set the left dropdown to With that I think the minimum list of functions we want to move are:
I would also like It says this branch vs. development that the minimum speedup for dot product is 0.9 and the maximum speedup is 1.5. Similarly for matrix multiply. I don't believe it since neither of those things change, so something is going on. It might be that we need to randomize the order of the test repetition or running two at a time is bad. I only want to do |
@SteveBronder could you post the gp_exp_quad_cov benchmark you were using? |
I was just using the one you wrote |
Was that a 13% (makes sense) or 13000% (I would not expect this and this would bear further investigation)? |
Ah that came from the cmdstan performance tests repo https://github.com/stan-dev/performance-tests-cmdstan You can also see it here when the performance tests ran on this PR |
OOOo, nice, I was not paying attention to those numbers! Thanks |
I think we've done the majority of the conversions here, so I'm gonna close this. The issue itself should stay open cause there's still a lot of simplification/cleanup we can do. |
Summary
This is an attempt to reimplement reverse mode autodiff using
reverse_pass_callback
in preparation for addingvar_value<Matrix<T, R, C>>
to rev/fun.Side Effects
It's possible this is slower than the old stuff. Dunno till it's benchmarked.
Release notes
Re-implemented reverse mode autodiff using
reverse_pass_callback
and new arena toolsChecklist
Math issue Simplifying current reverse mode functions #2018
Copyright holder: Columbia University
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested