-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable fork_join_executor to handle return values from scheduled func…
…tions
- Loading branch information
Showing
4 changed files
with
314 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
libs/core/executors/tests/regressions/fork_join_with_result.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2023 Giannis Gonidelis | ||
// | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <hpx/algorithm.hpp> | ||
#include <hpx/execution.hpp> | ||
#include <hpx/init.hpp> | ||
#include <hpx/modules/testing.hpp> | ||
|
||
#include <functional> | ||
|
||
int hpx_main() | ||
{ | ||
hpx::execution::experimental::fork_join_executor exec{}; | ||
|
||
auto const result = hpx::transform_reduce(hpx::execution::par.on(exec), | ||
hpx::util::counting_iterator(0), hpx::util::counting_iterator(100), 0L, | ||
std::plus{}, [&](auto i) { return i * i; }); | ||
|
||
HPX_TEST_EQ(result, 328350L); | ||
|
||
return hpx::local::finalize(); | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
HPX_TEST_EQ_MSG(hpx::local::init(hpx_main, argc, argv), 0, | ||
"HPX main exited with non-zero status"); | ||
|
||
return hpx::util::report_errors(); | ||
} |
Oops, something went wrong.