LHAPDF 6 update Andy Buckley University of Glasgow / CERN PH-ADP + James Ferrando, David Hall, Steve Lloyd, Martin Ruefenacht, Karl Nordstrom, Graeme Watt PDF4LHC, CERN, 13 Dec 2013 1/11
The problem(s) with LHAPDF 5 (recap) ◮ Fortran codebase with static memory. Most sets’ common block workspace arrays are not really common. ⇒ huge memory requirements O ( 2 − 10 GB ) ⇒ Grid/batch issues ◮ Multiset, low-memory, etc. modes are hacks on top of fundamental situation. Speed, VMEM, flexibility, and correct operation all suffer depending on build-time configuration. NMXSET determined at build-time: too restrictive for e.g. error set reweighting Re-init very slow. Esp. later PDF members at end of file. Some functions don’t (can’t) respect multi-set indexing: alphaS , xMin , etc. ◮ Many different grid formats, and single-file sets add big parsing overhead (esp. for NNPDF and HERAPDF). 2/11
LHAPDF 6 ◮ Ground-up rewrite (in C++, with Python wrapper) attempting to learn from and solve all these problems AB, Martin Ruefenacht, Karl Nordstrom, James Ferrando, others ◮ Key feature: dynamic allocation: allocate only what you use — and no concurrency limitation PDF member (1 PDF for each of several flavours) is fundamental object; PDFSet is mostly for convenience User takes control of memory No more multi-set woes with alphaS, etc. ◮ Uniform data format and powerful “cascading” metadata Fixes e.g. Lam4/5 passing issues with LHAPDF5. Be careful with backward compatibility, e.g. tunes! 3/11
More LHAPDF 6 features (2) ◮ Maintainability: single PDF grid format and standard interpolators/extrapolators ipol/xpol specified at runtime via configuration metadata: flexible. Default is log-bicubic spline one data file-per member data, dir per set: zero-overhead random member access, tarball distribution arbitrary set of flavours supported, accessed by PDG ID code (so gluon is 21 or 0, a photon flavour is trivial!) distinct ipol grid blocks allow subgrids in Q . releasing a new PDF no longer needs a new LHAPDF code release! ◮ Speed: Single-flavour loading and interpolation are faster than LHAPDF5. Working on even faster full-set initialisation and performance-optimised ipol (variable caching, CPU cache alignment, vectorization, . . . ) ◮ Backward compatibility Fortran and C++ interfaces. PYTHIA6, Pythia8, Herwig++, Sherpa, POWHEG, TOP++ tested so far. ◮ α s system with analytic, ODE, and interpolation implementations, from metadata ◮ ForcePositive option (allow-neg, pos and pos-def behaviours) 4/11
Examples: data files Set info file: SetDesc: PDF fits using the standard CTEQ PDF evolution [...] Authors: H.-L.Lai, M.Guzzi, J. Huston, Z.Li, P.M.Nadolsky, [...] Reference: arXiv:1007.2241 NumMembers: 53 Flavors: [-5,-4,-3,-2,-1,1,2,3,4,5,21] OrderQCD: 1 Member data file: PdfType: central Format: lhagrid1 --- 1.000000e-08 1.214290e-08 1.474520e-08 1.790520e-08 ... [xs] 1.690000e+00 2.254442e+00 3.079814e+00 4.317128e+00 ... [Q2s] -5 -4 -3 -2 -1 1 2 3 4 5 21 [flavs] 0.000000e+00 0.000000e+00 5.253407e+00 6.215917e+00 ... [xfs] 0.000000e+00 1.868643e-01 5.367774e+00 6.316984e+00 ... [xfs...] ... 5/11
Examples: usage from C++ Single member: #include "LHAPDF/LHAPDF.h" ... LHAPDF::PDF* pdf = LHAPDF::mkPDF("CT10nlo", 0); size_t num_mems = pdf->numMembers(); // One value: double xf_g = pdf->xfxQ(21, 1e-3, 126.0); // Quark and gluon values: vector< double > xfs; pdf->xfxQ(1e-3, 126.0, xfs); // All values (partons, photon, gluino, ...): map< int , double > xfs = pdf->xfxQ(1e-3, 126.0); delete pdf; PDF set: vector<unique_ptr<LHAPDF::PDF>> pdfs; LHAPDF::mkPDFs("CT10nlo", pdfs); for ( const auto & p : pdfs) double xf_g = p->xfxQ(21, 1e-3, 126.0); 6/11
Examples: usage from Python Single member: >>> import lhapdf >>> pdf0 = lhapdf.mkPDF("CT10nlo", 0) >>> pdf0.xfxQ(21, 1e-3, 126) 31.199466144272378 PDF set: >>> pdfs = lhapdf.mkPDFs("CT10nlo") >>> len(pdfs) 52 >>> [pdf.xfxQ(21, 1e-3, 126) for pdf in pdfs] [31.199466144272378, 31.10261967456719, ... ... 7/11
Examples: C++ LHAPDF 5/6 compatibility Use the LHAPDF_MAJOR_VERSION macro to handle C++ API differences: # if defined LHAPDF_MAJOR_VERSION && LHAPDF_MAJOR_VERSION == 6 LHAPDF::PDF* pdf = LHAPDF::mkPDF("CT10nlo", 0); cout << "xf_g = " << pdf->xfxQ(21, 1e-3, 126.) << endl; delete pdf; # else LHAPDF::initPDFSet("CT10nlo", LHAPDF::LHGRID, 0); cout << "xf_g = " << LHAPDF::xfx(x, 1e-3, 126.) << endl; #endif 8/11
Memory Numbers from 6.0.0beta1 but still relevant LHAPDF 5 $ size -B -d ~/heplocal/lib/libLHAPDF.so text data bss dec 1509082 142048 2039405376 2041056506 ⇒ 1.5 MB functions, 140 kB data, 2 GB uninitialised data! ⇓ LHAPDF 6 $ size -B -d ~/heplocal/lib/libLHAPDF.so text data bss dec 265310 8504 1552 275366 ⇒ 2.6 kB functions, 8 kB data, 280 kB uninitialised data! WIN! 9/11
Set migration and validation ◮ We set a nominal LHA5 → 6 reproduction accuracy target of per-mille (1/1000) ◮ Regularised deviation measure ∆ = | f 6 − f 5 | / ( | f 5 | + ǫ ) ◮ Get sets from http://www.hepforge.org/archive/lhapdf/pdfsets/6.0/ xf vs. x -3 10 xfacc, flav = g , q =10 xfacc, flav = g , q =5 × 10 2 xfacc, flav = g , q =50 xfacc, flav = g , q =1 × 10 3 xfacc, flav = g , q =1 × 10 2 xfacc, flav = g , q =2 × 10 3 xfacc, flav = g , q =2 × 10 2 xfacc, flav = g , q =5 × 10 3 | f 6 − f 5 | / ( | f 5 | + ǫ ) -4 10 -5 10 -10 -9 -8 10 -7 -6 10 -5 -4 -3 -2 -1 0 10 10 10 10 10 10 10 10 10 x “Final” round of migrations upcoming to further improve/fix metadata 10/11
Set migration and validation ◮ We set a nominal LHA5 → 6 reproduction accuracy target of per-mille (1/1000) ◮ Regularised deviation measure ∆ = | f 6 − f 5 | / ( | f 5 | + ǫ ) ◮ Get sets from http://www.hepforge.org/archive/lhapdf/pdfsets/6.0/ xf vs. Q 0 10 xfacc, flav = g , x =1 × 10 − 8 xfacc, flav = g , x =0 . 1 xfacc, flav = g , x =1 × 10 − 6 xfacc, flav = g , x =0 . 2 xfacc, flav = g , x =0 . 0001 xfacc, flav = g , x =0 . 5 -1 10 xfacc, flav = g , x =0 . 01 xfacc, flav = g , x =0 . 8 | f 6 − f 5 | / ( | f 5 | + ǫ ) -2 10 -3 10 -4 10 -5 10 0 1 2 3 4 10 10 10 10 10 Q “Final” round of migrations upcoming to further improve/fix metadata 10/11
Set migration and validation ◮ We set a nominal LHA5 → 6 reproduction accuracy target of per-mille (1/1000) ◮ Regularised deviation measure ∆ = | f 6 − f 5 | / ( | f 5 | + ǫ ) ◮ Get sets from http://www.hepforge.org/archive/lhapdf/pdfsets/6.0/ α s vs. Q -1 10 asacc -2 10 | α 6 − α 5 | / ( | α 5 | + ǫ ) -3 10 -4 10 -5 10 0 1 2 3 4 10 10 10 10 10 Q “Final” round of migrations upcoming to further improve/fix metadata 10/11
Summary, limitations and to-dos Version 6.0.4 available to download now; 6.0.5 soon! PDF data update imminent: metadata improvements, MSTW and extra NNPDF validations Limitations: ◮ No photon or nuclear PDFs (at least not yet) ◮ All PDFs so far are interpolation grids ◮ Slightly larger files (CT10nlo is 28 MB vs. 21). ◮ Build requires ext libs: recent Boost and yaml-cpp libs. ◮ Not all PDFs will be migrated, not all approved by groups so far TODOs: ◮ Maybe add flavour aliasing and zipped reading. ◮ Speed-ups in both ipol and init (fast istream, vectorisation, etc.) ◮ Reduce Boost dependency and bundle yaml-cpp ⇒ 6.0.5 ◮ Generalized α s thresholds and other minor α s details ◮ Manager script to replace/upgrade lhapdf-getdata ◮ Zipped data files (for speed and space) ◮ Write-up! 11/11
Recommend
More recommend