-
Notifications
You must be signed in to change notification settings - Fork 51
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
Performance: Flush IOHandler only once, not for each Iteration #1642
Performance: Flush IOHandler only once, not for each Iteration #1642
Conversation
SerialIOTests fileBased_write_test still failing.
cfc5db1
to
7c999c8
Compare
I just tested this against @guj's data on Perlmutter and it clearly improves the performance. |
Thanks Franz. I just checked out this branch, and on Mac it did not show any difference however I do see on Perlmutter it saved about 10% (20 seconds) . On my Mac times observed are pretty much the same as before. |
No difference at all? I observed a clear system-independent performance regression for You can further improve performance by using deferred iteration parsing: Series series = Series(fileName, readMode, "defer_iteration_parsing = true");
// ...
auto ex = series.iterations[i].open().meshes["E"]["x"]; And even further by closing the Iterations after using them: series.iterations[i].close(); Even without these improvements, I see a performance improvement far above just 20 seconds for going through 4000 Iterations. |
Ah, I was running issue380.cpp Yes, issue380_f has significant improvement after your fix!!
|
Great to hear!
Does that one have noticeable performance issues that we need to look into? |
|
@@ -2071,6 +2071,7 @@ inline void fileBased_write_test(const std::string &backend) | |||
.makeConstant<double>(1.0); | |||
|
|||
o.iterations[overlong_it].setTime(static_cast<double>(overlong_it)); | |||
o.flush(); |
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.
Note: This change makes the test stricter, since Series::flush()
unlike the destructor will not swallow exceptions.
862d538
to
2fc967f
Compare
This might address a performance regression seen by @guj.
Until now,
Series::flushFileBased()
andSeries::flushGorVBased()
flushed the IOHandler for every iteration. Since flushing has a constant overhead, callingSeries::flush()
has a linear complexity along with the number of Iterations, even if only a single Iteration has modifications.Fixing this was not entirely trivial, since in file-based encoding, some frontend object must unset the
written
flag, since they must be written anew for each file. Before this PR, this could easily be done synchronously in the frontend, but since all Iterations are now flushed at once, this must now be done asynchronously in the backend as a backend task.Also speed up the common case of parsing flush options: No options at all.
written
logic might behave weird in more complex setups