[论文解读] Speeding up Madgraph5 aMC@NLO through CPU vectorization and GPU offloading: towards a first alpha release
本文通过利用CPU向量化(AVX512)和GPU卸载(CUDA、SYCL)技术,对Madgraph5_aMC@NLO进行了重大性能优化,实现了在向量CPU上高达16倍的加速,在GPU上也获得了显著性能提升。该工作已实现与MadEvent框架的完整集成,首个alpha版本预计于2023年第二季度发布,支持LHC级别的QCD过程,具备完整的物理保真度和更高的吞吐量。
The matrix element (ME) calculation in any Monte Carlo physics event generator is an ideal fit for implementing data parallelism with lockstep processing on GPUs and vector CPUs. For complex physics processes where the ME calculation is the computational bottleneck of event generation workflows, this can lead to large overall speedups by efficiently exploiting these hardware architectures, which are now largely underutilized in HEP. In this paper, we present the status of our work on the reengineering of the Madgraph5_aMC@NLO event generator at the time of the ACAT2022 conference. The progress achieved since our previous publication in the ICHEP2022 proceedings is discussed, for our implementations of the ME calculations in vectorized C++, in CUDA and in the SYCL framework, as well as in their integration into the existing MadEvent framework. The outlook towards a first alpha release of the software supporting QCD LO processes usable by the LHC experiments is also discussed.
研究动机与目标
- 为解决现代高性能计算(HPC)硬件——尤其是向量CPU和GPU——在高能物理(HEP)工作负载中,特别是在蒙特卡洛事件生成中的利用率不足问题。
- 重新设计Madgraph5_aMC@NLO中的矩阵元(ME)计算,以利用向量化CPU和GPU上的数据并行性与同步执行。
- 将高性能ME实现(CUDA、SYCL、向量化C++)集成到现有的MadEvent框架中,而无需修改其基于Fortran的外部外壳。
- 实现完整的LHC兼容事件生成,支持无权重样本,包括随机自旋态和色荷选择,适用于生产环境。
- 于2023年第二季度前发布首个加速框架的alpha版本,支持QCD LO过程,物理输出与原版完全一致,但计算成本大幅降低。
提出的方法
- 使用带有AVX512内在函数的向量化C++重实现矩阵元计算,在现代CPU上实现单精度理论SIMD加速比最高达x16,双精度最高达x8。
- 将ME计算移植到CUDA,用于NVIDIA GPU,实现100%分支效率和同步处理,以最大化GPU利用率。
- 使用SYCL和sycl::vec抽象实现可移植的ME内核,支持在异构架构(包括AMD和Intel GPU)上执行。
- 将新的数据并行ME内核集成到现有的MadEvent框架中,仅替换原有的标量Fortran ME模块,保留其余工作流不变。
- 优化MadEvent的串行组件(如随机数生成、去权重化、I/O),以缓解ME加速后的性能瓶颈。
- 引入混合精度模式,选择性地在ME计算中使用单精度和双精度,以在准确性和性能之间取得平衡。
![Figure 1: Total combined throughput for the $gg\!\rightarrow\!t\bar{t}gg$ process using 1, 2, 4 or 8 copies of our standalone application (see Ref. [ 1 ] ), as a function of the CUDA grid size (number of blocks per grid times number of threads per block — ”gt00256” indicates that the latter is fixed](https://ar5iv.labs.arxiv.org/html/2303.18244/assets/fig/bmkcuda.png)
实验结果
研究问题
- RQ1Madgraph5_aMC@NLO中的矩阵元计算能否通过CPU向量化和GPU卸载实现加速,同时保持物理精度和接口兼容性?
- RQ2在ME计算中,数据并行性和同步执行能达到何种程度?在现代向量CPU和GPU上可实现多大性能提升?
- RQ3像SYCL这样的性能可移植框架如何实现高性能ME内核在异构架构上的跨平台部署,且不损失效率?
- RQ4在GPU和向量CPU执行中,自旋态和色荷态的随机选择对同步处理和整体性能有何影响?
- RQ5在ME加速后,MadEvent框架中的关键性能瓶颈是什么?如何缓解这些瓶颈以实现可投入生产的alpha版本?
主要发现
- 在单个AVX512支持的CPU核心上,向量化C++实现可实现单精度最高x16、双精度最高x8的理论加速比。
- CUDA实现可在NVIDIA GPU上实现100%分支效率,支持接近理想的同步执行,显著优于标量Fortran实现。
- 基于SYCL的ME内核已完全集成到MadEvent中,并成功将ME计算卸载到AMD和Intel GPU上,实现了非NVIDIA硬件上的完整LHC兼容事件生成。
- CPU上的原型向量化SYCL实现性能与gcc编译的CUDA/C++构建相当或更优,可能归因于使用Intel icx编译器进行激进内联和向量化优化。
- 已成功完成事件级随机自旋态和色荷选择的集成——此前缺失的关键模块——现可实现完整无权重事件生成,且物理输出正确。
- 性能对比显示,icx编译的CUDA/C++内核在某些情况下性能优于gcc构建两倍以上,尤其在启用AVX512和激进内联时。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。