-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
upgrade sundials to 4.1.0 #1098
Conversation
@bgoodri ... would be good if you can have a look at the printf stuff to make sure it will work with rstan wrt to CRAN policies. Thanks! |
This is strange: I am getting unresolved symbol errors for sundials things in tests which do not involve at all any sundials stuff. If someone has an idea where this is coming from - that would be great. EDIT: This likely has to do with updates to the CVODES interface to it's internal solver routines which changed with version 4.0. Let's see. |
…ls. The compatibility files from sundials cause link problems otherwise.
I think a number of PRs right now hang as the Windows test machine seems to be down. Can someone (@bgoodri , @seantalts ) maybe kick the respective machine? Thanks. |
Yeah, unfortunately it's completely offline right now and located in NYC. @bgoodri said he should hopefully be able to physically kick it soon. Sorry about that. |
On Jan 5, 2019, at 10:02 AM, wds15 ***@***.***> wrote:
This is strange: I am getting unresolved symbol errors for sundials things in tests which do not involve at all any sundials stuff. If someone has an idea where this is coming from - that would be great.
Sounds like a makefile issue, where it's trying to build a sundials translation unit. This may just be from an include of sundials from the higher-level lib include.
|
@bob-carpenter : I think to have found the issue. With Sundials 4.0 the interface to the non-linear solvers was changed. The compatibility wrappers which make 4.0 source compatible with pre-4.0 codes was written in a way such that it does not only declare functions, but defines them instantly in the header files. This causes the problems here. Turning to the new 4.0 interface solves the issue, I think. @seantalts No worries... I was hoping you have some remote access to the window machines. @bgoodri Please kick those Windows boxes hard! It's Windows after all. |
I am fairly sure it fixes it and was hoping that @bgoodri could confirm by looking and/or testing it. My windows machine I am sitting on is broken right now. The way to test it is to download StanHeaders 2.18.0 revert the changes @bgoodri did to the respective header file ( Like I say I don't have a windows available which is not broken - maybe a VirtualBox at home will do, but if you have a Windows available then go ahead and test. |
Ok, i got my windows toolchain working again. However, I am not able to trigger the issue @bgoodri has identified. Thus before this PR gets stalled, I suggest that we take down the claim from this PR to fix the issue @bgoodri found. I think #1008 will be fixed with this, but I cannot verify. I am modifying the PR text and I hope you agree, @syclik, that we can proceed and merge. |
You can merge this PR. If necessary, I will just keep fixing it.
…On Mon, Jan 14, 2019 at 5:10 AM wds15 ***@***.***> wrote:
Ok, i got my windows toolchain working again. However, I am not able to
trigger the issue @bgoodri <https://github.com/bgoodri> has identified.
Thus before this PR gets stalled, I suggest that we take down the claim
from this PR to fix the issue @bgoodri <https://github.com/bgoodri>
found. I think #1008 <#1008> will
be fixed with this, but I cannot verify. I am modifying the PR text and I
hope you agree, @syclik <https://github.com/syclik>, that we can proceed
and merge.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1098 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADOrqmd72ibENwriBu2mCUk4UWUrcaahks5vDFeogaJpZM4Zw5Bu>
.
|
@bgoodri, what do you have to do to fix it? Is there a general way to fix
this?
…On Mon, Jan 14, 2019 at 8:49 AM bgoodri ***@***.***> wrote:
You can merge this PR. If necessary, I will just keep fixing it.
On Mon, Jan 14, 2019 at 5:10 AM wds15 ***@***.***> wrote:
> Ok, i got my windows toolchain working again. However, I am not able to
> trigger the issue @bgoodri <https://github.com/bgoodri> has identified.
> Thus before this PR gets stalled, I suggest that we take down the claim
> from this PR to fix the issue @bgoodri <https://github.com/bgoodri>
> found. I think #1008 <#1008> will
> be fixed with this, but I cannot verify. I am modifying the PR text and I
> hope you agree, @syclik <https://github.com/syclik>, that we can proceed
> and merge.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1098 (comment)>, or
mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/ADOrqmd72ibENwriBu2mCUk4UWUrcaahks5vDFeogaJpZM4Zw5Bu
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1098 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_FyQbmaH86tsiz0Yk_RNLjZoQSXyIks5vDIrKgaJpZM4Zw5Bu>
.
|
I just change that file to the one on
#1008
…On Mon, Jan 14, 2019 at 8:50 AM Daniel Lee ***@***.***> wrote:
@bgoodri, what do you have to do to fix it? Is there a general way to fix
this?
On Mon, Jan 14, 2019 at 8:49 AM bgoodri ***@***.***> wrote:
> You can merge this PR. If necessary, I will just keep fixing it.
>
> On Mon, Jan 14, 2019 at 5:10 AM wds15 ***@***.***> wrote:
>
> > Ok, i got my windows toolchain working again. However, I am not able to
> > trigger the issue @bgoodri <https://github.com/bgoodri> has
identified.
> > Thus before this PR gets stalled, I suggest that we take down the claim
> > from this PR to fix the issue @bgoodri <https://github.com/bgoodri>
> > found. I think #1008 <#1008>
will
> > be fixed with this, but I cannot verify. I am modifying the PR text
and I
> > hope you agree, @syclik <https://github.com/syclik>, that we can
proceed
> > and merge.
> >
> > —
> > You are receiving this because you were mentioned.
> > Reply to this email directly, view it on GitHub
> > <#1098 (comment)>,
or
> mute
> > the thread
> > <
>
https://github.com/notifications/unsubscribe-auth/ADOrqmd72ibENwriBu2mCUk4UWUrcaahks5vDFeogaJpZM4Zw5Bu
> >
> > .
> >
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1098 (comment)>, or
mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AAZ_FyQbmaH86tsiz0Yk_RNLjZoQSXyIks5vDIrKgaJpZM4Zw5Bu
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1098 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADOrqn9oWUVcGacx5h876iTtz-m9_HxRks5vDIs0gaJpZM4Zw5Bu>
.
|
I think that @bgoodri won't need to change the file again as his instructions are taken care of wrt to the |
Bump. Would be great if we can merge this or define what requirements are needed to get this in. I haven't changed anything other than aligning with the new sundials 4.0.1 interface to their solvers. No change in behavior should be implied by this. Note that we are at sundials 3.1 and in the meantime there was 3.2 and now there is 4.0.1. @syclik , @bob-carpenter , @seantalts ... thoughts? |
I spoke with @wds15. I need to follow up with pystan developers to find out if this will build once merged. |
@ariddell @ahartikainen: how is Sundials packaged for PyStan now? If we bump the version, does this pose a problem for PyStan? |
No problem.
…On 1/28/19 12:21 PM, Daniel Lee wrote:
@ariddell <https://github.com/ariddell> @ahartikainen
<https://github.com/ahartikainen>: how is Sundials packaged for PyStan
now? If we bump the version, does this pose a problem for PyStan?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1098 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AmFA1q7m4iFk6RYgjYVPT5BSJXaTkMfmks5vHzF9gaJpZM4Zw5Bu>.
|
Thanks!
On Mon, Jan 28, 2019 at 1:25 PM riddell-stan <notifications@github.com>
wrote:
… No problem.
On 1/28/19 12:21 PM, Daniel Lee wrote:
> @ariddell <https://github.com/ariddell> @ahartikainen
> <https://github.com/ahartikainen>: how is Sundials packaged for PyStan
> now? If we bump the version, does this pose a problem for PyStan?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1098 (comment)>, or
> mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AmFA1q7m4iFk6RYgjYVPT5BSJXaTkMfmks5vHzF9gaJpZM4Zw5Bu
>.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1098 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_F_pYr9Neu-Xe_beqn3Uv6CNOW0RVks5vH0CLgaJpZM4Zw5Bu>
.
|
@wds15, I'm looking at it. So far, so good. Should we just go to v4.0.2 since we're upgrading? |
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.
@wds15, everything looks good but we need to document the shell script so it's useful in the future. Just putting a script undocumented there isn't cutting down the maintenance burden much.
Otherwise, awesome!
lib/prepare-sundials.sh
Outdated
@@ -0,0 +1,21 @@ | |||
#!/bin/bash | |||
|
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.
@wds15, could you document this script at a high-level? What would be extremely helpful:
- Why / when a maintainer would use this.
- What the maintainer needs to set up before using this.
- What variables the maintainer needs to set in the script.
- What the expected output is and how the maintainer is supposed to know this worked correctly.
Finally, we need to put this in the wiki. Probably here: Updating Libraries
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.
I added a lib/sundials-config/README.md
file which covers the above (except 4). Point 4 can be handled by our unit tests. If those pass then all is fine.
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.
What's sundials-config
?
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.
sundials-config contains all stan specific configuration items for Sundials. I introduced it in my last commit. It serves to separate out things.
lib/prepare-sundials.sh
Outdated
rm -rf INSTALL_GUIDE.pdf config/ doc/ examples/ test/ */cvode */ida */arkode */kinsol | ||
find . -name CMakeLists.txt -exec rm {} \; | ||
|
||
find src -name "*.c" -type f -exec sed -E -i _orig 's#[^sf]printf\(#STAN_SUNDIALS_PRINTF(#'g {} \; |
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.
I would prefer if we would actually commit to git the source directly from Sundials at this point prior to changing things. Even if it's just one commit followed by another, I think it'll help us back out changes if we mess up the process. What do you think?
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.
Hmm... I would not do that as it complicates things. Moreover, git is super clever with these version changes and only tracks actual changes. Having those vanilla sundials -> adapted sundials commits in between bloats this.
Instead I am suggesting to have a sundials_version
and a sundials-config
directory. The content of the sundials_version
is the stock sundials tar with our changes applied. The sundials-config
contains all stan specifics (README.md, script, special stan include & sundials_config).
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.
Hmm... I would not do that as it complicates things. Moreover, git is super clever with these version changes and only tracks actual changes. Having those vanilla sundials -> adapted sundials commits in between bloats this.
I have the opposite reaction when I know this.
I'm looking for easier review and maintenance. The overall result will be the same.
If we have one commit that's the pruned Sundials and the next that's the changes to Sundials, I find using the GitHub interface it's easy to tell that the second commit actually does what we intend. And if we make a mistake, it's easy to back out that one commit. If the two actions aren't separated in git, then we can't tell and it's more work in verifying that this is correct.
In fact, this would have helped with this current PR. Try thinking about the person reviewing. If I told you that I've updated a library and changed things, how would you verify it? My first thought was to download and do a diff, but I can't compare that to the final. If there's a better way to validate the PR, let me know. If not, let's add the additional git commit, which, as you say, git is clever and won't actually impact the user (but will positively impact the reviewer).
@wds15, did we avoid this in the past due to this change to make/libraries? from develop:
from this PR:
Should we just revert this change? |
I think I did this one purpose, because some files were missing otherwise. |
…v/math into feature/issue-sundials-4
Assuming the testing suite gives a green light this is good to go, I hope. |
Hmm... we now have an upstream CmdStan test failing with
I am not sure why this is popping up now nor where this is coming from. I will need to look further into this. The thing is that a lot of tests before this one just pass and then out of the blue this pops up. If I figure out how to restart this downstream test, then I will try to "fix" it like this for the moment being - out of lack of other ideas right now. |
Ok... when restarting only the downstream job the pipeline succeeds. Thus, I am kicking Jenkins to do the full thing once more. |
Finally! Green... this is hopefully good to go in. @seantalts ... do you need anything to review this? |
Which part(s) am I to review? Any tips for looking at just the stuff we changed vs. the vendored unchanged sundials library? |
I think @syclik was fine with this PR except the upgrade script. So maybe you try that out (grab the script and run it over a fresh branch off from develop)? @syclik did invest quite some work into this script, I have to say; all bits are automatic (unless sundials moves things around which makes our makefiles fail over). The changes to stan-math sources are reviewed and the makefile changes were also waived, I think. So it's down to the script. As a last sanity check you should execute the bdf+adams integrate ode tests. |
@seantalts, I can approve it. I think it's clear that both @wds15 and I have looked carefully at the script and merges and are confident that it's readable. If you have time and want to look carefully, this is the file to check: lib/upgrade-sundials.sh. https://github.com/stan-dev/math/pull/1098/files#diff-1ca3f358ea4ffad65560c3bf9575d698 I just reverted the changes to the makefile and Jenkinsfile so they're not part of this PR. With @wds15's last changes, this shouldn't be a problem. |
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.
Good to merge.
@wds15, if you see it change to green, go ahead and merge. (I removed the changes to Jenkinsfile and make/libraries that weren't necessary, so it's testing again now.)
Summary
This upgrades Sundials to the new major version 4.1.0.
The changes to the source base of stan-math are:
Change of initialization for CVODES solver.
CVodeCreate
does not have anymore a second argument for the solver which is now by default the newton solver.The former way of dealing with the
printf
&fprintf
from Sundials was flawed and is replaced with a new scheme as suggested by @bgoodri , see the issue stan_sundials_printf_override.hpp is not that helpful #1008 . This PR follows the recommendations given in the issue stan_sundials_printf_override.hpp is not that helpful #1008, but there is no guarantee that stan_sundials_printf_override.hpp is not that helpful #1008 is fixed due to troubles in reproducing the issue.To ease upgrading to future Sundials packages this PR includes a script
lib/upgrade-sundials.sh
which automates all steps needed to prepare the official Sundials package & add things to git.Tests
All existing tests (should) still run just fine. In particular the ODE & IDAS tests:
Side Effects
-Werror
to runmake test-headers
. There's a warning in CVODES that prevents us from getting past this --make test-headers
was meant to only test our code. I applied a fix, which is to add a new make target calledsundials
, build that in the Jenkins test with our normal compiler settings, then callingmake test-headers
to use-Werror
to test the header files.Checklist
Math issue Upgrade Sundials to version 4.1.0 #1097
Copyright holder: Sebastian Weber, Generable
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 doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested