Parallel programming remains a daunting challenge, from the struggle to express a parallel algorithm without cluttering the underlying synchronous logic, to describing which devices to employ in a calculation, to correctness. Over the years, numerous solutions have arisen, many of them requiring new programming languages, extensions to programming languages, or the addition of pragmas. Support for these various tools and extensions is available to a varying degree. In recent years, the C++ standards committee has worked to refine the language features and libraries needed to support parallel programming on a single computational node. Eventually, all major vendors and compilers will provide robust and performant implementations of these standards. Until then, the HPX library and runtime provides cutting edge implementations of the standards, as well as proposed standards and extensions. Because of these advances, it is now possible to write high performance parallel code without custom extensions to C++. We provide an overview of modern parallel programming in C++, describing the language and library features, and providing brief examples of how to use them.
翻译:并行编程仍然是一项艰巨的挑战,从如何在不扰乱底层同步逻辑的前提下表达并行算法,到描述计算中应使用哪些设备,再到正确性问题。多年来,出现了众多解决方案,其中许多需要新的编程语言、对编程语言的扩展或添加编译指示。这些工具和扩展的支持程度各不相同。近年来,C++标准委员会致力于完善支持单个计算节点上并行编程所需的语言特性与库。最终,所有主流厂商和编译器都将提供这些标准的高效稳健实现。在此之前,HPX库与运行时系统提供了这些标准(以及拟议标准和扩展)的前沿实现。基于这些进展,现在无需对C++进行自定义扩展即可编写高性能并行代码。本文概述了C++中的现代并行编程,介绍了相关语言与库特性,并提供了简要的使用示例。