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

Add specialized binary search skipping boundary check #4026

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

multitalentloes
Copy link

Small adjustment that skips checking if the indices are within the range because this is already checked in the outer function.
This function is very often called, so might give a small improvement.

Copy link
Member

@bska bska left a comment

Choose a reason for hiding this comment

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

Could we not use std::upper_bound() for this instead?

@multitalentloes
Copy link
Author

multitalentloes commented Apr 23, 2024

std::upper_bound() seems to be slower on my machine benchmarking a couple of runs on norne...
Edit:
To be a bit more precise, the property evaluation on single core norne on my machine took 75 sec with the original code, 72sec with this small change, and 77 sec using std::upper_bound to binary search and std::distance to get the index

@akva2
Copy link
Member

akva2 commented Apr 24, 2024

benchmark please

@multitalentloes
Copy link
Author

The measurements are probably within what can be explained by noise, so hopefully then benchmark can provide some consistent results

@ytelses
Copy link

ytelses commented Apr 24, 2024

Benchmark result overview:

Test Configuration Relative
opm-git OPM Benchmark: drogon - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: drogon - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: punqs3 - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: punqs3 - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: smeaheia - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: smeaheia - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: spe10_model_1 - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: spe10_model_1 - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_extra - Threads: 1 - FOIT (Total Oil Injection At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_extra - Threads: 8 - FOIT (Total Oil Injection At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_norne - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_norne - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_norne_4c_msw - Threads: 1 - FOPT (Total Oil Production At End Of Run) 1
opm-git OPM Benchmark: flow_mpi_norne_4c_msw - Threads: 8 - FOPT (Total Oil Production At End Of Run) 1
  • Speed-up = Total time master / Total time pull request. Above 1.0 is an improvement. *

View result details @ https://www.ytelses.com/opm/?page=result&id=2448

@bska
Copy link
Member

bska commented Apr 25, 2024

Benchmark result overview:

FOPT (Total Oil Production At End Of Run) = 1

That's good to know, but alas not particularly useful from a CPU performance point of view. @blattms: Is anything up with the benchmark test rig at the moment?

@multitalentloes
Copy link
Author

That was a bit underwhelming, but how are these times measured since there is absolutely no deviation on any case?

@akva2
Copy link
Member

akva2 commented Apr 25, 2024

notice that those are not even times. benchmarks either didn't execute properly, or it only reported fluid statistics back.

@bska
Copy link
Member

bska commented Apr 25, 2024

but how are these times measured since there is absolutely no deviation on any case?

notice that those are not even times.

@akva2 is correct–the FOPT measure isn't a time at all. Rather it's a (crude) measure of solution accuracy. If FOPT differs from one here, then we didn't compute the same solution as the reference case and it in some sense doesn't really matter what performance improvement we get from the PR under test.

@multitalentloes
Copy link
Author

Can we get some clarifications as of what happened to the performance benchmark @blattms

@akva2
Copy link
Member

akva2 commented May 14, 2024

benchmark please

@ytelses
Copy link

ytelses commented May 14, 2024

Benchmark result overview:

Test Configuration Relative
opm-git OPM Benchmark: drogon - Threads: 1 0.997
opm-git OPM Benchmark: drogon - Threads: 8 0.993
opm-git OPM Benchmark: punqs3 - Threads: 1 0.978
opm-git OPM Benchmark: punqs3 - Threads: 8 1.009
opm-git OPM Benchmark: smeaheia - Threads: 1 0.973
opm-git OPM Benchmark: smeaheia - Threads: 8 1
opm-git OPM Benchmark: spe10_model_1 - Threads: 1 1.019
opm-git OPM Benchmark: spe10_model_1 - Threads: 8 0.997
opm-git OPM Benchmark: flow_mpi_extra - Threads: 1 0.989
opm-git OPM Benchmark: flow_mpi_extra - Threads: 8 0.985
opm-git OPM Benchmark: flow_mpi_norne - Threads: 1 0.984
opm-git OPM Benchmark: flow_mpi_norne - Threads: 8 0.995
opm-git OPM Benchmark: flow_mpi_norne_4c_msw - Threads: 1 1.008
opm-git OPM Benchmark: flow_mpi_norne_4c_msw - Threads: 8 1.001
  • Speed-up = Total time master / Total time pull request. Above 1.0 is an improvement. *

View result details @ https://www.ytelses.com/opm/?page=result&id=2470

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.

None yet

4 participants