r/cpp • • 24d ago

HPX V2.0.0 released: C++20 baseline, C++20 modules, stdexec-based senders/receivers, early C++26 reflection! - The HPX Project

HPX, the C++ Standard Library for Parallelism and Concurrency, has released V2.0.0. It is the largest release in a long time: more than 830 merged pull requests from more than 90 contributors since V1.11.0.

HPX implements the C++23 Standard parallelism and concurrency facilities in full and offers the only widely available open-source implementation of C++17, C++20, and C++23 parallel algorithms - including a complete set of parallel range-based algorithms and the full integration of the algorithms with the upcoming sender and receivers interfaces.

Beyond the standard, HPX includes proposed features for upcoming C++ releases: much of the parallelism and concurrency capabilities expected in C++26, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, senders and receivers, and more. It also extends C++ Standard APIs to distributed environments (such as compute clusters) and heterogeneous systems (such as GPUs).

Some of the changes that may interest r/cpp:

  • C++20 is now the minimum, and the whole library can optionally be built and consumed as C++20 modules.
  • Our own std::execution implementation is gone; senders and receivers are now based on stdexec, and a P2079 parallel scheduler runs sender work on HPX thread pools.
  • Early use of C++26 reflection: types can be serialized without writing serialize() functions, and remote actions and components no longer need registration macros.
  • New C++23 parallel algorithms (the fold family, find_last, iota) and many conformance fixes in the existing ones.
  • Functions can carry a task size (nano_task, small_task, ...), which the parallel algorithms use to decide how to split a loop.

HPX enables an asynchronous C++ programming model that improves parallel efficiency and reduces the complexity typically associated with concurrent applications. As a newly welcomed project of the High Performance Software Foundation, HPX now benefits from vendor-neutral governance and collaboration with a broader ecosystem of high-performance computing tools, strengthening the foundation for portable, production-ready HPC software across the industry.

Release: https://github.com/TheHPXProject/hpx/releases/tag/v2.0.0 
What's new: https://docs.hpx.dev/latest/html/releases/whats_new_2_0_0.html

57 Upvotes

2 comments sorted by

4

u/ArgonLeviathan 24d ago

congrats on shipping 2.0.0! seeing hpx::async<^^fibonacci>(locality_id, n - 1) in examples/quickstart/fibonacci_reflection.cpp completely replace HPX_PLAIN_ACTION and the registration macros is wild, and the task_size_chunk_size heuristic in libs/core/execution/include/hpx/execution/executors/task_size_chunk_size.hpp (dropping down to a single chunk on the calling thread when the loop doesn't clear the 2.5 us min chunk floor across 8 chunks per core) is such a practical way to avoid tiny loop spawn overhead without runtime measurement passes.

i was reading through the p2079 parallel_scheduler implementation in libs/core/executors/include/hpx/executors/parallel_scheduler.hpp and noticed how parallel_bulk_dispatch_sender::connect currently heap allocates fast_parallel_bulk_op via std::make_unique behind unique_ptr to base_parallel_bulk_op so transform_sender can return one concrete sender type while still supporting runtime backend replacement via set_parallel_scheduler_backend. since both FastSender and VirtualSender types are known statically inside dispatch_op, holding a std::variant of fast_parallel_bulk_op and virtual_parallel_bulk_op inline inside dispatch_op instead of unique_ptr to base_parallel_bulk_op would make the default hpx bulk fast path completely zero-allocation while keeping runtime replaceability intact. also in hpx_parallel_scheduler_backend::schedule_bulk_chunked in parallel_scheduler.cpp, checking proxy.stop_requested() before calling proxy.execute(begin, end) would let p3804 stop tokens short-circuit queued chunks early.

also in libs/core/serialization/include/hpx/serialization/detail/refl_serialize_impl.hpp, refl_serialize branches on std::meta::is_public(member) and falls back to std::meta::offset_of and at_offset for private members, with the bitfield static_assert(offset_info.bits == 0) only inside the private else branch. in p2996, once std::meta::nonstatic_data_members_of is called with access_context::unchecked(), splicing t.[:member:] already bypasses access control for private members directly without needing manual byte offsets, and checking std::meta::is_bit_field(member) up front will catch public bitfields cleanly too before trying to bind a reference.