-
Notifications
You must be signed in to change notification settings - Fork 37
Madgraph4GPU User Guide
Last modification: 25 Apr 2024
generate 10k events for p p > t t~ g on a CPU:
git clone --recurse-submodules https://github.com/madgraph5/madgraph4gpu.git
cd madgraph4gpu/MG5aMC/mg5amcnlo
cat << EOF >> pp_ttxg.mg5
generate p p > t t~ g
ouptut madgraph_simd
launch
EOF
./bin/mg5_aMC pp_ttxg.mg5The instructions below shall provide the necessary information for users of the madgraph4gpu repository to install the software, generate the source code for various physics processes and to run the event generation for those.
We have agreed with the upstream mg5amcnlo team to provide madgraph4gpu as a "plugin" to the project. The instructions below provide you the current way of retrieving and building the software. It is expected that the way of retrieving the software will change, the usage of it though shall be less impacted by the future evolution of this software.
If you run into any troubles with the guide below please contact [email protected]
We are building the software with various compiler versions and linux operating systems. Below you find a table of combinations which we have tested.
| OS | Compiler |
|---|---|
| Alma Linux 9.3 | gcc 13.1.1 |
| OS | CPU compiler | NVidia GPU compiler |
|---|---|---|
| Alma Linux 9.3 | gcc 13.1.1 | nvcc 12.4 |
| OS | CPU compiler | AMD GPU compiler |
|---|---|---|
As the software is still under development we have not provided an official release of it yet. We always intend to keep the master branches in a working state. To retrieve the Madgraph4GPU package together with the upstream Madgraph5_amc@NLO generator software you can checkout the software with
git clone --recurse-submodules https://github.com/madgraph5/madgraph4gpu.gitThe upstream mg5amcnlo package is currently being provided as a git submodule in the repository under madgraph4gpu/MG5aMC/mg5amcnlo. With the git clone above the proper version with the correct git hash of the submodule shall be checked out which is compatible with the madgraph4gpu project. In case of incompatibilities you can checkout the proper tip of the branch of this submodule with
cd madgraph4gpu/MG5aMC/mg5amcnlo
git checkout gpucppThe project aims to stay as close as possible to the original syntax of mg5amcnlo when it comes to generating physics processes. We have augmented the syntax where necessary e.g. to steer the generation of code for a certain hardware platform or the level of parallelisation for the event generation.
From a functionality point of view two modes for the code generation can be distinguished
- "madevent" mode which allows the full fledged generation of events which can be generated together with the mg5amcnlo package which provides pieces such as the random number generation, phase space sampling, phase space integration and I/O.
- "standalone" mode provides a reduced functionality and shall be done when e.g. used in connection with another event generator where the matrix element calculations are used as a "plugin"
Some further remarks:
- madgraph4gpu is currently capable to generate code for leading-order processes and run them.
- We also provide or are working on a limited set of SUSY, HEFT and SMEFT processes. If you are interested in those please send us a mail
- We are also working on next-to-leading-order processes. At this moment there is no code generation available though yet
The files below can be launched by running ./bin/mg5_aMC <filename> in the madgraph4gpu/MG5aMC/mg5amcnlo of the madgraph4gpu repository
A simple set of commands for running the event generation for the p p > t t~ g process on CPU:
generate p p > t t~ g
output madevent_simd PROC_pp_ttx
launch
set cudacpp_backend CPP
set vector_size 32
set nevents 250k
set sde_strategy 1Notes:
- The
simdinoutput madevent_simdtriggers the code generation for CPU architectures -
set cudacpp_backend CPPspecifies the specific architecture backend. At the moment onlyCPPis available. Internally the vector width available on the build machine will be used for compilation. -
set vector_size 32sets the level of parallel execution. The minimum value is4, the recommendation is to use a number high enough to fill the CPU vector register withnC++ double precision numbers. E.g. the vector width of AVX2 is 256 bit which will fit 4 64-bit double precision numbers.- Over committing those numbers is a good idea
- NB: madgraph4gpu also allows the calculation of matrix elements also in single (float) precision but tests have shown that the generated physics results are not accurate enough. We do not recommend to use this mode.
-
set sde_strategy 1shall be used for the time being when generating code via madgraph4gpu (explanation !!)
Switching to GPU generation (e.g. on an NVidia GPU) the input file changes to:
output madevent_gpu PROC_pp_ttx
launch
set cudacpp_backend CUDA
set vector_size 8192
set nevents 250k
set sde_strategy 1Notes:
- For running efficiently on GPUs with double precision calculations you need "high end" GPUs e.g. NVidia A100. Other "consumer grade" GPUs will not provide sufficient double precision calculation power.
- Use
output madevent_gpufor GPU processing - Use
set cudacpp_backend CUDAfor processing on any NVidia GPU. NB: the code already supports AMD GPUs, a special option for those will be added. -
set vector_sizeto a sufficiently large numbers. The number should be a multiple multiple of the number of cores and modulo 0 the number of streaming multiprocessors (SM) of the GPU (e.g. 128 SMs on an NVidia GA100)
| madgraph4gpu | The project to speed up the Madgraph5_aMC@NLO event generator package by offloading parts of the upstream project to compute accelerators |
| mg5amcnlo | The upstream Madgraph5_aMC@NLO event generator package, as provided in |