Pythia runs are five times slower with MadDM

Bug #2000771 reported by Mattia Di Mauro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MadDM
Confirmed
Wishlist
Unassigned

Bug Description

Dear MadDM developers,

When running Pythia through MadDM I noticed that the simulations are between a factor of 4-6 times slower with respect to running exacting the same executable with a Pythia installation outside MadDM. I have verified this using the singlet scalar portal model and by copying the file main101.cc present in runfolder/bin/internal and the file spectrum.cmnd and the LHE files into the Pythia environment (installed outside MadDM). I also verified the the source spectra generated inside or outside MadDM are exactly the same!

I think this could be a serious issue of MadDM because it could prevent to make runs with Pythia with large number of simulations that are needed to have a good statistics to have the DM source spectra.

Thanks for the consideration.

Mattia

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Are you using the same version of pythia8 (and potentially lhapdf?)?

Cheers,

Olivier

Revision history for this message
Mattia Di Mauro (mdimauro) wrote :

Hi Olivier,

As for Pythia, yes I am using exactly the same version which is the 8.306.

Instead, as for lhapdf, I not sure. When I enter in MadDM it says:
"set lhapdf to /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/HEPTools/lhapdf6/bin/lhapdf-config
set ninja to /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/HEPTools/lib
None does not seem to correspond to a valid lhapdf-config executable.
Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config).
Note that you can still compile and run aMC@NLO with the built-in PDFs"
So there seems to be some problem with importing the lhapdf package.
I have lhapdf installed through MadDM in the folder:
MG5_aMC_v2_9_9/HEPTools/lhapdf6.
I tried to do:
"set lhapdf set lhapdf /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/HEPTools/lhapdf6/bin/lhapdf-config" and it says:
"MadDM>set lhapdf /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/HEPTools/lhapdf6/bin/lhapdf-config
set lhapdf to /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/HEPTools/lhapdf6/bin/lhapdf-config
save options lhapdf
save configuration file to /Users/mattiadimauro/Dropbox/MadDM/MG5_aMC_v2_9_9/input/mg5_configuration.txt"
But then anytime I enter in MadDM there is still the message:
"None does not seem to correspond to a valid lhapdf-config executable.
Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config)."
Could this be the origin of the issue?

Best

Mattia

Revision history for this message
Daniele Massaro (dmassaro) wrote :

Hi Olivier,

(I used Pythia 8.306 with MadGraph LTS for the following tests)

I have an update on this question. I have run the main101 of MadDM using the same model and same LHEF file in few ways:
1. using Pythia compiled from MadGraph;
2. using an independent version of Pythia compiled by myself with the default flags.

In the case 2. I record an improvement of 5 in speed (from 24 s to 3 s for 10k events).

I then inspected the compilation flags that MadGraph uses, from the pythia8_install.log with respect to the ones used when compiling Pythia myself.
I found that in the latter case, there is also `-O2` which should optimize the code.
At this point, I used the installPYTHIA8.sh script in HEPToolsInstaller folder to compile a version of Pythia like MadGraph would do (I passed the same options that MadGraph also passes) and I have added the flag `-O2` to CXX_COMMON.

I repeated the test 1. and I recorded a time of 5 s.
In conclusion, I think that if we could add the optimization flag to the Pythia compilation happening in MadGraph, we could record a performance improvement in Pythia runs.

However, I ignore if there is a particular reason for which the optimization flag for the Pythia compilation has not been added.

Cheers.
--
Daniele

PS:
I verified that in the HEPToolsInstaller.py, the `-O2` flag is not passed for Pythia (like it happens for ninja, for e.g.).
Moreover, I inspected the configure script of pythia8 and I found that if --cxx-common is passed as a configuration option, and no debug is selected (as MadGraph is doing), then the following construct that sets CXX_COMMON is skipped (lines :
```
if [ -z "$CXX_COMMON" ]; then
    CXX_COMMON="${ENABLE_DEBUG}${ENABLE_64BIT}"
    CXX_COMMON="${CXX_COMMON}-std=c++11 -pedantic -W -Wall -Wshadow -fPIC"; fi
```
it contains the variable ENABLE_DEBUG, which is set at line 304:
```
[ "$ENABLE_DEBUG_SET" = true ] && ENABLE_DEBUG="-g " || ENABLE_DEBUG="-O2 "
```
So ENABLE_DEBUG contains the optimization flag, which is added to CXX_COMMON only in the case this is not passed from outside.
This demonstrates why the optimization is active if Pythia is compiled with no flags (like I did in the test 2.)
The slight changes in the configure script of Pythia in version 8.308 (latest version) do not affect what I wrote.

Changed in maddm:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Should be fixed in the latest version of HEPTOOLSInstaller.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.