Skip to content

Commit 9f4d518

Browse files
fix: resolve circular deps, header test, and inspect CI failures
- local.hpp: use only source-tree headers (hpx/execution.hpp, hpx/numeric.hpp) instead of generated .hpp.in headers (algorithm.hpp, future.hpp) - local.hpp: remove all hpx_main.hpp references from comments - local_header.cpp: use hpx::local::init instead of hpx_main.hpp wrapping - tests/unit/CMakeLists.txt: remove HPX::wrap_main dependency Refs: #7070 Signed-off-by: shivansh023023 <singhshivansh023@gmail.com>
1 parent 78f7b9b commit 9f4d518

4 files changed

Lines changed: 20 additions & 27 deletions

File tree

libs/core/config/include/hpx/config/static_linker_check.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
defined(HPX_HAVE_STATIC_LINKING) && \
2525
!defined(HPX_HAVE_WRAP_MAIN_CONFIGURED)
2626
// clang-format off
27-
#warning "HPX: Static Linux build detected. The linker requires '-Wl,-wrap=main' to properly intercept main(). If you are linking manually, add this flag to your linker command. Define 'HPX_HAVE_WRAP_MAIN_CONFIGURED' to suppress this warning."
27+
#warning \
28+
"HPX: -Wl,-wrap=main not detected. " \
29+
"Link via HPX::wrap_main or add flag manually."
2830
// clang-format on
2931
#endif

libs/core/include_local/include/hpx/local.hpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,20 @@
77
/// \file hpx/local.hpp
88
/// \brief Single-include convenience header for single-node HPX usage.
99
///
10-
/// This header bundles the **Standard Parallel Toolkit** the most commonly
10+
/// This header bundles the **Standard Parallel Toolkit** -- the most commonly
1111
/// used HPX facilities for local (single-node) execution:
1212
///
13-
/// - \c hpx/algorithm.hpp — Parallel STL algorithms (for_each, sort, ...)
14-
/// - \c hpx/execution.hpp — Execution policies (par, par_unseq, seq)
15-
/// - \c hpx/future.hpp — Async primitives (hpx::async, hpx::future)
16-
/// - \c hpx/numeric.hpp — Parallel numeric algorithms (reduce, ...)
13+
/// - \c hpx/execution.hpp -- Execution policies (par, par_unseq, seq)
14+
/// - \c hpx/numeric.hpp -- Parallel algorithms (for_each, sort, reduce, ...)
1715
///
1816
/// **Selection criteria**: each header is part of the HPX core module,
1917
/// provides ISO C++ Standard Library parallel equivalents, and has no
2018
/// dependency on the distributed runtime or networking layer.
21-
///
22-
/// \note For zero-boilerplate `main()` wrapping to automatically start
23-
/// and stop the HPX runtime, please additionally include
24-
/// `#include <hpx/hpx_main.hpp>`.
2519

2620
#pragma once
2721

2822
#include <hpx/config.hpp>
2923

3024
// --- Standard Parallel Toolkit (core, no networking dependency) ---
31-
#include <hpx/algorithm.hpp>
3225
#include <hpx/execution.hpp>
33-
#include <hpx/future.hpp>
3426
#include <hpx/numeric.hpp>

libs/core/include_local/tests/unit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
set(tests local_header)
88

9-
set(local_header_FLAGS NOLIBS DEPENDENCIES HPX::hpx HPX::wrap_main)
9+
set(local_header_FLAGS NOLIBS DEPENDENCIES HPX::hpx)
1010

1111
foreach(test ${tests})
1212
set(sources ${test}.cpp)

libs/core/include_local/tests/unit/local_header.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,38 @@
55
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
66

77
// Verify that hpx/local.hpp provides access to the Standard Parallel Toolkit:
8-
// futures, parallel algorithms, numeric algorithms, and execution policies.
8+
// parallel algorithms, numeric algorithms, and execution policies.
99
//
10-
// For zero-boilerplate main() wrapping, we must explicitly include hpx_main.hpp.
10+
// We use hpx::local::init to avoid any dependency on the full wrap module.
1111

1212
#include <hpx/config.hpp>
1313

14-
#include <hpx/hpx_main.hpp>
15-
14+
#include <hpx/init_runtime_local/init_runtime_local.hpp>
1615
#include <hpx/local.hpp>
1716

1817
#include <cstddef>
1918
#include <iostream>
2019
#include <numeric>
2120
#include <vector>
2221

23-
int main()
22+
int test_main(int argc, char* argv[])
2423
{
25-
// 1. Verify hpx::async and hpx::future are reachable
26-
hpx::future<int> f = hpx::async([]() { return 42; });
27-
int result = f.get();
28-
29-
// 2. Verify parallel algorithms are reachable
24+
// 1. Verify parallel algorithms are reachable via hpx/local.hpp
3025
std::vector<int> v(100);
3126
std::iota(v.begin(), v.end(), 1);
3227

3328
hpx::for_each(
3429
hpx::execution::par, v.begin(), v.end(), [](int& x) { x *= 2; });
3530

36-
// 3. Verify numeric algorithms are reachable
31+
// 2. Verify numeric algorithms are reachable
3732
int sum = hpx::reduce(hpx::execution::par, v.begin(), v.end(), 0);
3833

39-
std::cout << "async result: " << result << ", reduce sum: " << sum
40-
<< std::endl;
34+
std::cout << "reduce sum: " << sum << std::endl;
4135

42-
return 0;
36+
return hpx::local::finalize();
37+
}
38+
39+
int main(int argc, char* argv[])
40+
{
41+
return hpx::local::init(test_main, argc, argv);
4342
}

0 commit comments

Comments
 (0)