Exploring code portability solutions for HEP with a particle tracking test code

Hammad Ather, S. Berkman, G. B. Cerati, M. J. Kortelainen, K. H. M. Kwok, Steven Lantz, Seyong Lee, Boyana Norris, M. Reid, Allison Reinsvold Hall, Daniel Riley, Alexei Strelchenko, Cong Wang

Abstract

Traditionally, high energy physics (HEP) experiments have relied on x86 CPUs for the majority of their significant computing needs. As the field looks ahead to the next generation of experiments such as DUNE and the High-Luminosity LHC, the computing demands are expected to increase dramatically. To cope with this increase, it will be necessary to take advantage of all available computing resources, including GPUs from different vendors. A broad landscape of code portability tools -- including compiler pragma-based approaches, abstraction libraries, and other tools -- allow the same source code to run efficiently on multiple architectures. In this paper, we use a test code taken from a HEP tracking algorithm to compare the performance and experience of implementing different portability solutions.

Introduction

As High Energy Physics (HEP) enters the "exabyte era" with projects like the High-Luminosity LHC (HL-LHC), researchers are transitioning from a CPU-only status quo to heterogeneous computing environments. The primary challenge in this transition is "vendor lock-in." Writing code specifically for a single platform, such as NVIDIA’s CUDA, is highly efficient but prevents the code from running on other architectures like AMD-based or Intel-based supercomputers. Rewriting millions of lines of experiment code for every new architecture is unsustainable. This paper evaluates several "write-once, run-anywhere" portability layers, demonstrating their potential to achieve near-native performance while highlighting the complexities of manual optimization and memory management.

Methodology

The study utilizes two "mini-apps" derived from the mkFit project, which implements a highly optimized Kalman Filter for particle tracking:

  • p2z (Propagate to Z): Propagates track parameters to a specific longitudinal position (endcap layers).
  • p2r (Propagate to R): An iterative approach advancing tracks to a specific radius (barrel layers).

These benchmarks were implemented across a diverse set of portability technologies, ranging from abstraction libraries like Kokkos and Alpaka to language extensions like SYCL and directive-based approaches like OpenMP.

Software environment and compiler versions for the various portability layers and hardware backends.

The performance of these implementations was compared against "native" reference versions: TBB for CPUs, CUDA for NVIDIA GPUs, and HIP for AMD GPUs. To ensure a clean measurement of throughput (tracks per second) without the overhead of detector file I/O, the researchers used an artificial standalone input consisting of approximately 800,000 unique tracks generated by smearing a single "track seed" with a Gaussian distribution.

Key Insights: Optimization and Memory

A central finding of this research is that portability does not equate to automatic optimization. Achieving peak performance requires manual tuning of "launch parameters," such as block and thread sizes. Without this tuning, performance can drop by as much as 30%.

Furthermore, memory management proved to be the most significant bottleneck. The study utilized an AOSOA (Array-Of-Structures-Of-Arrays) data layout to maximize memory throughput.

The Array-of-Structures-of-Arrays (AOSOA) memory layout used in the mkFit mini-apps to optimize data access patterns.

Techniques such as memory prepinning, which allows for direct DMA transfers to the GPU, provided up to a 6x speedup. In contrast, the stdpar (C++ standard parallelism) approach, while easiest to implement, currently suffers from performance issues due to its reliance on "Unified Memory," which lacks the manual tuning capabilities necessary to minimize transfer overheads.

Results and Performance Comparison

The results indicate that modern portability layers are highly competitive:

  • NVIDIA GPUs: On V100 and A100 architectures, Alpaka, Kokkos, and OpenMP achieved 85% to 100% of native CUDA performance.
  • AMD GPUs: On the MI-100, Alpaka actually outperformed the native HIP implementation, while Kokkos remained within a factor of two.
  • x86 CPUs: Portability layers were highly effective, with Alpaka's p2z implementation even outperforming the native Intel TBB reference.
  • SYCL: While promising on Intel hardware, SYCL struggled on NVIDIA GPUs, reaching only ~10% of native performance in some tests, likely due to unexpected branching issues in the generated code.

Conclusion

While this study focuses on self-contained "mini-apps," the results are encouraging for the future of HEP computing. Portability layers like Alpaka and Kokkos can deliver near-native performance across multiple hardware vendors. However, the software ecosystem is still maturing, as evidenced by the sensitivity of directive-based tools to compiler choice and the experimental nature of support for certain GPUs. Future work will focus on integrating these solutions into large-scale frameworks like CMSSW and addressing the memory transfer bottlenecks inherent in current standard C++ parallelism implementations.

Summary updated

BibTeX
@inproceedings{ather2024exploring,
  author = {Hammad Ather and S. Berkman and G. B. Cerati and M. J. Kortelainen and K. H. M. Kwok and Steven Lantz and Seyong Lee and Boyana Norris and M. Reid and Allison Reinsvold Hall and Daniel Riley and Alexei Strelchenko and Cong Wang},
  title = {{Exploring code portability solutions for HEP with a particle tracking test code}},
  booktitle = {Frontiers in Big Data},
  year = {2024},
  doi = {10.3389/fdata.2024.1485344},
}
Figure