Skip to content
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

esum is slow #61

Closed
zingale opened this issue Oct 17, 2017 · 8 comments
Closed

esum is slow #61

zingale opened this issue Oct 17, 2017 · 8 comments

Comments

@zingale
Copy link
Member

zingale commented Oct 17, 2017

We use esum() to do exact sums of specific terms in the RHS of the ODEs to prevent roundoff. But esum() is slow. At the moment, we have a general routine with a large max_esum_size -- this also causes trouble on the GPUs.

We should experiment with creating specific esum() routines for the number of terms involved, e.g., esum3(), esum4(), esum5(), ...

We know this ahead of time, since we are explicitly calling esum() on specific combination of terms in rate equations.

@zingale
Copy link
Member Author

zingale commented Oct 17, 2017

we should also try to mark this function as pure and get it inlined

@zingale
Copy link
Member Author

zingale commented Oct 17, 2017

the esum algorithm comes from here: https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf

@zingale
Copy link
Member Author

zingale commented Oct 18, 2017

it is also not clear if enum makes sense with just 2 numbers. Is it really better than just a + b

@zingale
Copy link
Member Author

zingale commented Oct 21, 2017

the esum branch removes all the esum() calls with 2 elements in aprox13. This gives identical results to the original version when using test_react (as compared with fcompare). This suggests that for 2 elements, it does not matter.

The code is about 3% faster w/o the esum() on 2 elements.

I'm going to try to do a custom sum for 3 elements next.

@zingale
Copy link
Member Author

zingale commented Oct 21, 2017

PR #65 addresses some of this

@zingale
Copy link
Member Author

zingale commented Sep 7, 2018

should this still be open?

@maxpkatz
Copy link
Member

maxpkatz commented Sep 7, 2018

I think it should still be open. We still have improvements we can make.

@maxpkatz
Copy link
Member

Closing, I've done all I plan to do on esum at the moment -- the optimizations we've already thought of have been done, and new ones can be in a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants