-
Notifications
You must be signed in to change notification settings - Fork 7
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
Added lru caches to speed up validphys multi-replica initalization #1945
Changes from all commits
f898466
208f86b
4ce061c
8550fa2
1f5a925
dd4b98a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,15 @@ | |
from importlib.resources import read_text | ||
import logging | ||
import re | ||
import functools | ||
|
||
import numpy as np | ||
|
||
from reportengine.checks import check, make_check | ||
from reportengine.compat import yaml | ||
from validphys.commondatawriter import write_commondata_to_file, write_systype_to_file | ||
import validphys.cuts | ||
from validphys.utils import freeze_args | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
@@ -561,6 +563,8 @@ def _make_point_namespace(self, dataset, idat) -> dict: | |
return ns | ||
|
||
|
||
@freeze_args | ||
@functools.lru_cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same note to myself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For NNPDF4.0 with 3 replicas it is called 1001 times. For 2 replicas 693 times. --> I'm sorry, this comment was intended for the other function produce_rules in config.py!!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one yes, but I think it might be fixed now (in other PR). The other one I'm more worried about. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For NNPDF4.0 with 3 replicas it is called 1040 times. For 2 replicas 732 times. |
||
def get_cuts_for_dataset(commondata, rules) -> list: | ||
"""Function to generate a list containing the index | ||
of all experimental points that passed kinematic | ||
|
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.
a note to myself to check what enters here and whether maybe the problems are related to what I see in #1678 (since if so, that won't be a problem)
Are you absolutely certain this one is needed for the multi-replica? Since in principle this function should only happen once.
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.
I will check in master
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.
For NNPDF4.0 with 3 replicas it is called 1001 times. For 2 replicas 693 times.
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.
I see. Then indeed, let's keep the freeze args for now, but please add a comment with that info on top. That should definitely not happen since the rules should be the same per replica, so I believe this is a signal of a problem somewhere else which hopefully can eventually be solved.
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.
Added comment in 19771a0