Skip to content

Commit

Permalink
Attempt to work around nvcc problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser authored and isidorostsa committed Jul 2, 2024
1 parent 895a955 commit 831e3f6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ namespace hpx {
{
}

#if defined(HPX_GCC_VERSION) && HPX_GCC_VERSION >= 140000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
template <typename SharedState>
void operator()(SharedState const& shared_state) const
{
Expand Down Expand Up @@ -224,6 +228,9 @@ namespace hpx {
wait_.on_future_ready(shared_state->has_exception());
}
}
#if defined(HPX_GCC_VERSION) && HPX_GCC_VERSION >= 140000
#pragma GCC diagnostic pop
#endif

template <typename Tuple, std::size_t... Is>
HPX_FORCEINLINE void apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,21 @@ namespace hpx::when_all_vector_detail {
for (auto&& sender : senders)
{
#if defined(HPX_HAVE_CXX17_COPY_ELISION)
#if defined(__NVCC__)
op_states[i].emplace(
hpx::util::detail::with_result_of([&]() {
return hpx::execution::experimental::connect(
std::move(sender),
when_all_vector_receiver{*this, i});
}));
#else
op_states[i].emplace(
hpx::util::detail::with_result_of([&]() {
return hpx::execution::experimental::connect(
HPX_MOVE(sender),
when_all_vector_receiver{*this, i});
}));
#endif
#else
// MSVC doesn't get copy elision quite right, the operation
// state must be constructed explicitly directly in place
Expand Down Expand Up @@ -396,7 +405,11 @@ namespace hpx::when_all_vector_detail {
values.reserve(num_predecessors);
for (auto&& t : ts)
{
#if defined(__NVCC__)
values.push_back(std::move(t.value()));
#else
values.push_back(HPX_MOVE(t.value()));
#endif
}
hpx::execution::experimental::set_value(
HPX_MOVE(receiver), HPX_MOVE(values));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <hpx/execution.hpp>
#include <hpx/init.hpp>
#include <hpx/modules/testing.hpp>
#include <hpx/numeric.hpp>

#include <functional>

Expand Down
4 changes: 4 additions & 0 deletions libs/core/format/include/hpx/modules/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ namespace hpx::util {
os << value.delim;
first = false;

#if defined(__NVCC__)
using value_type = typename Range::value_type;
#else
using value_type = std::decay_t<decltype(elem)>;
#endif
detail::formatter<value_type>::call(os, spec, &elem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,13 @@ namespace hpx::util::detail {
// I didn't want to pull a whole header for it in.
for (auto&& val : container_accessor_of(HPX_FORWARD(T, container)))
{
#if defined(__NVCC__)
remapped.push_back(
spreading::unpack(HPX_FORWARD(M, mapper)(val)));
#else
remapped.push_back(spreading::unpack(
HPX_FORWARD(M, mapper)(HPX_FORWARD(decltype(val), val))));
#endif
}

return remapped; // RVO
Expand All @@ -530,8 +535,12 @@ namespace hpx::util::detail {
{
for (auto&& val : container_accessor_of(HPX_FORWARD(T, container)))
{
#if defined(__NVCC__)
val = spreading::unpack(HPX_FORWARD(M, mapper)(val));
#else
val = spreading::unpack(
HPX_FORWARD(M, mapper)(HPX_FORWARD(decltype(val), val)));
#endif
}
return HPX_FORWARD(T, container);
}
Expand All @@ -545,7 +554,11 @@ namespace hpx::util::detail {
{
// Don't save the empty mapping for each invocation
// of the mapper.
#if defined(__NVCC__)
HPX_FORWARD(M, mapper)(val);
#else
HPX_FORWARD(M, mapper)(HPX_FORWARD(decltype(val), val));
#endif
}
// Return one instance of an empty mapping for the container
return spreading::empty_spread();
Expand All @@ -571,7 +584,11 @@ namespace hpx::util::detail {
// CUDA needs std::forward here
for (auto&& element : std::forward<T>(container))
{
#if defined(__NVCC__)
HPX_FORWARD(M, mapper)(element);
#else
HPX_FORWARD(M, mapper)(HPX_FORWARD(decltype(element), element));
#endif
}
}
} // end namespace container_remapping
Expand Down

0 comments on commit 831e3f6

Please sign in to comment.