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

Speedup Grid::convolute_eko #103

Merged
merged 5 commits into from
Jul 3, 2022
Merged

Speedup Grid::convolute_eko #103

merged 5 commits into from
Jul 3, 2022

Conversation

cschwan
Copy link
Contributor

@cschwan cschwan commented Jan 19, 2022

The runtime for Grid::convolute_eko for double-hadronic grids is, unfortunately, quite long, of the order of 10-15 minutes for a typical case. I'm convinced that we can improve the runtime, and I have at least two ideas how:

  1. Eliminate zeros of the EKO early. Commit 6aa3ba4 checks, for all source- and target-PID tuples, whether the operator is non-zero by going through all its elements once. For instance, in many of the grids we have a photon as an initial state, but often we ignore the PDF at the fitting scale and so we can skip everything that has a photon. This is also true for top and anti-top quarks, and possibly for other quark flavour as well.
  2. The actual convolution can be rewritten as a loop over the different mu2 values, each performing the following operation in the general case where there are two hadronic initial states: (FK)_ij = sum_k O_il (G_lm)_k O_mj, so that we could leverage fast linear algebra libraries.

However, we need to test and benchmark this.

@cschwan cschwan added the enhancement New feature or request label Jan 19, 2022
@cschwan cschwan added this to the v0.6.0 milestone Jan 19, 2022
@cschwan cschwan self-assigned this Jan 19, 2022
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #103 (b7014fd) into master (e91a7df) will increase coverage by 0.06%.
The diff coverage is 88.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
+ Coverage   88.43%   88.49%   +0.06%     
==========================================
  Files          31       31              
  Lines        3060     3085      +25     
==========================================
+ Hits         2706     2730      +24     
- Misses        354      355       +1     
Impacted Files Coverage Δ
pineappl/src/grid.rs 88.37% <88.00%> (+0.12%) ⬆️
pineappl_cli/src/helpers.rs 89.89% <0.00%> (-1.12%) ⬇️
pineappl_cli/src/plot.rs 93.15% <0.00%> (+1.05%) ⬆️

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 e91a7df...b7014fd. Read the comment docs.

@felixhekhorn
Copy link
Contributor

@cschwan I added an additional condition to the skipping to make it DIS compatible

@cschwan
Copy link
Contributor Author

cschwan commented Jan 24, 2022

@felixhekhorn cheers, good catch!

@felixhekhorn
Copy link
Contributor

On ATLAS_TTB_8TEV_TOT we went from 3:15 to 2:51, so not that much ... fine for me to merge

@cschwan
Copy link
Contributor Author

cschwan commented Jan 24, 2022

@alecandido @felixhekhorn that was just 1), but the my hope is that 2) gives a much larger improvement (not yet implemented).

@cschwan
Copy link
Contributor Author

cschwan commented Jan 24, 2022

I observed that the EKO for the default grid in Pineko is triangular in the source and target x, but the row with source x has 3 more entries than expected for a truly triangular matrix. That's probably because of the interpolation order (3?). However, this is different for points close to x = 1 (5 more entries). Did you increase the interpolation order in this region?

@felixhekhorn
Copy link
Contributor

As explained in the docs we're taking the N_deg+1 (default: 4+1=5) nearest points - which on the border leads to additional offdiagonals

@felixhekhorn
Copy link
Contributor

2. The actual convolution can be rewritten as a loop over the different mu2 values, each performing the following operation in the general case where there are two hadronic initial states: `(FK)_ij = sum_k O_il (G_lm)_k O_mj`, so that we could leverage fast linear algebra libraries.

However, we need to test and benchmark this.

Can we postpone 2. to a separate PR and close this one?

@alecandido
Copy link
Member

Can we postpone 2. to a separate PR and close this one?

Maybe convert 2. in an issue first, since no one has time to dedicate to it right now.

@cschwan
Copy link
Contributor Author

cschwan commented Jun 30, 2022

Or we simply leave it open because now this PR basically is 2 😄. Why do you want to close it?

@alecandido
Copy link
Member

Or we simply leave it open because now this PR basically is 2 smile. Why do you want to close it?

Fine by me.
I believe @felixhekhorn wanted to start using 1., but if I remember correctly it wasn't a big change in performance.

@felixhekhorn
Copy link
Contributor

felixhekhorn commented Jun 30, 2022

this is getting stale (no activity the last half year) and the longer you wait the more difficult it will be to merge

@cschwan cschwan merged commit 8748da9 into master Jul 3, 2022
@cschwan cschwan deleted the speedup-eko branch July 3, 2022 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants