BGap: HUGE ~140x performance improvement at higher alpha' orders
commit3567ef3678d3dfbce51009c9ad38b5e5986e5a6d
authorCarlos R. Mafra <crmafra@gmail.com>
Wed, 28 Sep 2016 21:26:17 +0000 (28 22:26 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Thu, 29 Sep 2016 19:01:46 +0000 (29 20:01 +0100)
treecd7f95fec0dba017ca042771858071fdbe49546a
parent95574d56c42fcde0f8e0903da293e4df49c24127
BGap: HUGE ~140x performance improvement at higher alpha' orders

The previous implementation was too naive.

It would load all the terms in the BG recursion at once, and only
then would apply the initial condition phi(A|B) = 0 if A\B != 0 etc.
That is totally fine when the number of terms is not too big (in FORM
standards), as is the case for, say, 8pts up to zeta6 order or 9pts
to zeta5 or so. Since FORM crushes through all the terms, one doesn't
even notice that the whole expansion is far from optimized.

But the situation drastically changes for 9 or 10pts up
to zeta7, as the number of terms during intermediate steps simply
explodes and even FORM has a hard time to handle them.

Of course, given enough time and disk space, the calculations would
eventually finish. But I have no patience when I know things can be better.

The idea of this patch is really simple. It's based on the observation
that the contact terms (given by the regular integrals) do not change
during the recursion since the recursion does not act on the slots of
the integrals. So now the program loads the regular integrals only
during the last step of the recursion, when everything else has already
been done.

Since the recursion is going on with much fewer terms, the performance
gain is HUGE!

For example, now we can compute the following 9pt integral up to
alpha'^7 in 7 seconds (the result contains 205k terms!):

L example = Zint(1,3,4,5,8,2,6,7,9,[p],1,2,3,4,5,6,7,8,9);
#call BGexpand(7)

Time =       3.30 sec    Generated terms =     205947
         example         Terms in output =     205947
                         Bytes used      =   21861416
  3.30 sec + 13.55 sec: 16.86 sec out of 6.94 sec

Before this patch:

Time =     135.75 sec    Generated terms =     205947
         example         Terms in output =     205947
                         Bytes used      =   21861416
  135.75 sec + 2142.03 sec: 2277.78 sec out of 990.39 sec

A HUGE speedup factor of 142x! (6.9 sec vs 990 sec).

For 10pts at alpha'^7, the speedup is much higher. One
particular integral whose calculation wasn't finished
after more than 5 hours (again, no patience) now takes
around 20 secs.

While this patch improves a lot the calculation at higher
alpha' orders for higher number of points, it slows down
a bit the calculation of more trivial integrals
(like 7pts at zeta4).

This will be addressed in a later patch...
18 files changed:
BGap.h
BGphiN/BGphi3-Jreg.h [new file with mode: 0644]
BGphiN/BGphi3-ordered.h [deleted file]
BGphiN/BGphi4-Jreg.h [new file with mode: 0644]
BGphiN/BGphi4-ordered.h [deleted file]
BGphiN/BGphi5-Jreg.h [new file with mode: 0644]
BGphiN/BGphi6-Jreg.h [new file with mode: 0644]
BGphiN/BGphi7-Jreg.h [new file with mode: 0644]
BGphiN/BGphi8-Jreg.h [new file with mode: 0644]
BGphiN/BGphi9-Jreg.h [new file with mode: 0644]
BGphiN/BGphi9-ordered.h [deleted file]
NptJregs/10ptJregs.h [new file with mode: 0644]
NptJregs/4ptJregs.h [new file with mode: 0644]
NptJregs/5ptJregs.h [new file with mode: 0644]
NptJregs/6ptJregs.h [moved from BGphiN/BGphi5-ordered.h with 99% similarity]
NptJregs/7ptJregs.h [moved from BGphiN/BGphi6-ordered.h with 50% similarity]
NptJregs/8ptJregs.h [moved from BGphiN/BGphi7-ordered.h with 97% similarity]
NptJregs/9ptJregs.h [moved from BGphiN/BGphi8-ordered.h with 77% similarity]