Skip to content

Commit

Permalink
Remove unncessary auto&& in gather.
Browse files Browse the repository at this point in the history
  • Loading branch information
niklas-uhl committed Jan 20, 2025
1 parent 6d94ba3 commit 1df5d77
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/kamping/collectives/gather.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gather(Args... arg
assert::light_communication
);

auto&& send_buf =
auto send_buf =
internal::select_parameter_type<internal::ParameterType::send_buf>(args...).construct_buffer_or_rebind();
using send_value_type = typename std::remove_reference_t<decltype(send_buf)>::value_type;

using default_send_count_type = decltype(kamping::send_count_out());
auto&& send_count =
auto send_count =
internal::select_parameter_type_or_default<internal::ParameterType::send_count, default_send_count_type>(
std::tuple(),
args...
Expand All @@ -114,7 +114,7 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gather(Args... arg

using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new<DefaultContainerType<send_value_type>>));

auto&& recv_buf =
auto recv_buf =
internal::select_parameter_type_or_default<internal::ParameterType::recv_buf, default_recv_buf_type>(
std::tuple(),
args...
Expand All @@ -123,14 +123,14 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gather(Args... arg
using recv_value_type = typename std::remove_reference_t<decltype(recv_buf)>::value_type;

// Get send_type and recv_type
auto&& [send_type, recv_type] =
auto [send_type, recv_type] =
internal::determine_mpi_datatypes<send_value_type, recv_value_type, decltype(recv_buf)>(args...);
[[maybe_unused]] constexpr bool recv_type_is_in_param = !has_to_be_computed<decltype(recv_type)>;

// Optional parameter: recv_count()
// Default: compute value based on send_buf.size on root
using default_recv_count_type = decltype(kamping::recv_count_out());
auto&& recv_count =
auto recv_count =
internal::select_parameter_type_or_default<internal::ParameterType::recv_count, default_recv_count_type>(
std::tuple(),
args...
Expand Down Expand Up @@ -228,13 +228,13 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gatherv(Args... ar
);

// get send buffer
auto&& send_buf =
auto send_buf =
internal::select_parameter_type<internal::ParameterType::send_buf>(args...).construct_buffer_or_rebind();
using send_value_type = typename std::remove_reference_t<decltype(send_buf)>::value_type;

// get recv buffer
using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new<DefaultContainerType<send_value_type>>));
auto&& recv_buf =
auto recv_buf =
internal::select_parameter_type_or_default<internal::ParameterType::recv_buf, default_recv_buf_type>(
std::tuple(),
args...
Expand All @@ -249,13 +249,13 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gatherv(Args... ar
);

// get send and recv type
auto&& [send_type, recv_type] =
auto [send_type, recv_type] =
internal::determine_mpi_datatypes<send_value_type, recv_value_type, decltype(recv_buf)>(args...);
[[maybe_unused]] constexpr bool recv_type_is_in_param = !has_to_be_computed<decltype(recv_type)>;

// get recv counts
using default_recv_counts_type = decltype(kamping::recv_counts_out(alloc_new<DefaultContainerType<int>>));
auto&& recv_counts =
auto recv_counts =
internal::select_parameter_type_or_default<internal::ParameterType::recv_counts, default_recv_counts_type>(
std::tuple(),
args...
Expand All @@ -279,7 +279,7 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gatherv(Args... ar
);

using default_send_count_type = decltype(kamping::send_count_out());
auto&& send_count =
auto send_count =
internal::select_parameter_type_or_default<internal::ParameterType::send_count, default_send_count_type>(
std::tuple(),
args...
Expand All @@ -292,7 +292,7 @@ auto kamping::Communicator<DefaultContainerType, Plugins...>::gatherv(Args... ar

// get recv displs
using default_recv_displs_type = decltype(kamping::recv_displs_out(alloc_new<DefaultContainerType<int>>));
auto&& recv_displs =
auto recv_displs =
internal::select_parameter_type_or_default<internal::ParameterType::recv_displs, default_recv_displs_type>(
std::tuple(),
args...
Expand Down

0 comments on commit 1df5d77

Please sign in to comment.