GSoC @ HPX, STE||AR Group
- GSoC Project Acceptance Page
- Project Title: Coroutine-like interface
Mentors (STE||AR Group @ LSU)
- Dr. Hartmut Kaiser, Adjunct Professor @ LSU
- Giannis Gonidelis, RA @ LSU
HPX being up to date with Std C++ Proposals, Senders/Receivers were implemented as per P2300. But they have been missing coroutine (co_await) integration and minor functionalities as described in P2300 which is likely to be accepted. Hence I plan to implement these functionalities within the Core HPX Library.
- Coroutines introduce better async code. For example, it is more readable, local variables have the same lifespan as the coroutine which means we don’t need to worry about allocation/release.
- S/R algorithms can work with coroutines which they cannot as of now unless relied on futures which as mentioned are single-time use.
- Adding co_await support makes the code more structured with respect to concurrency which can also be done by library abstractions of callbacks but using co_await may make it more optimized.
Senders, and Receivers
- Because it makes a more consistent programming model considering async programming types i.e. Parallelism and Concurrency. It standardizes the terminologies and execution policies which are more generic and reduce redundancy.
- Coroutines have a direct connection between Senders and Coroutine Awaitables.
- One of the points of S/R is to avoid the allocations associated with futures, also, futures are single-use, whereas S/R, in general, can be used (started) multiple times. - Dr. H. Kaiser
Goal is to enable all Sender CPOs to do the following:
- If we write a sender and pass it to a function which could be a coroutine that could co_await that sender and get its result.
- If they are not generally awaitable then we can await transform them (i.e. make them awaitable).
My PRs can be found using this link as it'll always be updated.
Following are the Merged PRs until now:
- [execution] Add schedule_result_t alias template
- [hpx::execution] Added forwarding_scheduler_query
- [P2300] enhancements: receiver_of, sender_of improvements
- [P2300] Added fundamental coroutine_traits for S/R
With coroutine traits completed, my remaining work is the following:
get_completion_signatureswhen Sender is a awaitable
- to transform an object into one that is awaitable within a particular coroutine.
- promise base for 5.
- operation base for 5.
connectmentioned in spec 2.2
- Used as the base class of a coroutine promise type, makes senders awaitable in that coroutine type