Skip to content

Conversation

@cschwan
Copy link
Contributor

@cschwan cschwan commented Jul 13, 2025

TODO:

  • Issue when converting grids into APPLgrid #357; fixed by commit 2d72820
  • proton-anti-proton grids should successfully convert, but the convolution test fails, because we pass a proton PDF instead of an anti-proton PDF; fixed by commit d337717
  • one grid fails, because it contains a channel that was integrated with a single phase-space point which Grid::optimize wrongly detects as a static scale
  • fix wrong coupling-order permutation; fixed by commit 335e8c5
  • change internal APPLgrid lumipdf name; fixed by commit 6f1fed1

@cschwan
Copy link
Contributor Author

cschwan commented Jul 13, 2025

Commit 2d72820 fixes the problem described in #357, but it uncovered another problem. Apparently, the coupling orders are wrongly permuted: LO subgrids seem to be saved as NNLO subgrids and vice versa, NLO subgrids are correct.

@cschwan cschwan self-assigned this Jul 13, 2025
@cschwan cschwan added the bug Something isn't working label Jul 13, 2025
@cschwan cschwan added this to the v1.2 milestone Jul 13, 2025
@cschwan
Copy link
Contributor Author

cschwan commented Jul 20, 2025

@jamspandex: I'm not sure how to contact you properly to report a problem with APPLgrid, so I'm doing it here: two of the exported grids,

https://ploughshare.web.cern.ch/ploughshare/db/pinejet/pinejet-cdf-z0-arxiv-0908.3914/pinejet-cdf-z0-arxiv-0908.3914.tgz
https://ploughshare.web.cern.ch/ploughshare/db/pinejet/pinejet-d0-z0-arxiv-0702025/pinejet-d0-z0-arxiv-0702025.tgz

export properly but then can't be read by APPLgrid, which exits with an exception:

cannot create std::vector larger than max_size()

I tracked this down to a problem in src/appl_file.cxx, which uses int for file sizes, but the uncompressed APPLgrid size is larger than 2^31 - 1, which in turn is larger than int can hold on my system. This fix is quite simple:

--- src/appl_file.cxx	2025-07-20 12:44:59.505362251 +0200
+++ src/appl_file.cxx.new	2025-07-20 12:46:00.353096239 +0200
@@ -27,8 +27,8 @@
     //    std::cout << "appl::file::opening file: " << filename() << "\toptions: " << mopt << std::endl; 
 
     /// file sizes - actual filesize and uncopmpressed size
-    int filesize = 0;
-    int usize    = 0;
+    off_t filesize = 0;
+    off_t usize    = 0;
     
     if ( mopt.find("r")!=std::string::npos ) { 
 
@@ -50,7 +50,7 @@
       if ( (zip_signature&0xffffff)==0x88b1f ) {   
 	/// if it is read the file size, and the uncompressed filesize from the file ...
 	/// uncompressed size
-	int offset = filesize - 4;
+	off_t offset = filesize - 4;
 	fseek( tmp_file, offset, SEEK_SET );
 	fread( &usize, sizeof(int), 1, tmp_file );
       }
@@ -117,11 +117,11 @@
       gzseek( mfile, usize-sizeof(SB::TYPE)*3, SEEK_SET );
       gzread( mfile, (void*)vtrailer, sizeof(double)*3 );
 
-      int index_size = (vtrailer[1]-vtrailer[0]-sizeof(SB::TYPE)*3); /// in bytes
+      off_t index_size = (vtrailer[1]-vtrailer[0]-sizeof(SB::TYPE)*3); /// in bytes
       
       std::vector<SB::TYPE> vindex(index_size/sizeof(SB::TYPE)); 
            
-      int indexptr = vtrailer[0];
+      off_t indexptr = vtrailer[0];
 
       ///      std::cout << "vtrailer[0]: " << vtrailer[0] << std::endl;
       ///      std::cout << "vtrailer[1]: " << vtrailer[1] << std::endl;

I changed int to off_t, which is the type of stat_buf.st_size. Let me know if you need to know more!

@jamspandex
Copy link

jamspandex commented Jul 20, 2025 via email

@cschwan
Copy link
Contributor Author

cschwan commented Jul 20, 2025

OK thanks, although are you really creating grids which are larger than 2 GB ? I would question the efficacy of such large grids.

Yes and no, before the conversion to APPLgrid I'm rewriting the luminosities, which probably replicate some subgrids very inefficiently, but the LZ4 and GZIP compression algorithms fix that again. I think the compressed grids (both APPLgrid and PineAPPL) are about 70 MB large, but uncompressed much larger.

In addition, I had to recently modify the grid code because of the unfortunate tendency for all lumipdfs in pineappl convertex grids to be given the same PineAPPL-Lumi.config name, which will cause problems if you try to load grids for different processes with different parton-parton luminosity combinations. I added code to circumvent that, such that if it find lumipdfs with the same name, but different parton-parton combinationms, then it automatically renames the girds internall, but I don;t really like doing that, since you lose the correspondence between the actual name encoded in the grid, and what the gird is using. So really it would be better practice to encode the name of the process in the lumipdf name itself, such as with wmjets-PineAPPL-Lumi.config for W- + jets and so on. In principle, when running a calculation, the lumipdf config can also be read from a file, so clearly they would all need to have process specific names. Thanks Mark

I didn't know that this is a problem, I will change it.

@cschwan
Copy link
Contributor Author

cschwan commented Aug 12, 2025

I opened a new Issue for the last remaining item: #361.

@cschwan cschwan merged commit 181d1e5 into master Aug 12, 2025
10 checks passed
@cschwan cschwan deleted the fix-export-applgrid branch August 12, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants