ORB5X v1.0: a performance-portable global electromagnetic gyrokinetic PIC code in C++/Kokkos built using Agentic AI
This paper introduces ORB5X v1.0, a performance-portable C++/Kokkos implementation of the ORB5 global electromagnetic gyrokinetic PIC code developed via Agentic AI, which preserves the original Fortran code's mathematical models and algorithms while achieving machine-accuracy agreement and enabling seamless execution across diverse CPU and GPU architectures.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Great Fusion Hunt and the Language Barrier
Imagine trying to build a star right here on Earth. That is the dream of nuclear fusion, the process that powers the sun, promising clean, limitless energy. To make this happen, scientists trap super-hot plasma—a swirling soup of charged particles—in magnetic cages called tokamaks. But this plasma is chaotic; it's like trying to predict the path of a billion tiny, hyperactive bees that constantly bump into each other and change direction. To understand how to keep this plasma stable and hot enough to fuse, scientists use massive computer simulations. These simulations act as virtual laboratories, tracking how particles move and how electromagnetic fields twist and turn.
One of the most trusted tools for this job is a code called ORB5. Think of ORB5 as a highly skilled, old-school master chef who has been cooking the same perfect fusion recipe for decades. However, this chef speaks only one language: Fortran, a programming language invented in the 1950s. While Fortran is great for the math, it's becoming a bit like a vintage car: hard to fix, hard to upgrade, and difficult to drive on modern roads (like the newest, fastest supercomputers with powerful graphics cards). As the world of computing shifts toward new hardware, keeping this "vintage car" running efficiently is becoming a struggle. The question isn't whether the recipe is good—it is—but how do we translate that recipe into a modern language so it can run on today's fastest engines without changing the taste of the dish?
The Translation Project: ORB5X
This paper introduces ORB5X, a bold new version of that famous fusion code. The team didn't try to invent a new recipe or change the physics of the plasma. Instead, they acted as master translators. They took the original Fortran code and, with the help of "Agentic AI" (smart computer assistants that write and debug code), rewrote the entire program in C++, a modern programming language.
Why does this matter? Imagine you have a brilliant blueprint for a house, but it's drawn on a piece of paper that is fading and only fits on a specific type of drafting table. ORB5X is like redrawing that exact same blueprint on a digital tablet that works on any computer, any tablet, or even a supercomputer in space. The goal was to preserve the "mathematical soul" of the original code while making it "performance-portable." This means the new code can run just as well on a standard laptop, a powerful desktop, or a massive supercomputer with thousands of graphics cards, without needing a complete rewrite for each machine.
How They Did It: The AI Co-Pilot
The translation wasn't just a simple copy-paste job; it was a careful, step-by-step reconstruction. The researchers used a workflow where human experts and AI agents worked together. The AI acted like a tireless co-pilot: it looked at a chunk of the old Fortran code, suggested how to write it in modern C++, and flagged potential traps where the math might go wrong. The human scientists then reviewed every suggestion, ensuring the new code behaved exactly like the old one.
They kept the two versions side-by-side, like a bilingual dictionary. If the old code had a file named fields.F90, the new one had fields.cpp. This allowed them to check every single calculation. They used a modern toolkit called Kokkos, which acts like a universal adapter. It lets the code talk to different types of computer processors (like Intel CPUs or NVIDIA GPUs) automatically, without the programmer having to write separate instructions for each one.
The Results: Machine Accuracy
The team put ORB5X through its paces using three famous "stress tests" that simulate different types of plasma turbulence:
- ITG (Ion Temperature Gradient): Simulating how heat moves through the plasma.
- ITPA: A complex test involving fast-moving particles and magnetic waves.
- Chirping: Watching how the frequency of waves changes as they interact with energetic particles.
The results were stunning. When they compared the output of the new C++ code against the original Fortran code, the numbers matched with machine accuracy. This means the difference between the two was so tiny it was essentially zero, limited only by the precision of the computer's math. Whether they ran the simulation on a personal laptop or a massive supercomputer like LUMI or CINECA, the physics remained identical.
Why This is a Big Deal
The paper confirms that ORB5X is a success, but it also sets realistic expectations. The new code is not necessarily faster than the original Fortran version on every single machine yet; in fact, the original code is still slightly faster in some cases because it has been fine-tuned over decades. However, the real victory is portability. The original Fortran code is becoming a "legacy" system that is hard to run on new hardware. ORB5X, built with modern tools, can be compiled and run easily on personal laptops (even Macs with Apple M4 chips) and the world's most advanced supercomputers.
The authors are careful to note that this is version 1.0. It is a solid foundation, not a finished product. They plan to make it even faster in the future by reducing the time it takes to move data between the computer's memory and its processor, and they hope to eventually use it to simulate even more complex shapes of magnetic cages (like stellarators). But for now, they have successfully proven that you can take a decades-old, highly complex scientific code, translate it into a modern language with the help of AI, and keep the physics perfectly intact. It's a bridge built between the past and the future of fusion research, ensuring that the quest for clean energy can keep running on the fastest engines the world has to offer.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.