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

Feature timing, Closes #524 #699

Merged
merged 13 commits into from
May 12, 2019
Merged

Feature timing, Closes #524 #699

merged 13 commits into from
May 12, 2019

Conversation

paulstapor
Copy link
Contributor

Added cputime for forward and backward solve to the output of Amici, to get a feeling for the overhead from python to C++, and to see how the pure computation time scales with the size of the model (for comparison: theory vs. practice).

@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@e65a45d). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #699   +/-   ##
==========================================
  Coverage           ?   73.94%           
==========================================
  Files              ?       50           
  Lines              ?     7434           
  Branches           ?        0           
==========================================
  Hits               ?     5497           
  Misses             ?     1937           
  Partials           ?        0
Flag Coverage Δ
#cpp 70.88% <100%> (?)
#python 83.65% <ø> (?)
Impacted Files Coverage Δ
include/amici/solver.h 100% <ø> (ø)
python/amici/numpy.py 81.69% <ø> (ø)
include/amici/rdata.h 0% <ø> (ø)
src/hdf5.cpp 88.12% <100%> (ø)
src/solver.cpp 72.2% <100%> (ø)
src/backwardproblem.cpp 75.7% <100%> (ø)
src/forwardproblem.cpp 89.25% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e65a45d...4045805. Read the comment docs.

@FFroehlich
Copy link
Member

Had a brief look at the code. Please make the cpu times private Solver members and add respective getter functions. Then add extraction of time + writing to rdata to forward problem.

I am currently in the process of refactoring the whole handling of rdata and the goal is no never have solver/model interact with rdata, which increases modularity/interoperability of these classes and adds some additional flexibility in terms of when and whether data is written to rdata.

@dweindl
Copy link
Member

dweindl commented May 8, 2019

And please add Closes #524 to the pull request description or commit message

@paulstapor paulstapor changed the title Feature timing Feature timing, Closes #524 May 8, 2019
src/solver.cpp Outdated
@@ -54,7 +54,7 @@ int Solver::run(const realtype tout, ReturnData *rdata) const {
} else {
status = solve(tout, AMICI_NORMAL);
}
rdata->cpu_time +=(double)((clock() - starttime) * 1000) / CLOCKS_PER_SEC;
incrementCpuTime((realtype)((clock() - starttime) * 1000) / CLOCKS_PER_SEC);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a private member, you should still be able to modify it without a setter routine. I don't think we want a setter routine as the Solver class itself should be the only one that modifies those values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I'll do that. Thanks!
Other question: How about the way, it's currently implemented in forward or backwardproblem.cpp? Would you prefer incrementing the rdata-member after every run, or once at the very end of the routine (as it is now)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other question: How about the way, it's currently implemented in forward or backwardproblem.cpp? Would you prefer incrementing the rdata-member after every run, or once at the very end of the routine (as it is now)?

It's fine as it is now, as it is consistent with how other things are handled at the moment. In the long run I want to change this to be all done in a single function that can be called independently of forward/backwardproblem, but one thing at a time.

@paulstapor paulstapor requested a review from FFroehlich May 9, 2019 15:02
@paulstapor
Copy link
Contributor Author

@FFroehlich : As I'm (hopefully) done so far but have no permission for merging: Can you please merge, once the checks have passed?

Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add new rdata members to rdata serialization (serialization.h), to checkReturnDataEqual in testsSerialization.cpp and the writeReturnData's in hdf5.cpp (newton_cpu_time also seems to be missing)

@FFroehlich
Copy link
Member

@FFroehlich : As I'm (hopefully) done so far but have no permission for merging: Can you please merge, once the checks have passed?

I don't see why you wouldn't have permission, we should fix that.

@paulstapor
Copy link
Contributor Author

@FFroehlich : As I'm (hopefully) done so far but have no permission for merging: Can you please merge, once the checks have passed?

I don't see why you wouldn't have permission, we should fix that.

At least, for the last PRs I didn't have it... So I guess I don't have it now...
So, alternatively, if I have permission, then I'd merge it...

@paulstapor paulstapor merged commit e9d820d into develop May 12, 2019
@paulstapor paulstapor deleted the feature_timing branch May 12, 2019 12:09
@dweindl dweindl mentioned this pull request Jul 24, 2019
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

Successfully merging this pull request may close these issues.

3 participants