Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <hpx/hpx.hpp>
- #include <hpx/dataflow.hpp>
- #include <hpx/parallel/executors/thread_pool_executors.hpp>
- #include <iostream>
- using hpx::threads::executors::local_priority_queue_executor;
- using hpx::shared_future;
- using hpx::dataflow;
- using hpx::async;
- using hpx::util::unwrapping;
- int add(int a, int b) {
- return a+b;
- }
- int hpx_main()
- {
- {
- local_priority_queue_executor exec;
- shared_future<int> f1 = async(exec, add, 2, 3);
- shared_future<int> f2 = async(exec, add, 4, 5);
- shared_future<int> f3 = dataflow(exec, unwrapping(add), f1, f2);
- std::cout << f3.get() << std::endl;
- }
- return hpx::finalize();
- }
- int main(int argc, char ** argv)
- {
- return hpx::init(argc, argv);
- }
Add Comment
Please, Sign In to add comment