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

Pawel K. Radtke, Cristian G. Barrera-Hinojosa, Mladen Ivkovic, Tobias Weinzierl
{"title":"An extension of C++ with memory-centric specifications for HPC to reduce memory footprints and streamline MPI development","authors":"Pawel K. Radtke, Cristian G. Barrera-Hinojosa, Mladen Ivkovic, Tobias Weinzierl","doi":"arxiv-2406.06095","DOIUrl":null,"url":null,"abstract":"The C++ programming language and its cousins lean towards a\nmemory-inefficient storage of structs: The compiler inserts helper bits into\nthe struct such that individual attributes align with bytes, and it adds\nadditional bytes aligning attributes with cache lines, while it is not able to\nexploit knowledge about the range of integers, enums or bitsets to bring the\nmemory footprint down. Furthermore, the language provides neither support for\ndata exchange via MPI nor for arbitrary floating-point precision formats. If\ndevelopers need to have a low memory footprint and MPI datatypes over structs\nwhich exchange only minimal data, they have to manipulate the data and to write\nMPI datatypes manually. We propose a C++ language extension based upon C++\nattributes through which developers can guide the compiler what memory\narrangements would be beneficial: Can multiple booleans be squeezed into one\nbit field, do floats hold fewer significant bits than in the IEEE standard, or\ndoes the code require a user-defined MPI datatype for certain subsets of\nattributes? The extension offers the opportunity to fall back to normal\nalignment and padding rules via plain C++ assignments, no dependencies upon\nexternal libraries are introduced, and the resulting code remains standard C++.\nOur work implements the language annotations within LLVM and demonstrates their\npotential impact, both upon the runtime and the memory footprint, through\nsmoothed particle hydrodynamics (SPH) benchmarks. They uncover the potential\ngains in terms of performance and development productivity.","PeriodicalId":501256,"journal":{"name":"arXiv - CS - Mathematical Software","volume":"233 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-06-10","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Mathematical Software","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2406.06095","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

The C++ programming language and its cousins lean towards a memory-inefficient storage of structs: The compiler inserts helper bits into the struct such that individual attributes align with bytes, and it adds additional bytes aligning attributes with cache lines, while it is not able to exploit knowledge about the range of integers, enums or bitsets to bring the memory footprint down. Furthermore, the language provides neither support for data exchange via MPI nor for arbitrary floating-point precision formats. If developers need to have a low memory footprint and MPI datatypes over structs which exchange only minimal data, they have to manipulate the data and to write MPI datatypes manually. We propose a C++ language extension based upon C++ attributes through which developers can guide the compiler what memory arrangements would be beneficial: Can multiple booleans be squeezed into one bit field, do floats hold fewer significant bits than in the IEEE standard, or does the code require a user-defined MPI datatype for certain subsets of attributes? The extension offers the opportunity to fall back to normal alignment and padding rules via plain C++ assignments, no dependencies upon external libraries are introduced, and the resulting code remains standard C++. Our work implements the language annotations within LLVM and demonstrates their potential impact, both upon the runtime and the memory footprint, through smoothed particle hydrodynamics (SPH) benchmarks. They uncover the potential gains in terms of performance and development productivity.
C++ 扩展了以内存为中心的 HPC 规范,以减少内存占用并简化 MPI 开发
C++ 编程语言及其同类语言倾向于低内存效率的结构体存储:编译器会在结构体中插入辅助位,使单个属性与字节对齐,并添加额外的字节使属性与缓存行对齐,而无法利用整数、枚举或比特集的范围知识来减少内存占用。此外,该语言既不支持通过 MPI 进行数据交换,也不支持任意浮点精度格式。如果开发人员需要在只交换极少量数据的结构体上使用低内存占用和 MPI 数据类型,就必须手动操作数据和编写 MPI 数据类型。我们提出了一种基于 C++ 属性的 C++ 语言扩展,开发人员可以通过它指导编译器如何安排内存:是否可以将多个布尔值挤入一个比特字段,浮点数是否比 IEEE 标准中的有效位数更少,代码是否需要为某些属性子集提供用户定义的 MPI 数据类型?我们的工作在 LLVM 中实现了语言注释,并通过平滑粒子流体力学(SPH)基准测试证明了语言注释对运行时间和内存占用的潜在影响。我们的工作在 LLVM 中实现了语言注解,并通过平滑粒子流体力学(SPH)基准测试证明了其对运行时间和内存占用的潜在影响。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信