arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.06095cs.MS
收藏

一种面向HPC的C++扩展,通过内存导向规范减少内存占用并简化MPI开发

An extension of C++ with memory-centric specifications for HPC to reduce memory footprints and streamline MPI development

Durham University(杜伦大学)

Pawel K. Radtke, Cristian G. Barrera-Hinojosa, Mladen Ivkovic, Tobias Weinzierl

AI总结:

本文提出一种C++扩展,通过内存导向属性优化减少内存占用并简化MPI开发,结合LLVM实现并验证了性能与开发效率的提升。

摘要:

C++倾向于对结构体进行内存低效的存储:编译器会插入填充位,而无法利用整数、枚举或位集的范围知识。此外,该语言不支持任意精度的浮点数。我们提出了一种基于属性的语言扩展,使开发者能够指导编译器何种内存布局会更有利:多个布尔或整数(范围有限)是否能压缩到一个位字段中,浮点数是否能比IEEE标准少保留更多有效位,以及程序员是否愿意为更紧凑的对象表示而牺牲属性顺序保证?该扩展提供了回退到正常对齐和原生C++浮点数表示的机会,通过普通C++赋值实现,无需依赖外部库,生成的代码仍保持(语法上)标准C++。由于MPI仍然是C++分布式内存计算的事实标准,我们还提出了额外的属性,以结合我们的内存优化扩展简化MPI数据类型建模。我们的工作在LLVM中实现了语言注释,并通过平滑粒子流体动力学基准测试展示了其潜在影响。这些结果揭示了在性能和开发生产力方面的潜在收益。

英文摘要:

C++ leans towards a memory-inefficient storage of structs: The compiler inserts padding bits, while it is not able to exploit knowledge about the range of integers, enums or bitsets. Furthermore, the language provides no support for arbitrary floating-point precisions. We propose a language extension based upon attributes through which developers can guide the compiler what memory arrangements would be beneficial: Can multiple booleans or integers with limited range be squeezed into one bit field, do floating-point numbers hold fewer significant bits than in the IEEE standard, and is a programmer willing to trade attribute ordering guarantees for a more compact object representation? The extension offers the opportunity to fall back to normal alignment and native C++ floating point representations via plain C++ assignments, no dependencies upon external libraries are introduced, and the resulting code remains (syntactically) standard C++. As MPI remains the de-facto standard for distributed memory calculations in C++, we furthermore propose additional attributes which streamline the MPI datatype modelling in combination with our memory optimisation extensions. Our work implements the language annotations within LLVM and demonstrates their potential impact through smoothed particle hydrodynamics benchmarks. They uncover the potential gains in terms of performance and development productivity.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑