Fortran语言
计算机科学
可维护性
软件
软件工程
最佳实践
工作流程
抽象
仿形(计算机编程)
超级计算机
软件开发
程序设计语言
中央处理器
编码(集合论)
计算科学
软件系统
作者
Seth Dale,Sander Schott,Carolyn Koh,Dinesh P. Mehta
摘要
ABSTRACT Objective Over the past few decades, C++ has seen the continual introduction of new means of abstraction, data transformation, and optimization. These improvements offer a host of benefits to scientific software development, which overwhelmingly favors the language for high‐performance codes. Despite this, the adoption rate of modern C++ remains low in the computational science community due to the large body of literature predating its evolution and an absence of updated guidance. Moreover, the existing case studies on converting older Fortran codes to C++ are outdated in their discussions of abstraction costs, data structures, and performance. In this work, we provide an overview of modern C++ features and best practices relevant to the development of maintainable and performant scientific codes. Methods We ground this discussion via a case study in modernizing CSMGem, a commercial gas hydrate thermodynamics software developed by an academic research team at the Colorado School of Mines, from procedural Fortran 90 to object‐oriented C++23. A unit of measurement library, CSMUnits, was developed and used together with template constraints, smart pointers, compile‐time evaluations, and other modern C++ methods. Results The resulting code base is modular, readable, and maintainable to facilitate future enhancements. Profiling indicates a 12.3% decrease in CPU time and a 20.1% reduction in peak memory usage after the re‐engineering process. Conclusions The presented modern C++ features were successfully applied to re‐engineer a procedural Fortran code. Improvements to readability, modularity, and maintainability were realized simultaneously with decreased CPU and memory costs. These findings demonstrate the value of modern C++ adoption in computational science and the need for updated guidance.
科研通智能强力驱动
Strongly Powered by AbleSci AI