For us, HPX is a ‘A general purpose C++ runtime system for parallel and distributed applications of any scale’. While this is quite a mouthful, we mean every word of it. All of the recently published posts on this site so far have focused on the APIs HPX exposes for purely local operation on a single machine. In this installment I would like to start talking about how HPX exposes distributed functionality, i.e. how to use HPX to write truly distributed applications. As we will see, by introducing just minor extensions to the C++ standard the user is able to write homogeneous code without having to pay attention to any differences between invoking functionality locally (on the current node) or remotely (on any other node in a cluster).
Articles from June 2015
HPX and C++ Parallel Algorithms
In Lenexa (May 2015), the C++ standardization committee has finalized the work related to the Technical Specification for C++ Extensions for Parallelism (the latest document at the time of this writing is N4507) . This document describes parallel algorithms which will extend and complement the (sequential) standard library algorithms we all love and use for over a decade now. This is an important – albeit only first – step towards standardizing higher level abstractions for parallelism and concurrency in C++.
HPX and C++ Dataflow
The C++11 standard library introducedstd::async
as a convenient means of asynchronously executing a function on a new thread and returning an instance of astd::future
representing the eventual result produced by that function. In HPX, thehpx::async
API is one of the most basic parallelization facilities exposed to the user. Here is a simple example of how it can be used:
HPX and C++ Task Blocks
The quest for finding efficient, convenient, and widely usable higher level parallelization constructs in C++ is continuing. With the standardization document N4411, a group of authors from Intel and Microsoft propose thetask_block
facility which formalizes fork-join parallelism. From the paper (slightly edited):