Skip to content

Commit b735a4f

Browse files
committed
Adapting HPX CUDA modules to C++ modules
-flyby: remove support for HPX::auto_wrap_main for MSVC -flyby: fix adding modules_enabled.hpp to solution file Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
1 parent b4b52ad commit b735a4f

100 files changed

Lines changed: 712 additions & 601 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,9 @@ if((HPX_WITH_NETWORKING AND HPX_WITH_PARCELPORT_MPI)
14071407
# hpx_add_compile_flag() below does not add the extra options to the top
14081408
# level directory
14091409
hpx_add_config_define(OMPI_IMPORTS)
1410+
if(HPX_WITH_CUDA)
1411+
hpx_add_config_cond_define(NOMINMAX)
1412+
endif()
14101413
endif()
14111414
endif()
14121415

cmake/HPX_AddModule.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ function(add_hpx_module libname modulename)
351351
)
352352
set(generated_headers ${generated_headers} ${cache_line_size_file})
353353

354-
# Generate an empty placeholder file for hpx/config/std_headers.hpp This
355-
# will be overwritten in libs/CMakeLists.txt with some real content.
354+
# Generate empty placeholder files for hpx/config/std_headers.hpp and
355+
# hpx/config/modules_enabled.hpp. Those will be overwritten in
356+
# libs/CMakeLists.txt with some real content.
356357
if(HPX_WITH_CXX_MODULES)
357358
set(std_header_file
358359
"${CMAKE_CURRENT_BINARY_DIR}/include/hpx/config/std_headers.hpp"
@@ -361,6 +362,11 @@ function(add_hpx_module libname modulename)
361362
set(generated_headers ${generated_headers} ${std_header_file})
362363
endif()
363364

365+
set(modules_enabled_file
366+
"${CMAKE_CURRENT_BINARY_DIR}/include/hpx/config/modules_enabled.hpp"
367+
)
368+
file(WRITE ${modules_enabled_file} "")
369+
set(generated_headers ${generated_headers} ${modules_enabled_file})
364370
endif()
365371

366372
# collect zombie generated headers

cmake/templates/std_headers.hpp.in

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,33 @@
9292
// Include LCI headers if required
9393
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_LCI)) || \
9494
defined(HPX_HAVE_MODULE_LCI_BASE)
95-
9695
# include "lci.hpp"
9796
# include "lct.h"
97+
#endif
98+
99+
#if defined(HPX_HAVE_MODULE_THRUST)
100+
# include <hpx/thrust/thrust_headers.hpp>
101+
#endif
102+
103+
#if defined(HPX_HAVE_MM_PREFETCH)
104+
# if defined(HPX_MSVC)
105+
# include <intrin.h>
106+
# endif
107+
# if defined(HPX_GCC_VERSION)
108+
# include <emmintrin.h>
109+
# endif
110+
#endif
98111

112+
#if defined(HPX_HAVE_DATAPAR)
113+
# if defined(HPX_HAVE_DATAPAR_EVE)
114+
# include <eve/eve.hpp>
115+
# include <eve/memory/aligned_ptr.hpp>
116+
# endif
117+
# if defined(HPX_HAVE_DATAPAR_STD_EXPERIMENTAL_SIMD)
118+
# include <experimental/simd>
119+
# endif
120+
# if defined(HPX_HAVE_DATAPAR_VC)
121+
# include <Vc/Vc>
122+
# include <Vc/global.h>
123+
# endif
99124
#endif

components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp

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

1616
#include <hpx/config.hpp>
1717
#include <hpx/assert.hpp>
18-
#include #include < hpx / modules / algorithms.hpp>
18+
#include <hpx/modules/algorithms.hpp>
1919
#include <hpx/modules/async_base.hpp>
2020
#include <hpx/modules/iterator_support.hpp>
2121
#include <hpx/naming_base/id_type.hpp>

docs/sphinx/manual/creating_hpx_projects.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,12 @@ implicitly using ``main()`` as the entry point. If you want the same wrapping
265265
behavior without including :hpx-header:`wrap/include,hpx/hpx_main.hpp`, link to
266266
the ``HPX::auto_wrap_main`` target instead. This enables the runtime
267267
initialization around ``main()`` unconditionally and is useful for codebases
268-
where adding the header to ``main.cpp`` is impractical.
268+
where adding the header to ``main.cpp`` is impractical
269+
270+
.. note::
271+
272+
The use of ``HPX::auto_wrap_main`` is not supported when using the
273+
native Windows MSVC toolchain.
269274

270275
If you want to use the facilities exposed by ``hpx::runtime_manager`` in binaries
271276
that were not linked as executables (e.g., in shared libraries), you will need

docs/sphinx/manual/starting_the_hpx_runtime.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ you cannot or do not want to include ``hpx/hpx_main.hpp`` in ``main.cpp``, you
5959
can instead link against ``HPX::auto_wrap_main``. That target enables the same
6060
runtime startup path without needing the header-triggered opt-in.
6161

62+
.. note::
63+
64+
The use of ``HPX::auto_wrap_main`` is not supported when using the
65+
native Windows MSVC toolchain.
6266

6367
.. note::
6468

libs/CMakeLists.txt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,30 @@ add_library(hpx_interface_wrap_main INTERFACE)
184184
target_link_libraries(
185185
hpx_interface_wrap_main INTERFACE $<${_is_executable}:HPXInternal::hpx_wrap>
186186
)
187-
add_library(hpx_interface_auto_wrap_main INTERFACE)
188-
target_link_libraries(
189-
hpx_interface_auto_wrap_main
190-
INTERFACE $<${_is_executable}:HPXInternal::hpx_auto_wrap>
191-
)
192187

193188
target_link_libraries(wrap_main INTERFACE hpx_interface_wrap_main)
194-
target_link_libraries(auto_wrap_main INTERFACE hpx_interface_auto_wrap_main)
195189
target_link_libraries(init INTERFACE HPXInternal::hpx_init)
196190
target_link_libraries(hpx INTERFACE hpx_interface)
197191

198-
# HPX::component is to be linked privately to all HPX components NOTE: The
199-
# _is_library guard only prevents simple mistakes of linking HPX::component to
200-
# executables. It does not prevent linking it to libraries that are not
201-
# components.
192+
set(hpx_targets hpx wrap_main init plugin component)
193+
set(hpx_internal_targets hpx_full hpx_interface hpx_interface_wrap_main)
194+
195+
if(NOT MSVC)
196+
add_library(hpx_interface_auto_wrap_main INTERFACE)
197+
target_link_libraries(
198+
hpx_interface_auto_wrap_main
199+
INTERFACE $<${_is_executable}:HPXInternal::hpx_auto_wrap>
200+
)
201+
target_link_libraries(auto_wrap_main INTERFACE hpx_interface_auto_wrap_main)
202+
set(hpx_targets ${hpx_targets} auto_wrap_main)
203+
set(hpx_internal_targets ${hpx_internal_targets} hpx_interface_auto_wrap_main)
204+
endif()
205+
206+
# HPX::component is to be linked privately to all HPX components
207+
#
208+
# NOTE: The _is_library guard only prevents simple mistakes of linking
209+
# HPX::component to executables. It does not prevent linking it to libraries
210+
# that are not components.
202211
add_library(component INTERFACE)
203212
target_compile_definitions(
204213
component
@@ -219,11 +228,6 @@ target_compile_definitions(
219228
"$<${_is_library}:HPX_PLUGIN_NAME_DEFAULT=hpx_$<TARGET_PROPERTY:NAME>>"
220229
)
221230

222-
set(hpx_targets hpx wrap_main auto_wrap_main init plugin component)
223-
set(hpx_internal_targets hpx_full hpx_interface hpx_interface_wrap_main
224-
hpx_interface_auto_wrap_main
225-
)
226-
227231
# cmake-format: off
228232
install(
229233
TARGETS ${hpx_targets}

libs/core/algorithms/include/hpx/parallel/algorithms/detail/parallel_stable_sort.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace hpx::parallel::detail {
6060
/// \param [in] first : range of elements to sort
6161
/// \param [in] last : range of elements to sort
6262
/// \param [in] comp : object for to compare two elements
63-
HPX_CXX_EXPORT template <typename Iter, typename Sent, typename Compare>
63+
template <typename Iter, typename Sent, typename Compare>
6464
parallel_stable_sort_helper<Iter, Sent,
6565
Compare>::parallel_stable_sort_helper(Iter first, Sent last,
6666
Compare comp)
@@ -72,7 +72,7 @@ namespace hpx::parallel::detail {
7272
HPX_ASSERT(range_initial.size() >= 0);
7373
}
7474

75-
HPX_CXX_EXPORT template <typename Iter, typename Sent, typename Compare>
75+
template <typename Iter, typename Sent, typename Compare>
7676
template <typename Exec>
7777
Iter parallel_stable_sort_helper<Iter, Sent, Compare>::operator()(
7878
Exec&& exec, std::uint32_t nthreads, std::size_t chunk_size)

libs/core/algorithms/include/hpx/parallel/algorithms/detail/sample_sort.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
///////////////////////////////////////////////////////////////////////////////
3131
namespace hpx::parallel::detail {
3232

33-
HPX_CXX_EXPORT static constexpr std::uint32_t sample_sort_limit_per_task = 1
33+
HPX_CXX_EXPORT inline constexpr std::uint32_t sample_sort_limit_per_task = 1
3434
<< 16;
3535

3636
/// \struct sample_sort

libs/core/algorithms/include/hpx/parallel/algorithms/exclusive_scan.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ namespace hpx::parallel {
322322
// Our own version of the sequential exclusive_scan.
323323
HPX_CXX_EXPORT template <typename InIter, typename Sent,
324324
typename OutIter, typename T, typename Op>
325-
static constexpr util::in_out_result<InIter, OutIter>
325+
constexpr util::in_out_result<InIter, OutIter>
326326
sequential_exclusive_scan(
327327
InIter first, Sent last, OutIter dest, T init, Op&& op)
328328
{
@@ -338,7 +338,7 @@ namespace hpx::parallel {
338338

339339
HPX_CXX_EXPORT template <typename InIter, typename OutIter, typename T,
340340
typename Op>
341-
static constexpr T sequential_exclusive_scan_n(
341+
constexpr T sequential_exclusive_scan_n(
342342
InIter first, std::size_t count, OutIter dest, T init, Op&& op)
343343
{
344344
T temp = init;

0 commit comments

Comments
 (0)