Software Engineering
Two-year RSE initiative uncovers hidden defects in quantum transport code
Rigorous software engineering practices applied to libNEGF revealed memory errors and an overlooked flaw in the mathematical model underlying boundary condition handling.
A two-year research software engineering (RSE) effort on libNEGF, a Fortran-based quantum transport code, has surfaced a trove of critical defects and performance issues that had gone undetected under less systematic development practices.
Quality Assurance and Hidden Bugs#
The team employed structured code quality approaches—continuous integration, automated testing, and compiler warning remediation—which uncovered serious flaws. These included uninitialized memory reads, out-of-bounds writes, and a significant mathematical error in how boundary conditions were modeled. These defects belong to a class of problems typically associated with undefined behavior in C/C++ and processor-dependent behavior in Fortran—suggesting such issues are widespread across scientific software, not limited to any single language.
Performance Monitoring Reveals Regressions#
Beyond correctness, continuous benchmarking proved invaluable for catching performance regressions linked to changes in HPC system configuration. By regularly measuring code performance, the team identified slowdowns that might otherwise have gone unnoticed.
Broader Implications for Scientific Computing#
The findings underscore that disciplined software engineering practices—code review, automation, and monitoring—yield measurable benefits in scientific computing. While the libNEGF case study uses Fortran, the lessons apply broadly across implementation languages and can be adopted selectively in both greenfield and legacy projects.