Skip to content

Fix harmonics#110

Merged
giacomomagni merged 47 commits into
feature/N3LO_matchingfrom
feature/harmonics
Apr 12, 2022
Merged

Fix harmonics#110
giacomomagni merged 47 commits into
feature/N3LO_matchingfrom
feature/harmonics

Conversation

@giacomomagni
Copy link
Copy Markdown
Collaborator

@giacomomagni giacomomagni commented Mar 29, 2022

  • Move harmonics to a sub-package
  • Use the cached harmonics in the NLO anomalous dimension (to remove explict mellin_g3 calls, need to rewrite all the ad expressions probably not worth... )
  • Use the cached harmonics in the NNLO matching (remove explict mellin_g3 calls )
  • More clean harmonics cache ordering inside N3LO matching
  • Expand docs section about harmonics

@giacomomagni giacomomagni mentioned this pull request Mar 29, 2022
@alecandido
Copy link
Copy Markdown
Collaborator

@giacomomagni thank you very much for taking care of properly dealing with harmonics.

Actually, @niclaurenti was asking me about:

  • Use the cached harmonics in the NLO anomalous dimension (remove explict mellin_g3 calls )

this same afternoon. It seems like cached is not used at all in NLO QCD.

The moment you finish, please ask for a review also @niclaurenti.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2022

Codecov Report

Merging #110 (9606618) into feature/N3LO_matching (e6ee4bf) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@                   Coverage Diff                   @@
##           feature/N3LO_matching      #110   +/-   ##
=======================================================
  Coverage                 100.00%   100.00%           
=======================================================
  Files                         59        65    +6     
  Lines                       2965      3060   +95     
=======================================================
+ Hits                        2965      3060   +95     
Flag Coverage Δ
isobench 54.33% <33.19%> (-0.54%) ⬇️
unittests 100.00% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/eko/anomalous_dimensions/as1.py 100.00% <ø> (ø)
src/eko/evolution_operator/__init__.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/__init__.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f11.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f13.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f14_f12.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f16.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f17.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f18.py 100.00% <ø> (ø)
src/eko/harmonics/f_functions/f19.py 100.00% <ø> (ø)
... and 31 more

@felixhekhorn
Copy link
Copy Markdown
Collaborator

It seems like cached is not used at all in NLO QCD.

Just to confirm, this is true - moreover

https://github.com/N3PDF/eko/blob/341e6323e680d2320ae4400da61c92a445160416/src/eko/anomalous_dimensions/nlo.py#L5-L7

this is(/was) because NLO is also a special case inside PEGASUS - and I didn't wanted to duplicate that structure

@alecandido
Copy link
Copy Markdown
Collaborator

alecandido commented Mar 29, 2022

I guess at that time there was no point in worrying about a different and slower NLO, we had to write NNLO in the first place.

But now that we have eko working, do you still believe that we don't want to use cached harmonics? @felixhekhorn

It might be an optimization for the NLO runs.

@felixhekhorn
Copy link
Copy Markdown
Collaborator

do you still believe that we don't want to use cached harmonics? @felixhekhorn

It might be an optimization for the NLO runs.

definitely we want them! (Something we wanted to do since long ago ...) (I was just explaining why I decided like this back then)

Comment thread src/eko/matching_conditions/as2.py Outdated
Comment thread src/eko/matching_conditions/as2.py Outdated
Comment thread src/eko/matching_conditions/as2.py Outdated
Comment thread src/eko/harmonics/__init__.py Outdated
Comment thread src/eko/matching_conditions/as3/__init__.py Outdated
@felixhekhorn
Copy link
Copy Markdown
Collaborator

If I may suggest a crazy idea - and you can tell me whether you like it or not and whether it's feasable ...

we could go even a more radical step and enforce more the caching of harmonics (which we do believe is our biggest time consumer):

@alecandido
Copy link
Copy Markdown
Collaborator

@alecandido I added asv as dev-dependency by hand in pyproject.toml (4e5c2b1), but that apparently was breaking - do I need to run poetry update in addition? (I already ran for 10min and then gave up ...)

If you don't tell poetry to update the lockfile in any way, then you will end up in an inconsistent state between your pyproject.toml and poetry.lock, thus it's fair that it complaints...

You can do one of three things:

  1. if you want to update to the latest compatible versions all your dependencies, then yes, you have to do poetry update
  2. if you just want to generate a new lockfile, you can just use poetry lock
  3. if you just want to add a dependency, please consider not doing it by hand, but using poetry add (or poetry add -D for dev dependencies)

Comment thread doc/source/theory/Mellin.rst Outdated
@felixhekhorn
Copy link
Copy Markdown
Collaborator

@giacomomagni in 44759d0 I wanted to add a few tests to check the d_m - but then I realized, the way I implemented should not work, because S_{-1} really is a complicated object, i.e. it depends on being singlet-like or not ...

and again: https://github.com/N3PDF/eko/blob/44759d0ba93db67d8addf796f251dc5764ed7252/src/eko/harmonics/w1.py#L62
this should never happen! (as far as I understand)

Please double check the mathematics in this branch! Actually even looking at #83 I can see some (-1)**n

@giacomomagni
Copy link
Copy Markdown
Collaborator Author

I thought we discussed this in the past and we agreed that the factors (-1)**N couldn't appear explicitly inside the expressions of the ad/ome, but where only inside the harmonics...

@alecandido
Copy link
Copy Markdown
Collaborator

alecandido commented Apr 6, 2022

  • Expand docs section about harmonics

I will review, but I would tick also the last item before merging. You were right in putting it in :)

Copy link
Copy Markdown
Collaborator

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Benchmarks and documentation are fine (as usual: we should stop using benchmarks in sandbox mode as soon as possible...)

Comment thread benchmarks/performance/harmonics.py Outdated
Copy link
Copy Markdown
Collaborator

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Tests are mostly good (I'm just suggesting some aesthetic and readability), they even run in a reasonable amount of time (even though ome takes a bit, but that's fine).

Comment thread tests/eko/test_ad_nlo.py Outdated
Comment thread tests/eko/test_ad_nnlo.py Outdated
Comment thread tests/eko/test_ad_nnlo.py Outdated
# due to the approximations of F functions.
np.testing.assert_allclose(
aS3[1, 1], ref_val_qqNS[L][idx] + ref_val_qqPS[L][idx], rtol=3e-2
aS3[1, 1], ref_val_qqNS[L][idx] + ref_val_qqPS[L][idx], rtol=8e-2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This approximation looks really bad...

Copy link
Copy Markdown
Collaborator Author

@giacomomagni giacomomagni Apr 6, 2022

Choose a reason for hiding this comment

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

So here the difference it's from the fact that we are testing even moments, but in A_qqNS we have replaced all the occurrences of (-1)^N -> -1 (explicit and implicit in the harmonics). This is not fully possible in Mathematica unless you expand all the harmonics also there...
On top of this effect there is even the approximation of the F functions, but the former should be the leading,
so I'd say this difference is expected.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok, I get the technical limitation. At this point I just wonder if we should drop the test.
However, we're always in time to do it.

Comment thread tests/eko/test_matching_n3lo.py Outdated
Comment thread tests/eko/test_matching_n3lo.py Outdated
Copy link
Copy Markdown
Collaborator

@felixhekhorn felixhekhorn left a comment

Choose a reason for hiding this comment

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

I didn't re-review everything, but I hope it is fine - and we need this stuff soonish in develop ...

@giacomomagni giacomomagni merged commit 9606618 into feature/N3LO_matching Apr 12, 2022
@delete-merged-branch delete-merged-branch Bot deleted the feature/harmonics branch April 12, 2022 14:08
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.

4 participants