Skip to content

Commit

Permalink
Fix omp vectorization pragma errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pansysk75 committed Oct 10, 2024
1 parent 8c75983 commit 6a223f3
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 56 deletions.
1 change: 1 addition & 0 deletions .jenkins/lsu/env-clang-17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

configure_extra_options+=" -DCMAKE_BUILD_TYPE=${build_type}"
configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}"
configure_extra_options+=" -DCMAKE_CXX_FLAGS=-fopenmp"
configure_extra_options+=" -DHPX_WITH_MALLOC=system"
configure_extra_options+=" -DHPX_WITH_FETCH_ASIO=ON"
configure_extra_options+=" -DHPX_WITH_COMPILER_WARNINGS=ON"
Expand Down
1 change: 1 addition & 0 deletions .jenkins/lsu/env-gcc-13.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export CXX_STD="20"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}"
configure_extra_options+=" -DCMAKE_CXX_FLAGS=-fopenmp"
configure_extra_options+=" -DHPX_WITH_MALLOC=system"
configure_extra_options+=" -DHPX_WITH_FETCH_ASIO=ON"
configure_extra_options+=" -DHPX_WITH_COMPILER_WARNINGS=ON"
Expand Down
34 changes: 16 additions & 18 deletions libs/core/algorithms/include/hpx/parallel/unseq/loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace hpx::parallel::util {
struct unseq_loop_n
{
template <typename InIter, typename F>
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
Expand Down Expand Up @@ -136,7 +136,7 @@ namespace hpx::parallel::util {
{
template <typename InIter1, typename InIter2, typename F>
HPX_HOST_DEVICE
HPX_FORCEINLINE static constexpr std::pair<InIter1, InIter2>
HPX_FORCEINLINE static std::pair<InIter1, InIter2>
call(InIter1 HPX_RESTRICT it1, InIter1 HPX_RESTRICT last1,
InIter2 HPX_RESTRICT it2, F&& f)
{
Expand Down Expand Up @@ -216,19 +216,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

Expand Down Expand Up @@ -256,19 +255,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

Expand Down
34 changes: 17 additions & 17 deletions libs/core/algorithms/include/hpx/parallel/unseq/reduce_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace hpx::parallel::util::detail {
{
#if defined(HPX_HAVE_VECTOR_REDUCTION)
template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -99,7 +99,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -113,7 +113,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -127,7 +127,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -141,7 +141,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -155,7 +155,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -169,7 +169,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -183,7 +183,7 @@ namespace hpx::parallel::util::detail {
}

template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce /* */, Convert conv)
{
Expand All @@ -197,7 +197,7 @@ namespace hpx::parallel::util::detail {
}
#endif
template <typename Iter1, typename T, typename Convert, typename Reduce>
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>, T>
reduce(Iter1 it, std::size_t count, T init, Reduce r, Convert conv)
{
Expand Down Expand Up @@ -274,7 +274,7 @@ namespace hpx::parallel::util::detail {
#if defined(HPX_HAVE_VECTOR_REDUCTION)
template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -290,7 +290,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -306,7 +306,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -322,7 +322,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -338,7 +338,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand Down Expand Up @@ -370,7 +370,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -386,7 +386,7 @@ namespace hpx::parallel::util::detail {

template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce /* */,
Convert conv)
Expand All @@ -402,7 +402,7 @@ namespace hpx::parallel::util::detail {
#endif
template <typename Iter1, typename Iter2, typename T, typename Convert,
typename Reduce>
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>, T>
reduce(Iter1 it1, Iter2 it2, std::size_t count, T init, Reduce r,
Convert conv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace hpx::parallel::util {
{
template <typename InIter, typename OutIter, typename F>
HPX_HOST_DEVICE
HPX_FORCEINLINE static constexpr std::pair<InIter, OutIter>
HPX_FORCEINLINE static std::pair<InIter, OutIter>
call(InIter HPX_RESTRICT it, std::size_t num,
OutIter HPX_RESTRICT dest, F&& f)
{
Expand Down Expand Up @@ -76,7 +76,7 @@ namespace hpx::parallel::util {
{
template <typename InIter, typename OutIter, typename F>
HPX_HOST_DEVICE
HPX_FORCEINLINE static constexpr std::pair<InIter, OutIter>
HPX_FORCEINLINE static std::pair<InIter, OutIter>
call(InIter HPX_RESTRICT it, std::size_t num,
OutIter HPX_RESTRICT dest, F&& f)
{
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace hpx::parallel::util {
{
template <typename InIter1, typename InIter2, typename OutIter,
typename F>
HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr hpx::tuple<InIter1,
HPX_HOST_DEVICE HPX_FORCEINLINE static hpx::tuple<InIter1,
InIter2, OutIter>
call(InIter1 HPX_RESTRICT first1, std::size_t num,
InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, F&& f)
Expand Down Expand Up @@ -401,7 +401,7 @@ namespace hpx::parallel::util {
{
template <typename InIter1, typename InIter2, typename OutIter,
typename F>
HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr hpx::tuple<InIter1,
HPX_HOST_DEVICE HPX_FORCEINLINE static hpx::tuple<InIter1,
InIter2, OutIter>
call(InIter1 HPX_RESTRICT first1, std::size_t num,
InIter2 HPX_RESTRICT first2, OutIter HPX_RESTRICT dest, F&& f)
Expand Down
33 changes: 16 additions & 17 deletions libs/core/algorithms/include/hpx/parallel/util/loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ namespace hpx::parallel::util {
HPX_CONCEPT_REQUIRES_( // forces hpx::execution::unseq
hpx::is_unsequenced_execution_policy_v<ExPolicy> &&
!hpx::is_parallel_execution_policy_v<ExPolicy>)>
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

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6a223f3

Please sign in to comment.