-
-
Notifications
You must be signed in to change notification settings - Fork 193
Feature/elementwise checks revert revert #2007
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
Should I run the model which uncovered the performance regression on this pr? |
@wds15 that's probably the easiest way to review. I used that model to check if I was actually changing anything. |
…4.1 (tags/RELEASE_600/final)
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
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.
All looking pretty good (assuming the speed issue has been fixed), just some minor comments
…4.1 (tags/RELEASE_600/final)
…thub.com/stan-dev/math into feature/elementwise_checks_revert_revert
…4.1 (tags/RELEASE_600/final)
I added a couple screen functions to check if the checks are necessary. The tests are a bit awkwardly long (I just copy pasted from |
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.
All looking good to me, just a couple global statements in tests. Otherwise good to go!
@@ -3,10 +3,10 @@ | |||
#include <limits> | |||
#include <vector> | |||
|
|||
const char* function = "check_positive"; |
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.
Missed a global here
#include <stan/math/prim/fun/constants.hpp> | ||
#include <vector> | ||
|
||
using stan::math::is_positive_finite; |
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.
Little global
The timing of my benchmark on this is not looking good:
Do I need to turn on lto for develop?? |
Perhaps, but can you upload model/data? The one I was using was like 6.2 seconds vs. 6.5 seconds, but I was comparing develop with this to develop without this. |
Same model, same data as before |
…thub.com/stan-dev/math into feature/elementwise_checks_revert_revert
@wds15 I checked this on my copy of the model and this branch doesn't have performance regressions vs. develop. Test file and data: Run command:
Runtime this branch:
Runtime develop:
Last line of output this branch:
Last line of output develop:
|
Ok..let me rerun with lto then. I thought it would have not been needed for this model, since I don’t really know where jacobians are needed (only a gradient, so not set zero adjoint)...but let’s check. |
Ok, so with -flto everything is fine:
We need lto to be on by default on develop... will file the issue for that now. |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
@andrjohns tests passed so this is good to review again |
Summary
This is the revert of the revert to put it back in the elementwise checks from @peterwicksstringfield from #1798
We reverted that pull before the release cause of performance things (https://discourse.mc-stan.org/t/cmdstan-2-24-release-candidate-now-available/16818/39).
The trick was the optimization discussed here: #1798 (comment)
Eigen must do some tricks to make their
.isFinite()
check fast. For eigen types, we run the fast checks first to see if something isn't finite before running the slower checks that produce the good error messages.Tests
There are new tests in here: #1798, but none on top of that
Side Effects
Just the side effects of #1798 (a bugfix for sparse stuff)
Release notes
New functions is_nonnegative and is_positive_finite to parallel check_nonnegative and check_positive_finite. They signal failure by returning false instead of by throwing std::domain_error.
Functions check_not_nan, check_nonnegative, check_positive, check_finite, check_positive_finite, is_not_nan, is_nonnegative, is_positive, is_scal_finite, and is_positive_finite now operate on nested containers.
Clearer error messages when csr_u_to_z is called with out of range indices.
check_positive now throws domain error when given an unsigned 0.
(Copied those from #1798)
Checklist
Math issue Deeply nested containers and error checks #1635 (don't close)
Copyright holder: Peter Wicks Stringfield
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