For decades, scientific computing relied on a stable foundation: the x86 CPU. Optimization was a matter of mastering a single instruction set. Today, that foundation has fractured into a "heterogeneous" landscape of NVIDIA, AMD, and Intel GPUs, alongside FPGAs, TPUs, and specialized Data Processing Units (DPUs).
As Meghna Bhattacharya and colleagues at the HEP Center for Computational Excellence note, the "write once, run anywhere" dream has shifted from a luxury to a necessity Portability: A Necessary Approach for Future Scientific Software. The challenge is no longer just achieving high performance, but achieving performance portability: the ability for a single codebase to run efficiently across these disparate architectures without manual, vendor-specific rewrites.
The Three-Layer Separation
The core mechanism enabling this portability is a rigorous decoupling of what a program does from how it is executed. Victor Adrian Prisacariu and the team behind InfiniTAM demonstrate this through a three-layer architecture A Framework for the Volumetric Integration of Depth Images:
- Generic Interfaces: High-level logic that describes the algorithm (e.g., 3D reconstruction).
- Device-Specific Execution: Thin wrappers that handle hardware-specific memory management and parallel dispatch.
- Device-Agnostic Functions: The mathematical "kernels" that perform the actual computation, written in a subset of C++ compatible with all backends.
By isolating the per-pixel logic from the hardware-specific "plumbing," researchers can target new chips by only updating the middle layer. This same philosophy underpins Apple’s AXLearn AXLearn: Modular Large Model Training on Heterogeneous Infrastructure, where Mark Lee and others decouple model logic from parallelism strategies using abstract mesh rules, allowing the same model to scale across GPUs and TPUs.
Abstracting the Instruction Set
At a lower level, portability is achieved by abstracting the hardware's physical characteristics, such as register widths. Traditional SIMD (Single Instruction, Multiple Data) programming often assumes a fixed vector length, which breaks when moving between different processors.
Adrián Castelló proposes using hardware-independent macros for core operations like fused multiply-add Micro-kernels for portable and efficient matrix multiplication in deep learning. Similarly, Han Liutong and colleagues redesigned OpenCV’s abstraction layer to support variable-length vectors, allowing the same code to utilize the full bit-width of any RISC-V implementation Optimization Method for High-performance Libraries Targeting RISC-V Vector Extension.
Unified Programming Models
Rather than writing in proprietary languages like CUDA, researchers are increasingly adopting unified standards:
- SYCL and OpenMP: Meifeng Lin evaluated these as "write-once" solutions for physics simulations, finding they can reach within 20% of native performance Portable Programming Model Exploration for LArTPC Simulation in a Heterogeneous Computing Environment.
- ISO C++: Giulio Malenza showed that standard C++ parallel algorithms can accelerate industry-standard tools like OpenFOAM on GPUs without any vendor-specific extensions Building an Accelerated OpenFOAM Proof-of-Concept Application using Modern C++.
- WebGPU: For browser-based AI, Charlie F. Ruan uses WebGPU as a standardized graphics API to provide hardware-agnostic acceleration for LLMs across diverse consumer devices WebLLM: A High-Performance In-Browser LLM Inference Engine.
Testing Portability with Mini-Apps
Because full scientific software stacks are often too complex to port quickly, the community has turned to workflow mini-apps. Ozgur O. Kilic and Shantenu Jha describe these as lightweight emulators that mimic the performance behavior of massive pipelines Workflow Mini-Apps: Portable, Scalable, Tunable & Faithful Representations of Scientific Workflows. These mini-apps allow researchers to test how a portability layer will behave on a new supercomputer in a fraction of the time it would take to port the original "dependency-heavy" software.
Why It Works
Performance portability works because most high-performance algorithms share a common syntactic subset. By targeting this subset—whether through C++ template metaprogramming as in Tapas Tapas: An Implicitly Parallel Programming Framework for Hierarchical N-Body Algorithms or through multiple dispatch in Julia AdvancedHMC.jl: A robust, modular and efficient implementation of advanced HMC algorithms—developers can write the "math" once. The underlying framework then maps that math to the specific "primitives" (like those in cuDNN cuDNN: Efficient Primitives for Deep Learning) that each hardware vendor has already optimized.
As the ISC High Performance 2023 proceedings highlight, this shift toward abstraction is the only way to survive the "Exascale Era," ensuring that scientific progress is no longer tethered to the lifecycle of a single hardware vendor.