Repository navigation
Running of alphas (QCD coupling) #373
Description
Hi @roiser @oliviermattelaer I dumo here a few questions/ideas that we just discussed with Stefan.
Olivier can you please correct me if I am wrong? :-)
- First point, what is this about and what this implies in the calculations
(Note: focus on the default stream, reading from cards. I implemented an optional 'hardcoded' stream too, but it may be incomplete, or in any case its not the main point).
Currently
- We currently have one aS value that is a constant 0.118 (read from card or hardcoded in Parameters.h).
- There are some other parameters like G, sqrtaS etc which depend on aS (in Parameters again, either from card or hardcoded constexpr calculations)
- There are then model couplings like GC10, GC11, which depends on all these parameters aS, G, sqrtaS etc
- CPPProcess in an init phase propagates the model parameters GC10, GC11 to the constants cIPC (CUDA constant memory, or static c++ memory... not even sure if there is some hardcoding done here actually?)
- CPPProcess in every event calculation passes the appropriate cIPC[i] constants to the FFV functions
- The FFV functions assume that each coupling is a constant: even if FFV in vector C++ or in CUDA is able to handle several events at the same time, the same constant couplings are always used
What we need because of physics:
aS = aS0 * f(Q2)
In practice:
- The valuse of aS to be used is different from one event to another: the aS0=0.118 constant needs to be multiplied by a factor f(Q2) which depends on the "scale" Q2.
- The scale Q2 actually depends on the momenta of the external particles (and more? I will come back to this later)
- This means that the values of G, sqrtaS etc should also depend event by event
- This means that GC10, GC11 etc and the cIPC should also depend event by event
- This means that the couplings that enter the FFV should also depend event by event
- Knowing the running value of aS - i.e knowing the factor f(Q2), how can this be propagated to ME calculations?
2a) The part before FFV: keep the constants as they are to represent as0?
Changing the existing Parameters and cIPC infrastructure would be too complex, and would probably be a wrong idea. I think that I would keep the existing stuff up until the cIPC, which are still constants and can still in constant CUDA memory and static const c++ memory. Essentially the cIPC constants represent the values of the constants based on the reference value aS0.
One would then a function (in Parameters? something that can be easily code generated!) that describes how each of the parameters would change.
- Luckily all of these are multiplicative factors with a given exponent?
- Example, if aS must be multiplied by 1.10 i.e. a 10% change, sqrtaS must be multiplied by sqrt(1.10) ie a 5% change
Given these formulas, one can then inside CPPProcess, for each event, BEFORE calling the FFVs, determine a "running" or "variable" vIPC, i.e. vIPC[0]=cIPC[0]*formula_for_cIPC0(fQ2)
This vIPC then needs to be applied to the individual FFV functions
2b) The part inside/after FFV: apply the running as multiplicative factors?
How can then these be propagated to the FFV? There are two ways:
- First way, change the interfaces of the FFVs to have a vector of values, one per event, instead of a constant which is the same for all events. This would significantly complicate the code: for instance in CUDA these vIPC themselves would need to be arrays in global memory. For vector C++ each coupling would be a cxtype_sv instead of a cxtype.
- Second way: apply the appropriate factor in CPPProcess to the result of esach FFV, AFTER FFV has been called with a constant parameter. This assumes that the dependency of the result of an FFV on f(Q2) is itself a multiplicative factor, but that different FFV functions have different dependencies (example: you may have one diagrams where you have one gluon propagator, but interefering with a diagram where there is no gluon propagator, so the first diagrams and its FFVs scale by aphas, the second does not?)
- Third way: if we may assume that the same scaling applies to all diagrams, then we can just calculate one multiplicative factor to the final sum of all diagrams... but I imagine this would be wrong for physics, and too much of an approximation?
- Third part: how to get the factor f(Q2) for the scaling of alphas?
If I understand correctly, we need two formulas/algorithms:
- one, the exact formula for the multiplicative factor f(Q2) in as=as0*f(q2) given the scale Q2
- two, how do we compute the scale Q2 for one given event
For the Fortran-C++ interaction, I guess this can be done in three ways:
- the fortran computes the scale q2 and computes the multiplicative factor f(q2) for each event: the fortran passes f(q2) to c++
- the fortran computes the scale q2 for each event and passes it to the c++: the c++ then computes the formula f(q2)
- the fortran does nothing and only passes momenta to c++: the c++ computes the scale q2 from the momenta in each event, and then computes f(q2) for each event
If this third option is possible, it would be my preferred one. Essentially, we would also need to implement in C++ the formula for computing Q2 from the momenta... but maybe this is too complex or impossible,Olivier?
Voila, long brain dump - comments more than welcome! Andrea
Activity
[-]Running of alphas[/-][+]Running of alphas (QCD coupling)[/+]oliviermattelaer commentedon Feb 4, 2022
In general the matrix-element can be written as
In practise for most computation, only the first term is present.
and for the rest the second term is typically very small (and the last one as well)
Knowing the dependence in each coupling allows to do such computation exactly in a easy way.
But if you want to keep CIPC constant, then the best is likely to let fortran to handle the running
(even if they are restriction for the moment or if this is not perfect).
roiser commentedon Feb 4, 2022
but if we can do better, why not do it? I mean the option 1 above for passing the data upfront into the FFV functions would mean to change one parameter type to become a vector instead of a scalar. We are still in R&D, moreover nobody outside will depend on those functions, we are free to modify in any direction we'd like.
valassi commentedon Feb 4, 2022
Hi, Stefan I kind of agree with you that we could try something 'better' if possible, as we are in R&D. It is more complex than changing one parameter from scalar to vector however, sorry I was a bit simplistic. Changing cxtype to cxtype_sv would work for vector C++, but for CUDA we need something more complex. Essentially we need another MemoryBuffer for couplings, in global memory, with its own accessor, like for momenta, wabevfunctions and everything else that varies event by event. Before doing that I would still investigate if we can do something simpler, eg running FFV as-is with constant parameters, and changing the result of FFV a posteriori for each event. Anyway, up to you to try out options!
One important question however - for Olivier: what is done in the all-Fortran version now? From what you say, I seem to understand that there is now an approximation, of the type you mention? I think that we shoudl keep this in two steps: FIRST, try to reproduce exactly the Fortran-only results through our new Fortran-C++/CUDA chain, and for this we should use whatever approximation (if any) is done in Fortran now; SECOND, if we can do it 'better', this would actually changing physics results (to make them more "accurate" if anything), but then this becomes also a physics work, not just a software work,.. this would require a lot of physics studies too, maybe very interesting, but I would keep this as a second step. Am I misunderstanding, is there no approximation at all now?
roiser commentedon Feb 8, 2022
Just to recap from our discussion yesterday in the Madgraph meeting. @oliviermattelaer thinks that if we go down the "complicated" route the computation of the scales would make sense only in Fortran (at least for now), then pass them on to the Cuda/C++ and do the rest there. This would also have the advantage that we can profit from eventual SIMD/T processing which may be better developed there as in Fortran.
Having said this, for a first approach for our goal of the full workflow it seems sensible to stay even stay as is and compute with a fixed value of alpahS. So the approach above can come later but I would start continue looking into it.
[v311] in ggtt.mad, use a fixed renormalization scale: now the 0-30% …
oliviermattelaer commentedon Apr 13, 2022
For the input from fortran, the list of coupling are currently store in a common block
that we can pass to the bridge now.
roiser commentedon Apr 14, 2022
Thanks @oliviermattelaer , just to say the latest version of alphaS calculations is now available in #428 , this exposes the Gs on the bridge to be passed in. @valassi wanted to take care of merging that in.
[v311] in ggtt.mad, use a fixed renormalization scale: now the 0-30% …
[alphas] add a comment in mgOnGpuConfig.h: MGONGPU_HARDCODE_CIPC is n…
valassi commentedon Apr 22, 2022
Thanks @oliviermattelaer and @roiser.
I am working on Stefan's #428. There were quite a few things missing (tests failing, and code generation to be done). That is now superseded by PR #434.
Many issues are fixed (all tests are passing), but the code generation is not there yet. One issue is that gc10/gc11 are process specific for ggtt, but for instance do not exist in eemumu. So I would leave only the gs as a high level interface, and move gc10 and gc11 to "internal implementation" not exposed in the bridge for instance, Technically, computing the dependent couplings becomes one instance of "splitting kernels" #310 and there are quite a few issues to solve there about the best APIs and responsibilities for the classes, eg CPPProcess and MEK #356. In practice: where should the orchestration of kernels be, in MEK or in CPPProcess? This is relevant to code generation because the prchestartion of kernels (how many kernels you have and in which order you run them) is process specific. Until now MEK was a process agnostic class. So I have a decision to make, departing from what was done so far
I will have a look... I am copying bits of this comment to #356
valassi commentedon Apr 22, 2022
To be concrete, I am typically playing with these 5 processes. They have a different number of dependent couplings (ie running couplings dependent on G which depends on the running coupling constant alphas QCD - "running" here is the important point as they change event by event):
I am inclined to add a new parameter ndcoup that must be auto generated, and then have some arrays dimensioned according to this. May not be the best or most elegant, but should be an effective way to handle code generation.
Note by the way that some cleanup is also neeed in parameters_sm: should remove code that is no longer used there with running parameters. This is where I got the 0,2,3 above:
madgraph4gpu/epochX/cudacpp/ee_mumu/src/Parameters_sm.cc
Line 100 in c0c2768
madgraph4gpu/epochX/cudacpp/gg_tt/src/Parameters_sm.cc
Line 98 in c0c2768
https://github.com/madgraph5/madgraph4gpu/blob/master/epochX/cudacpp/gg_ttg/src/Parameters_sm.cc#L98
[alphas] FINALLY COMPLETE (the first draft of) alphas code generation m…
valassi commentedon Apr 28, 2022
All issues specific to alphas discusseds above are solved in PR #434, extending Stefan's #428
There are a few related issues for which I opened specific tickets
I keep this open, until #441 (and maybe #440) is fixed
[alphas] fix build error in eemumu.mad - simply add ALL_G from COUPL.…
valassi commentedon May 11, 2022
The main issues #439 #440 #441 are now fixed.
In particular, PR #452 which fixed #441 has made the connections between Olivier's common block in Fortran that includes "ALL_G" for different events, and their passing to the cudacpp ME calculation.
This is now visible in my basic test that prints the ME ration of Fortran to cudacpp (as Stefan was doing long ago), and the ratios are 1 within 1E-5 approximately. Using the code as of f47d792 :
For comparison, in c0c2768 before PR #434 the same was giving
Here the ratio was constant (thanks to the fact that I disabled multichannel), but not 1, because a hardcoded value of alphas (without any running) was used.
Note however that in both cases I was using running of alphas disabled in some cards? I need to cross check this
valassi commentedon May 11, 2022
Yes indeed in commit 6dd0db2 I changed
valassi commentedon May 11, 2022
If I now check with event-by-event running of alphas:
I also need to rebuild. This creates a new .inc that gets linked.
Using the old c0c2768 before PR #434 I was getting
With the latest code this is now ok! This is commit 4f900d9 in PR #453
[alphas2] go back to variable renormalization scales! proper test of …
valassi commentedon May 11, 2022
NB THE TICKET WHERE I WAS DISCUSSING THIS IS #417
[alphas2] go back to variable renormalization scales! proper test of …
[alphas2] in ggtt.mad, go back to variable renormalization scales! pr…
[alphas2] in codegen, keep the default run_card_default for madgraph5…
valassi commentedon May 11, 2022
I am about to merge PR #453 where I move back to variable renormalization scales (ie truly running alphas event by event) and all results are the same in Fortran and Cudacpp. I will close this #373 about running alphas.
I will keep the other #417 open for the moment as I want to implement some more automatic tests that frtran and cudacpp are the same, in a less verbse way - and possibly add performance comparisons. The same infrastructure will then be used also when I integrate multichannel too.
[alphas] FINALLY COMPLETE (the first draft of) alphas code generation m…