cd /news/artificial-intelligence/bit-reproducibilty-on-gpu-accelerate… · home topics artificial-intelligence article
[ARTICLE · art-76860] src=fortran-lang.discourse.group ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Bit-reproducibilty on GPU-accelerated Fortran

A developer achieved bit-reproducibility between CPU and GPU calculations for transcendental functions in Fortran by wrapping the bitrep C++ library and adding OpenACC/OpenMP directives, with a performance penalty of approximately 3-4× slowdown compared to standard math libraries. The work, tested on NVIDIA and AMD GPUs, is available on GitHub and has been independently verified by another developer porting a weather model using the NVIDIA HPC SDK and Flang.

read1 min views1 publishedJul 28, 2026
Bit-reproducibilty on GPU-accelerated Fortran
Image: Fortran-Lang (auto-discovered)

While working on an OpenACC GPU port of a CFD solver with OpenACC, I wanted to maintain bit-reproducibility between existing CPU calculations and GPU-accelerated kernels — particularly for mathematical transcendental functions (sin , cos

, exp

, etc.).

I tested the bitwise-reproducible algorithms from Arteaga et al. (2014). By wrapping the original bitrep C++ source with a Fortran interface and adding OpenACC/OpenMP directives (plus disabling compilers fused multiply-add optimizations) I achieved reproducibility between CPU and GPU in pure transcendental kernels.

Here a few note:

  • Bit-reproducible results have been tested on several architectures of NVIDIA and AMD GPUs.
  • Performance penalty ~3-4× slowdown compared to standard math libraries
  • Equivalent performance on OpenACC/OpenMP with NVHPC SDK compiler (as expected)
  • Haven’t yet tested directly in CUDA/HIP kernels to determine if the performance loss could be reduced by removing the OpenACC/OpenMP overhead

The GPU Fortran interface and the tests I used are available on: GitHub - loicreynier/bitrep: Bit-reproducible CPU/GPU math transcendental functions with Fortran interface · GitHub

I’m curious if anyone has explored similar of different approaches for achieving bit-reproducibility in GPU or even CPU codes?

2 Likes

MetMan 2 Hi, LoicReynier.

I’m also porting a weather model to a GPU platform project, using the bitrep library to achieve bitwise reproducibility verification across CPU and GPU platforms. Tests passed with the NVIDIA HPC SDK (CPU vs GPU) and with Flang (Sugon CPU vs GPU). My bitrep github repo: qingu/bitrep: reproducible CPU/GPU transcendental functions with Fortran interface

Have you tested bitwise reproducibility across different compilers on the CPU platform?

CPU IEEE float and GPU IEEE float are different, so a cross-backend mismatch is actually expected. A good way to (kinda) fight it is through same-backend regression and analysis instead.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @nvidia 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/bit-reproducibilty-o…] indexed:0 read:1min 2026-07-28 ·