diff --git a/.jenkins/lsu/env-clang-17.sh b/.jenkins/lsu/env-clang-17.sh index cf8ef3e3aed5..ac4ab8e51d97 100644 --- a/.jenkins/lsu/env-clang-17.sh +++ b/.jenkins/lsu/env-clang-17.sh @@ -15,6 +15,7 @@ module load openmpi export HPXRUN_RUNWRAPPER=srun export CXX_STD="20" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH +export CXXFLAGS="-fopenmp -Wno-pass-failed ${CXXFLAGS}" configure_extra_options+=" -DCMAKE_BUILD_TYPE=${build_type}" configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}" diff --git a/.jenkins/lsu/env-gcc-13.sh b/.jenkins/lsu/env-gcc-13.sh index 06910b0f4037..42a783a8d212 100644 --- a/.jenkins/lsu/env-gcc-13.sh +++ b/.jenkins/lsu/env-gcc-13.sh @@ -15,6 +15,7 @@ module load openmpi export HPXRUN_RUNWRAPPER=srun export CXX_STD="20" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH +export CXXFLAGS="-fopenmp ${CXXFLAGS}" configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}" configure_extra_options+=" -DHPX_WITH_MALLOC=system" diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/loop.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/loop.hpp index 3b7e5d3c7526..22839a680014 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/loop.hpp @@ -26,7 +26,7 @@ namespace hpx::parallel::util { struct unseq_loop_n { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr InIter call( + HPX_HOST_DEVICE HPX_FORCEINLINE static InIter call( InIter HPX_RESTRICT it, std::size_t num, F&& f) { // clang-format off @@ -135,10 +135,9 @@ namespace hpx::parallel::util { struct unseq_loop2 { template - HPX_HOST_DEVICE - HPX_FORCEINLINE static constexpr std::pair - call(InIter1 HPX_RESTRICT it1, InIter1 HPX_RESTRICT last1, - InIter2 HPX_RESTRICT it2, F&& f) + HPX_HOST_DEVICE HPX_FORCEINLINE static std::pair + call(InIter1 HPX_RESTRICT it1, InIter1 HPX_RESTRICT last1, + InIter2 HPX_RESTRICT it2, F&& f) { constexpr bool iterators_are_random_access = hpx::traits::is_random_access_iterator_v && @@ -216,19 +215,18 @@ namespace hpx::parallel::util { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (std::size_t i = 0; i < count; - (void) ++it, i += 4) // -V112 + for (std::size_t i = 0; i < count; i += 4) // -V112 { - HPX_INVOKE(f, it); - HPX_INVOKE(f, ++it); - HPX_INVOKE(f, ++it); - HPX_INVOKE(f, ++it); + HPX_INVOKE(f, it++); + HPX_INVOKE(f, it++); + HPX_INVOKE(f, it++); + HPX_INVOKE(f, it++); } HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; count < num; (void) ++count, ++it) + for (std::size_t i = count; i < num; ++i) { - HPX_INVOKE(f, it); + HPX_INVOKE(f, it++); } // clang-format on @@ -256,19 +254,18 @@ namespace hpx::parallel::util { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (std::size_t i = 0; i < count; (void) ++it, ++dest, - i += 4) // -V112 + for (std::size_t i = 0; i < count; i += 4) // -V112 { - HPX_INVOKE(f, it, dest); - HPX_INVOKE(f, ++it, ++dest); - HPX_INVOKE(f, ++it, ++dest); - HPX_INVOKE(f, ++it, ++dest); + HPX_INVOKE(f, it++, dest++); + HPX_INVOKE(f, it++, dest++); + HPX_INVOKE(f, it++, dest++); + HPX_INVOKE(f, it++, dest++); } HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; count < num; (void) ++count, ++it, ++dest) + for (std::size_t i = count; i < num; ++i) { - HPX_INVOKE(f, it, dest); + HPX_INVOKE(f, it++, dest++); } //clang-format on diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/reduce_helpers.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/reduce_helpers.hpp index 4f89171ee642..53536b4ad92e 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/reduce_helpers.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/reduce_helpers.hpp @@ -85,7 +85,7 @@ namespace hpx::parallel::util::detail { { #if defined(HPX_HAVE_VECTOR_REDUCTION) template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_plus_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -99,7 +99,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_minus_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -113,7 +113,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_multiplies_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -127,7 +127,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_bit_and_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -141,7 +141,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_bit_or_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -155,7 +155,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_bit_xor_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -169,7 +169,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_logical_and_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -183,7 +183,7 @@ namespace hpx::parallel::util::detail { } template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_logical_or_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv) { @@ -197,7 +197,7 @@ namespace hpx::parallel::util::detail { } #endif template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_not_omp_reduction_v, T> reduce(Iter1 it, std::size_t count, T init, Reduce r, Convert conv) { @@ -274,7 +274,7 @@ namespace hpx::parallel::util::detail { #if defined(HPX_HAVE_VECTOR_REDUCTION) template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_plus_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -290,7 +290,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_minus_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -306,7 +306,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_multiplies_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -322,7 +322,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_bit_and_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -338,7 +338,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_bit_or_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -370,7 +370,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_logical_and_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -386,7 +386,7 @@ namespace hpx::parallel::util::detail { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_arithmetic_logical_or_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */, Convert conv) @@ -402,7 +402,7 @@ namespace hpx::parallel::util::detail { #endif template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr std::enable_if_t< + HPX_HOST_DEVICE HPX_FORCEINLINE static std::enable_if_t< is_not_omp_reduction_v, T> reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce r, Convert conv) diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/transform_loop.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/transform_loop.hpp index 08423c3842ee..a65de125b70d 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/transform_loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/transform_loop.hpp @@ -25,10 +25,9 @@ namespace hpx::parallel::util { struct unseq_transform_loop_n { template - HPX_HOST_DEVICE - HPX_FORCEINLINE static constexpr std::pair - call(InIter HPX_RESTRICT it, std::size_t num, - OutIter HPX_RESTRICT dest, F&& f) + HPX_HOST_DEVICE HPX_FORCEINLINE static std::pair + call(InIter HPX_RESTRICT it, std::size_t num, + OutIter HPX_RESTRICT dest, F&& f) { constexpr bool iterators_are_random_access = hpx::traits::is_random_access_iterator_v && @@ -75,10 +74,9 @@ namespace hpx::parallel::util { struct unseq_transform_loop_n_ind { template - HPX_HOST_DEVICE - HPX_FORCEINLINE static constexpr std::pair - call(InIter HPX_RESTRICT it, std::size_t num, - OutIter HPX_RESTRICT dest, F&& f) + HPX_HOST_DEVICE HPX_FORCEINLINE static std::pair + call(InIter HPX_RESTRICT it, std::size_t num, + OutIter HPX_RESTRICT dest, F&& f) { constexpr bool iterators_are_random_access = hpx::traits::is_random_access_iterator_v && @@ -240,10 +238,11 @@ namespace hpx::parallel::util { { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr hpx::tuple - call(InIter1 HPX_RESTRICT first1, std::size_t num, - InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, F&& f) + HPX_HOST_DEVICE + HPX_FORCEINLINE static hpx::tuple + call(InIter1 HPX_RESTRICT first1, std::size_t num, + InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, + F&& f) { constexpr bool iterators_are_random_access = hpx::traits::is_random_access_iterator_v && @@ -401,10 +400,11 @@ namespace hpx::parallel::util { { template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr hpx::tuple - call(InIter1 HPX_RESTRICT first1, std::size_t num, - InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, F&& f) + HPX_HOST_DEVICE + HPX_FORCEINLINE static hpx::tuple + call(InIter1 HPX_RESTRICT first1, std::size_t num, + InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, + F&& f) { constexpr bool iterators_are_random_access = hpx::traits::is_random_access_iterator_v && diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index b3207bc980e7..ff5dea5c3105 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -58,14 +58,14 @@ namespace hpx::parallel::util { HPX_CONCEPT_REQUIRES_( // forces hpx::execution::unseq hpx::is_unsequenced_execution_policy_v && !hpx::is_parallel_execution_policy_v)> - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Begin call( + HPX_HOST_DEVICE HPX_FORCEINLINE static Begin call( ExPolicy&&, Begin it, End end, F&& f) { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; it != end; ++it) + for (Begin& iter = it; iter != end; ++iter) { - HPX_INVOKE(f, it); + HPX_INVOKE(f, iter); } // clang-format on @@ -695,8 +695,9 @@ namespace hpx::parallel::util { { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; it != last; (void) ++it) - HPX_INVOKE(f, it); + for (FwdIter& iter = it; iter != last; ++iter){ + HPX_INVOKE(f, iter); + } // clang-format on return it; @@ -721,8 +722,8 @@ namespace hpx::parallel::util { { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; it != last; (void) ++it, ++dest) - f(it, dest); + for (Iter& iter = it; iter != last; ++iter) + f(iter, dest++); // clang-format on return dest; @@ -913,16 +914,15 @@ namespace hpx::parallel::util { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (std::size_t i = 0; i < count; - (void) ++it, ++dest, ++i) // -V112 + for (std::size_t i = 0; i < count; ++i) // -V112 { - HPX_INVOKE(f, it, dest); + HPX_INVOKE(f, it++, dest++); } HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; count < num; (void) ++count, ++it, ++dest) + for (std::size_t i = count; i < num; ++i) { - HPX_INVOKE(f, it, dest); + HPX_INVOKE(f, it++, dest++); } // clang-format on @@ -950,16 +950,15 @@ namespace hpx::parallel::util { // clang-format off HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (std::size_t i = 0; i < count; - (void) ++it, ++i) // -V112 + for (std::size_t i = 0; i < count; ++i) // -V112 { - HPX_INVOKE(f, it); + HPX_INVOKE(f, it++); } HPX_IVDEP HPX_UNROLL HPX_VECTORIZE - for (/**/; count < num; (void) ++count, ++it) + for (std::size_t i = count; i < num; ++i) { - HPX_INVOKE(f, it); + HPX_INVOKE(f, it++); } // clang-format on