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++中的现代并行编程方法,描述了语言和库特性,并提供了使用它们的具体示例。