Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding executor parallel invoke CPOs #6311

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Adding executor parallel invoke CPOs #6311

merged 1 commit into from
Jul 28, 2023

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented Jul 26, 2023

This adds new CPOs: sync_invoke and async_invoke. It also adds an implementation for the fork_join_executor and block_fork_join_executor as well as fallback implementations for all executors not supporting these. The APIs are:

namespace hpx::parallel::execution {

    template <typename Executor, typename F, typename... Fs,
        HPX_CONCEPT_REQUIRES_(
            std::is_invocable_v<F> && (std::is_invocable_v<Fs> && ...)
        )>
    void sync_invoke(Executor&& exec, F&& f, Fs&&... fs);

    template <typename Executor, typename F, typename... Fs,
        HPX_CONCEPT_REQUIRES_(
            std::is_invocable_v<F> && (std::is_invocable_v<Fs> && ...)
        )>
    decltype(auto) async_invoke(Executor&& exec, F&& f, Fs&&... fs);
}

For executors supporting the CPOs this will concurrently launch the given functions and will either wait for them to complete or return a completion token (e.g., a hpx::future) representing the completion of the function invocations.

@hkaiser hkaiser added this to the 1.10.0 milestone Jul 26, 2023
@hkaiser hkaiser force-pushed the parallel_invoke_cpo branch 3 times, most recently from 13a6d06 to 7d1310a Compare July 27, 2023 15:13
@hkaiser hkaiser changed the title Adding executor parallel_invoke CPO Adding executor parallel invoke CPOs Jul 27, 2023
@hkaiser
Copy link
Member Author

hkaiser commented Jul 27, 2023

bors merge

bors bot pushed a commit that referenced this pull request Jul 27, 2023
6311: Adding executor parallel invoke CPOs r=hkaiser a=hkaiser

This adds new CPOs: `sync_invoke` and `async_invoke`. It also adds an implementation for the `fork_join_executor` and `block_fork_join_executor` as well as fallback implementations for all executors not supporting these. The APIs are:
```
namespace hpx::parallel::execution {

    template <typename Executor, typename F, typename... Fs,
        HPX_CONCEPT_REQUIRES_(
            std::is_invocable_v<F> && (std::is_invocable_v<Fs> && ...)
        )>
    void sync_invoke(Executor&& exec, F&& f, Fs&&... fs);

    template <typename Executor, typename F, typename... Fs,
        HPX_CONCEPT_REQUIRES_(
            std::is_invocable_v<F> && (std::is_invocable_v<Fs> && ...)
        )>
    decltype(auto) async_invoke(Executor&& exec, F&& f, Fs&&... fs);
}
```
For executors supporting the CPOs this will concurrently launch the given functions and will either wait for them to complete or return a completion token (e.g., a `hpx::future`) representing the completion of the function invocations.


Co-authored-by: Hartmut Kaiser <[email protected]>
@bors
Copy link

bors bot commented Jul 27, 2023

This PR was included in a batch that successfully built, but then failed to merge into master (it was a non-fast-forward update). It will be automatically retried.

@bors
Copy link

bors bot commented Jul 28, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit dd17010 into master Jul 28, 2023
15 of 17 checks passed
@bors bors bot deleted the parallel_invoke_cpo branch July 28, 2023 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant