diff --git a/include/kamping/collectives/allgather.hpp b/include/kamping/collectives/allgather.hpp index 94869616f..01da1d187 100644 --- a/include/kamping/collectives/allgather.hpp +++ b/include/kamping/collectives/allgather.hpp @@ -88,13 +88,13 @@ auto kamping::Communicator::allgather(Args... ); // get the send/recv buffer and types - auto&& send_buf_param = + auto send_buf_param = internal::select_parameter_type(args...).construct_buffer_or_rebind(); auto send_buf = send_buf_param.get(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -102,7 +102,7 @@ auto kamping::Communicator::allgather(Args... .template construct_buffer_or_rebind(); using recv_value_type = typename std::remove_reference_t::value_type; - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool send_type_is_input_parameter = !has_to_be_computed; [[maybe_unused]] constexpr bool recv_type_is_input_parameter = !has_to_be_computed; @@ -119,7 +119,7 @@ auto kamping::Communicator::allgather(Args... // get the send counts using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -132,7 +132,7 @@ auto kamping::Communicator::allgather(Args... // get the receive counts using default_recv_count_type = decltype(kamping::recv_count_out()); - auto&& recv_count = + auto recv_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -215,11 +215,11 @@ auto kamping::Communicator::allgather_inplace( ); // get the send/recv buffer and type - auto&& buffer = + auto buffer = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using value_type = typename std::remove_reference_t::value_type; - auto&& type = internal::determine_mpi_send_recv_datatype(args...); + auto type = internal::determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool type_is_input_parameter = !has_to_be_computed; KASSERT( @@ -233,7 +233,7 @@ auto kamping::Communicator::allgather_inplace( // get the send counts using default_count_type = decltype(kamping::send_recv_count_out()); - auto&& count = + auto count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -332,13 +332,13 @@ auto kamping::Communicator::allgatherv(Args... ); // get send_buf - auto&& send_buf = + auto send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; // get recv_buf using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -347,14 +347,14 @@ auto kamping::Communicator::allgatherv(Args... using recv_value_type = typename std::remove_reference_t::value_type; // get send/recv types - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool send_type_is_input_parameter = !internal::has_to_be_computed; [[maybe_unused]] constexpr bool recv_type_is_input_parameter = !internal::has_to_be_computed; // get the send counts using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -366,7 +366,7 @@ auto kamping::Communicator::allgatherv(Args... } // get the recv counts using default_recv_counts_type = decltype(kamping::recv_counts_out(alloc_new>)); - auto&& recv_counts = + auto recv_counts = internal::select_parameter_type_or_default( std::tuple(), args... @@ -394,7 +394,7 @@ auto kamping::Communicator::allgatherv(Args... // Get recv_displs using default_recv_displs_type = decltype(kamping::recv_displs_out(alloc_new>)); - auto&& recv_displs = + auto recv_displs = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/collectives/allreduce.hpp b/include/kamping/collectives/allreduce.hpp index 53f9ea0e6..4d27f28e0 100644 --- a/include/kamping/collectives/allreduce.hpp +++ b/include/kamping/collectives/allreduce.hpp @@ -85,14 +85,14 @@ auto kamping::Communicator::allreduce(Args... ); // Get the send buffer and deduce the send and recv value types. - auto const& send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + auto const send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; // Deduce the recv buffer type and get (if provided) the recv buffer or allocate one (if not provided). using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); using recv_value_type = typename std::remove_reference_t::value_type; @@ -102,7 +102,7 @@ auto kamping::Communicator::allreduce(Args... ); // Get the send_recv_type. - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // Get the operation used for the reduction. The signature of the provided function is checked while building. @@ -110,10 +110,10 @@ auto kamping::Communicator::allreduce(Args... auto operation = operation_param.template build_operation(); using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>({}, args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>({}, args...) + .construct_buffer_or_rebind(); if constexpr (has_to_be_computed) { send_recv_count.underlying() = asserting_cast(send_buf.size()); } @@ -201,11 +201,11 @@ auto kamping::Communicator::allreduce_inplace( ); // Get the send buffer and deduce the send and recv value types. - auto&& send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + auto send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); using send_recv_value_type = typename std::remove_reference_t::value_type; // Get the send_recv_type. - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // Get the operation used for the reduction. The signature of the provided function is checked while building. @@ -213,10 +213,10 @@ auto kamping::Communicator::allreduce_inplace( auto operation = operation_param.template build_operation(); using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>({}, args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>({}, args...) + .construct_buffer_or_rebind(); if constexpr (has_to_be_computed) { send_recv_count.underlying() = asserting_cast(send_recv_buf.size()); } diff --git a/include/kamping/collectives/alltoall.hpp b/include/kamping/collectives/alltoall.hpp index 539e2054f..070ba880c 100644 --- a/include/kamping/collectives/alltoall.hpp +++ b/include/kamping/collectives/alltoall.hpp @@ -23,19 +23,12 @@ #include "kamping/assertion_levels.hpp" #include "kamping/checking_casts.hpp" -#include "kamping/collectives/barrier.hpp" #include "kamping/collectives/collectives_helpers.hpp" -#include "kamping/collectives/ibarrier.hpp" #include "kamping/comm_helper/is_same_on_all_ranks.hpp" #include "kamping/communicator.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameters.hpp" -#include "kamping/p2p/iprobe.hpp" -#include "kamping/p2p/isend.hpp" -#include "kamping/p2p/recv.hpp" -#include "kamping/request_pool.hpp" #include "kamping/result.hpp" /// @addtogroup kamping_collectives @@ -46,8 +39,8 @@ /// This wrapper for \c MPI_Alltoall sends the same amount of data from each rank to each rank. The following /// buffers are required: /// - \ref kamping::send_buf() containing the data that is sent to each rank. This buffer has to be the same size at -/// each rank and divisible by the size of the communicator unless a send_count or a send_type is explicitly given as -/// parameter. Each rank receives the same number of elements from this buffer. +/// each rank and divisible by the size of the communicator unless a send_count or a send_type is explicitly given +/// as parameter. Each rank receives the same number of elements from this buffer. /// /// The following parameters are optional: /// - \ref kamping::send_count() specifying how many elements are sent. If @@ -61,11 +54,11 @@ /// - \ref kamping::recv_buf() specifying a buffer for the output. A buffer of at least /// `recv_count * communicator size` is required. /// -/// - \ref kamping::send_type() specifying the \c MPI datatype to use as send type. If omitted, the \c MPI datatype is -/// derived automatically based on send_buf's underlying \c value_type. +/// - \ref kamping::send_type() specifying the \c MPI datatype to use as send type. If omitted, the \c MPI datatype +/// is derived automatically based on send_buf's underlying \c value_type. /// -/// - \ref kamping::recv_type() specifying the \c MPI datatype to use as recv type. If omitted, the \c MPI datatype is -/// derived automatically based on recv_buf's underlying \c value_type. +/// - \ref kamping::recv_type() specifying the \c MPI datatype to use as recv type. If omitted, the \c MPI datatype +/// is derived automatically based on recv_buf's underlying \c value_type. /// /// Inplace alltoall is supported by passing send_recv_buf as parameter. This changes the requirements for the other /// parameters, see \ref Communicator::alltoall_inplace. @@ -96,14 +89,14 @@ auto kamping::Communicator::alltoall(Args... a ); // Get the buffers - auto const&& send_buf = + auto const send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -113,13 +106,13 @@ auto kamping::Communicator::alltoall(Args... a static_assert(!std::is_const_v, "The receive buffer must not have a const value_type."); - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool recv_type_has_to_be_deduced = has_to_be_computed; // Get the send counts using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -131,7 +124,7 @@ auto kamping::Communicator::alltoall(Args... a } // Get the recv counts using default_recv_count_type = decltype(kamping::recv_count_out()); - auto&& recv_count = + auto recv_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -230,20 +223,20 @@ auto kamping::Communicator::alltoall_inplace(A KAMPING_OPTIONAL_PARAMETERS(send_recv_count, send_recv_type) ); - auto&& send_recv_buf = + auto send_recv_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_recv_value_type = typename std::remove_reference_t::value_type; - auto&& send_recv_type = + auto send_recv_type = internal::determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_has_to_be_deduced = has_to_be_computed; // Get the optional recv_count parameter. If the parameter is not given, allocate a new container. using default_count_type = decltype(kamping::send_recv_count_out()); - auto&& count_param = internal::select_parameter_type_or_default( - std::tuple(), - args... + auto count_param = internal::select_parameter_type_or_default( + std::tuple(), + args... ) - .construct_buffer_or_rebind(); + .construct_buffer_or_rebind(); constexpr bool count_has_to_be_computed = has_to_be_computed; KASSERT( @@ -348,7 +341,7 @@ auto kamping::Communicator::alltoallv(Args... // Get recv_buf using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -357,7 +350,7 @@ auto kamping::Communicator::alltoallv(Args... using recv_value_type = typename std::remove_reference_t::value_type; // Get send/recv types - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool send_type_has_to_be_deduced = internal::has_to_be_computed; [[maybe_unused]] constexpr bool recv_type_has_to_be_deduced = internal::has_to_be_computed; @@ -375,7 +368,7 @@ auto kamping::Communicator::alltoallv(Args... // Get recv_counts using default_recv_counts_type = decltype(kamping::recv_counts_out(alloc_new>)); - auto&& recv_counts = + auto recv_counts = internal::select_parameter_type_or_default( std::tuple(), args... @@ -386,7 +379,7 @@ auto kamping::Communicator::alltoallv(Args... // Get send_displs using default_send_displs_type = decltype(kamping::send_displs_out(alloc_new>)); - auto&& send_displs = + auto send_displs = internal::select_parameter_type_or_default( std::tuple(), args... @@ -397,7 +390,7 @@ auto kamping::Communicator::alltoallv(Args... // Get recv_displs using default_recv_displs_type = decltype(kamping::recv_displs_out(alloc_new>)); - auto&& recv_displs = + auto recv_displs = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/collectives/bcast.hpp b/include/kamping/collectives/bcast.hpp index 1c8a0c9d6..f323f97f5 100644 --- a/include/kamping/collectives/bcast.hpp +++ b/include/kamping/collectives/bcast.hpp @@ -94,7 +94,7 @@ auto kamping::Communicator::bcast(Args... args using default_send_recv_buf_type = decltype(kamping::send_recv_buf(alloc_new>)); - auto&& send_recv_buf = + auto send_recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -118,7 +118,7 @@ auto kamping::Communicator::bcast(Args... args constexpr bool buffer_is_modifiable = std::remove_reference_t::is_modifiable; - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; KASSERT( @@ -129,11 +129,11 @@ auto kamping::Communicator::bcast(Args... args // Get the optional recv_count parameter. If the parameter is not given, allocate a new container. using default_count_type = decltype(kamping::send_recv_count_out()); - auto&& count_param = internal::select_parameter_type_or_default( - std::tuple(), - args... + auto count_param = internal::select_parameter_type_or_default( + std::tuple(), + args... ) - .construct_buffer_or_rebind(); + .construct_buffer_or_rebind(); constexpr bool count_has_to_be_computed = has_to_be_computed; KASSERT( diff --git a/include/kamping/collectives/collectives_helpers.hpp b/include/kamping/collectives/collectives_helpers.hpp index 8a691a3df..23c06bfd4 100644 --- a/include/kamping/collectives/collectives_helpers.hpp +++ b/include/kamping/collectives/collectives_helpers.hpp @@ -54,12 +54,6 @@ size_t compute_required_recv_buf_size_in_vectorized_communication( } } -/// @brief If the given type T is an rvalue reference,i.e. T = U&&, the type alias refers to U. Otherwise the type alias -/// refers to T (which possibly can be an lvalue reference). -/// @tparam T Type for which a possible rvalue reference is removed. -template -using remove_rvalue_reference_t = std::conditional_t, std::remove_reference_t, T>; - /// @brief Deduce the MPI_Datatype to use on the send and recv side. /// If \ref kamping::send_type() is given, the \c MPI_Datatype wrapped inside will be used as send_type. Otherwise, the /// \c MPI_datatype is derived automatically based on send_buf's underlying \c value_type. @@ -113,7 +107,7 @@ constexpr auto determine_mpi_datatypes(Args&... args) { using default_mpi_send_type = decltype(kamping::send_type_out()); using default_mpi_recv_type = decltype(kamping::recv_type_out()); - auto&& mpi_send_type = + auto mpi_send_type = internal::select_parameter_type_or_default( std::make_tuple(), args... @@ -127,7 +121,7 @@ constexpr auto determine_mpi_datatypes(Args&... args) { } } - auto&& mpi_recv_type = + auto mpi_recv_type = internal::select_parameter_type_or_default( std::make_tuple(), args... @@ -137,16 +131,7 @@ constexpr auto determine_mpi_datatypes(Args&... args) { mpi_recv_type.underlying() = mpi_datatype(); } - // If the send/recv types are user provided we can refer to the corresponding buffers contained in args and only - // need to store an lvalue reference bound to them in the return tuple. Otherwise the send/recv type buffers are - // constructed in this function and have to be returned by value (and therefore be non-reference members of the - // return tuple). - using ForwardingTuple = std:: - tuple, remove_rvalue_reference_t>; - return ForwardingTuple( - std::forward(mpi_send_type), - std::forward(mpi_recv_type) - ); + return std::tuple{std::move(mpi_send_type), std::move(mpi_recv_type)}; } /// @brief Deduce the MPI_Datatype to use as send_recv_type in a collective operation which accepts only one parameter @@ -193,10 +178,7 @@ constexpr auto determine_mpi_send_recv_datatype(Args&... args) // Get the send_recv type using default_mpi_send_recv_type = decltype(kamping::send_recv_type_out()); - // decltype(auto) becomes an lvalue reference type if the initializer is an lvalue and a non-reference type if the - // the initializer is a pr-value (e.g. a function call returning by value). These are the only two value categories - // we accept for the return value of select_parameter_type_or_default. - decltype(auto) mpi_send_recv_type = + auto mpi_send_recv_type = internal::select_parameter_type_or_default( std::make_tuple(), args... diff --git a/include/kamping/collectives/exscan.hpp b/include/kamping/collectives/exscan.hpp index a94cb903d..95c68526d 100644 --- a/include/kamping/collectives/exscan.hpp +++ b/include/kamping/collectives/exscan.hpp @@ -94,7 +94,7 @@ auto kamping::Communicator::exscan(Args... arg ); // Get the send buffer and deduce the send and recv value types. - auto const&& send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + auto const send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; KASSERT( is_same_on_all_ranks(send_buf.size()), @@ -106,20 +106,20 @@ auto kamping::Communicator::exscan(Args... arg using default_recv_value_type = std::remove_const_t; using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); // Get the send_recv_type. - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // Get the send_recv count using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>(std::tuple(), args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>(std::tuple(), args...) + .construct_buffer_or_rebind(); constexpr bool do_compute_send_recv_count = internal::has_to_be_computed; if constexpr (do_compute_send_recv_count) { @@ -171,7 +171,7 @@ auto kamping::Communicator::exscan(Args... arg // auto-deduce the identity, as this would introduce a parameter which is required in some situtations in // KaMPIng, but never in MPI. if constexpr (has_values_on_rank_0_param) { - auto const& values_on_rank_0_param = + auto values_on_rank_0_param = select_parameter_type(args...).construct_buffer_or_rebind(); KASSERT( // if the send_recv type is user provided, kamping cannot make any assumptions about the required @@ -253,16 +253,16 @@ auto kamping::Communicator::exscan_inplace(Arg ); // get the send recv buffer and deduce the send and recv value types. - auto&& send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); - using value_type = typename std::remove_reference_t::value_type; + auto send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + using value_type = typename std::remove_reference_t::value_type; // get the send_recv_type - auto&& type = determine_mpi_send_recv_datatype(args...); + auto type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool type_is_in_param = !has_to_be_computed; // get the send_recv count using default_count_type = decltype(kamping::send_recv_count_out()); - auto&& count = + auto count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -318,7 +318,7 @@ auto kamping::Communicator::exscan_inplace(Arg // auto-deduce the identity, as this would introduce a parameter which is required in some situtations in // KaMPIng, but never in MPI. if constexpr (has_values_on_rank_0_param) { - auto const& values_on_rank_0_param = + auto values_on_rank_0_param = select_parameter_type(args...).construct_buffer_or_rebind(); KASSERT( // if the send_recv type is user provided, kamping cannot make any assumptions about the required diff --git a/include/kamping/collectives/gather.hpp b/include/kamping/collectives/gather.hpp index bf76d1640..79f590265 100644 --- a/include/kamping/collectives/gather.hpp +++ b/include/kamping/collectives/gather.hpp @@ -96,12 +96,12 @@ auto kamping::Communicator::gather(Args... arg assert::light_communication ); - auto&& send_buf = + auto send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -114,7 +114,7 @@ auto kamping::Communicator::gather(Args... arg using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -123,14 +123,14 @@ auto kamping::Communicator::gather(Args... arg using recv_value_type = typename std::remove_reference_t::value_type; // Get send_type and recv_type - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !has_to_be_computed; // 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( std::tuple(), args... @@ -228,13 +228,13 @@ auto kamping::Communicator::gatherv(Args... ar ); // get send buffer - auto&& send_buf = + auto send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; // get recv buffer using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -249,13 +249,13 @@ auto kamping::Communicator::gatherv(Args... ar ); // get send and recv type - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !has_to_be_computed; // get recv counts using default_recv_counts_type = decltype(kamping::recv_counts_out(alloc_new>)); - auto&& recv_counts = + auto recv_counts = internal::select_parameter_type_or_default( std::tuple(), args... @@ -279,7 +279,7 @@ auto kamping::Communicator::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( std::tuple(), args... @@ -292,7 +292,7 @@ auto kamping::Communicator::gatherv(Args... ar // get recv displs using default_recv_displs_type = decltype(kamping::recv_displs_out(alloc_new>)); - auto&& recv_displs = + auto recv_displs = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/collectives/iallreduce.hpp b/include/kamping/collectives/iallreduce.hpp index 3201b7db2..d2223d45d 100644 --- a/include/kamping/collectives/iallreduce.hpp +++ b/include/kamping/collectives/iallreduce.hpp @@ -82,13 +82,13 @@ auto kamping::Communicator::iallreduce(Args... ); // Get the send buffer and deduce the send and recv value types. - auto&& send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + auto send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; // Deduce the recv buffer type and get (if provided) the recv buffer or allocate one (if not provided). using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); using recv_value_type = typename std::remove_reference_t::value_type; @@ -98,7 +98,7 @@ auto kamping::Communicator::iallreduce(Args... ); // Get the send_recv_type. - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // Get the operation used for the reduction. The signature of the provided function is checked while @@ -114,10 +114,10 @@ auto kamping::Communicator::iallreduce(Args... BufferResizePolicy::no_resize>(std::move(op)); }(); using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>({}, args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>({}, args...) + .construct_buffer_or_rebind(); if constexpr (has_to_be_computed) { send_recv_count.underlying() = asserting_cast(send_buf.size()); } diff --git a/include/kamping/collectives/neighborhood/alltoall.hpp b/include/kamping/collectives/neighborhood/alltoall.hpp index 571cfaaee..2b92a6059 100644 --- a/include/kamping/collectives/neighborhood/alltoall.hpp +++ b/include/kamping/collectives/neighborhood/alltoall.hpp @@ -14,7 +14,6 @@ #pragma once #include -#include #include #include @@ -23,18 +22,10 @@ #include "kamping/assertion_levels.hpp" #include "kamping/checking_casts.hpp" -#include "kamping/collectives/barrier.hpp" #include "kamping/collectives/collectives_helpers.hpp" -#include "kamping/collectives/ibarrier.hpp" -#include "kamping/comm_helper/is_same_on_all_ranks.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameters.hpp" -#include "kamping/p2p/iprobe.hpp" -#include "kamping/p2p/isend.hpp" -#include "kamping/p2p/recv.hpp" -#include "kamping/request_pool.hpp" #include "kamping/result.hpp" #include "kamping/topology_communicator.hpp" @@ -92,13 +83,13 @@ auto kamping::TopologyCommunicator::neighbor_a KAMPING_OPTIONAL_PARAMETERS(recv_buf, send_count, recv_count, send_type, recv_type) ); // Get the buffers - auto const&& send_buf = + auto const send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -108,13 +99,13 @@ auto kamping::TopologyCommunicator::neighbor_a static_assert(!std::is_const_v, "The receive buffer must not have a const value_type."); - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool recv_type_has_to_be_deduced = has_to_be_computed; // Get the send counts using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -127,7 +118,7 @@ auto kamping::TopologyCommunicator::neighbor_a } // Get the recv counts using default_recv_count_type = decltype(kamping::recv_count_out()); - auto&& recv_count = + auto recv_count = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/collectives/reduce.hpp b/include/kamping/collectives/reduce.hpp index e04affb51..cfa9a4c85 100644 --- a/include/kamping/collectives/reduce.hpp +++ b/include/kamping/collectives/reduce.hpp @@ -88,13 +88,13 @@ auto kamping::Communicator::reduce(Args... arg ); // Get the send buffer and deduce the send and recv value types. - auto const& send_buf = + auto const send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -102,7 +102,7 @@ auto kamping::Communicator::reduce(Args... arg .template construct_buffer_or_rebind(); // Get the send type. - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // Get the operation used for the reduction. The signature of the provided function is checked while building. @@ -111,10 +111,10 @@ auto kamping::Communicator::reduce(Args... arg auto operation = operation_param.template build_operation(); using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>({}, args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>({}, args...) + .construct_buffer_or_rebind(); if constexpr (has_to_be_computed) { send_recv_count.underlying() = asserting_cast(send_buf.size()); } diff --git a/include/kamping/collectives/scan.hpp b/include/kamping/collectives/scan.hpp index 2df98c944..ca8db57dd 100644 --- a/include/kamping/collectives/scan.hpp +++ b/include/kamping/collectives/scan.hpp @@ -86,27 +86,27 @@ auto kamping::Communicator::scan(Args... args) ); // get the send buffer and deduce the send and recv value types. - auto const&& send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + auto const send_buf = select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; using default_recv_value_type = std::remove_const_t; // deduce the recv buffer type and get (if provided) the recv buffer or allocate one (if not provided). using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); // get the send_recv_type - auto&& send_recv_type = determine_mpi_send_recv_datatype(args...); + auto send_recv_type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool send_recv_type_is_in_param = !has_to_be_computed; // get the send_recv count using default_send_recv_count_type = decltype(kamping::send_recv_count_out()); - auto&& send_recv_count = internal::select_parameter_type_or_default< - internal::ParameterType::send_recv_count, - default_send_recv_count_type>(std::tuple(), args...) - .construct_buffer_or_rebind(); + auto send_recv_count = internal::select_parameter_type_or_default< + internal::ParameterType::send_recv_count, + default_send_recv_count_type>(std::tuple(), args...) + .construct_buffer_or_rebind(); constexpr bool do_compute_send_recv_count = internal::has_to_be_computed; if constexpr (do_compute_send_recv_count) { @@ -196,16 +196,16 @@ auto kamping::Communicator::scan_inplace(Args. ); // get the send recv buffer and deduce the send and recv value types. - auto&& send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); - using value_type = typename std::remove_reference_t::value_type; + auto send_recv_buf = select_parameter_type(args...).construct_buffer_or_rebind(); + using value_type = typename std::remove_reference_t::value_type; // get the send_recv_type - auto&& type = determine_mpi_send_recv_datatype(args...); + auto type = determine_mpi_send_recv_datatype(args...); [[maybe_unused]] constexpr bool type_is_in_param = !has_to_be_computed; // get the send_recv count using default_count_type = decltype(kamping::send_recv_count_out()); - auto&& count = + auto count = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/collectives/scatter.hpp b/include/kamping/collectives/scatter.hpp index 74204fc54..efaa67d4a 100644 --- a/include/kamping/collectives/scatter.hpp +++ b/include/kamping/collectives/scatter.hpp @@ -116,7 +116,7 @@ auto kamping::Communicator::scatter(Args... ar // Optional parameter: recv_buf() // Default: allocate new container using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -131,7 +131,7 @@ auto kamping::Communicator::scatter(Args... ar ); // Get send_type and recv_type - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); KASSERT( !is_root(int_root) || send_type.underlying() != MPI_DATATYPE_NULL, @@ -142,7 +142,7 @@ auto kamping::Communicator::scatter(Args... ar // Compute sendcount based on the size of the sendbuf using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( std::tuple(), args... @@ -165,7 +165,7 @@ auto kamping::Communicator::scatter(Args... ar // 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( std::tuple(), args... @@ -368,7 +368,7 @@ auto kamping::Communicator::scatterv(Args... a // Optional parameter: recv_buf() // Default: allocate new container using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -383,13 +383,13 @@ auto kamping::Communicator::scatterv(Args... a ); // Get send_type and recv_type - auto&& [send_type, recv_type] = + auto [send_type, recv_type] = internal::determine_mpi_datatypes(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !has_to_be_computed; // Get send counts using default_send_counts_type = decltype(send_counts_out(alloc_new>)); - auto&& send_counts = + auto send_counts = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); [[maybe_unused]] constexpr bool send_counts_provided = !has_to_be_computed; @@ -406,7 +406,7 @@ auto kamping::Communicator::scatterv(Args... a // Get send displacements using default_send_displs_type = decltype(send_displs_out(alloc_new>)); - auto&& send_displs = + auto send_displs = select_parameter_type_or_default(std::tuple(), args...) .template construct_buffer_or_rebind(); @@ -429,7 +429,7 @@ auto kamping::Communicator::scatterv(Args... a // Get recv counts using default_recv_count_type = decltype(recv_count_out()); - auto&& recv_count = + auto recv_count = select_parameter_type_or_default(std::tuple(), args...) .construct_buffer_or_rebind(); diff --git a/include/kamping/p2p/helpers.hpp b/include/kamping/p2p/helpers.hpp index 72598f126..e4bf7b798 100644 --- a/include/kamping/p2p/helpers.hpp +++ b/include/kamping/p2p/helpers.hpp @@ -46,10 +46,7 @@ constexpr auto determine_mpi_send_datatype(Args&... args) // Get the send type using default_mpi_send_type = decltype(kamping::send_type_out()); - // decltype(auto) becomes an lvalue reference type if the initializer is an lvalue and a non-reference type if the - // the initializer is a pr-value (e.g. a function call returning by value). These are the only two value categories - // we accept for the return value of select_parameter_type_or_default. - decltype(auto) mpi_send_type = + auto mpi_send_type = internal::select_parameter_type_or_default( std::make_tuple(), args... @@ -93,10 +90,7 @@ constexpr auto determine_mpi_recv_datatype(Args&... args) // Get the recv type using default_mpi_recv_type = decltype(kamping::recv_type_out()); - // decltype(auto) becomes an lvalue reference type if the initializer is an lvalue and a non-reference type if the - // the initializer is a pr-value (e.g. a function call returning by value). These are the only two value categories - // we accept for the return value of select_parameter_type_or_default. - decltype(auto) mpi_recv_type = + auto mpi_recv_type = internal::select_parameter_type_or_default( std::make_tuple(), args... diff --git a/include/kamping/p2p/iprobe.hpp b/include/kamping/p2p/iprobe.hpp index 24b3f561b..29b2d92b9 100644 --- a/include/kamping/p2p/iprobe.hpp +++ b/include/kamping/p2p/iprobe.hpp @@ -20,7 +20,6 @@ #include #include "kamping/communicator.hpp" -#include "kamping/data_buffer.hpp" #include "kamping/implementation_helpers.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" @@ -85,7 +84,7 @@ auto kamping::Communicator::iprobe(Args... arg using default_status_param_type = decltype(kamping::status(kamping::ignore<>)); - auto&& status = + auto status = internal::select_parameter_type_or_default( {}, args... diff --git a/include/kamping/p2p/irecv.hpp b/include/kamping/p2p/irecv.hpp index 12f507a1e..51b1f2b66 100644 --- a/include/kamping/p2p/irecv.hpp +++ b/include/kamping/p2p/irecv.hpp @@ -23,9 +23,7 @@ #include "kamping/communicator.hpp" #include "kamping/data_buffer.hpp" -#include "kamping/error_handling.hpp" #include "kamping/implementation_helpers.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameter_types.hpp" @@ -33,7 +31,6 @@ #include "kamping/p2p/helpers.hpp" #include "kamping/p2p/probe.hpp" #include "kamping/parameter_objects.hpp" -#include "kamping/request.hpp" #include "kamping/result.hpp" #include "kamping/status.hpp" @@ -89,7 +86,7 @@ auto kamping::Communicator::irecv(Args... args KAMPING_OPTIONAL_PARAMETERS(recv_buf, tag, source, recv_count, recv_type, request) ); using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -101,7 +98,7 @@ auto kamping::Communicator::irecv(Args... args "No recv_buf parameter provided and no receive value given as template parameter. One of these is required." ); - auto&& recv_type = internal::determine_mpi_recv_datatype(args...); + auto recv_type = internal::determine_mpi_recv_datatype(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !internal::has_to_be_computed; using default_request_param = decltype(kamping::request()); @@ -136,7 +133,7 @@ auto kamping::Communicator::irecv(Args... args // Get the optional recv_count parameter. If the parameter is not given, // allocate a new container. using default_recv_count_type = decltype(kamping::recv_count_out()); - auto&& recv_count_param = + auto recv_count_param = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/p2p/isend.hpp b/include/kamping/p2p/isend.hpp index fa9e22585..b627788d6 100644 --- a/include/kamping/p2p/isend.hpp +++ b/include/kamping/p2p/isend.hpp @@ -21,16 +21,13 @@ #include #include "kamping/communicator.hpp" -#include "kamping/data_buffer.hpp" #include "kamping/implementation_helpers.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameter_types.hpp" #include "kamping/named_parameters.hpp" #include "kamping/p2p/helpers.hpp" #include "kamping/parameter_objects.hpp" -#include "kamping/request.hpp" #include "kamping/result.hpp" ///// @addtogroup kamping_p2p @@ -85,14 +82,14 @@ auto kamping::Communicator::isend(Args... args KAMPING_OPTIONAL_PARAMETERS(send_count, tag, send_mode, request, send_type) ); - auto&& send_buf = + auto send_buf = internal::select_parameter_type(args...).construct_buffer_or_rebind(); using send_value_type = typename std::remove_reference_t::value_type; - auto&& send_type = internal::determine_mpi_send_datatype(args...); + auto send_type = internal::determine_mpi_send_datatype(args...); using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( {}, args... diff --git a/include/kamping/p2p/probe.hpp b/include/kamping/p2p/probe.hpp index 7ab0f6bb5..da24b6997 100644 --- a/include/kamping/p2p/probe.hpp +++ b/include/kamping/p2p/probe.hpp @@ -20,7 +20,6 @@ #include #include "kamping/communicator.hpp" -#include "kamping/data_buffer.hpp" #include "kamping/implementation_helpers.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" @@ -82,7 +81,7 @@ auto kamping::Communicator::probe(Args... args using default_status_param_type = decltype(kamping::status(kamping::ignore<>)); - auto&& status = + auto status = internal::select_parameter_type_or_default( {}, args... diff --git a/include/kamping/p2p/recv.hpp b/include/kamping/p2p/recv.hpp index 4fc4c9a71..b63dd3d1d 100644 --- a/include/kamping/p2p/recv.hpp +++ b/include/kamping/p2p/recv.hpp @@ -23,9 +23,7 @@ #include "kamping/communicator.hpp" #include "kamping/data_buffer.hpp" -#include "kamping/error_handling.hpp" #include "kamping/implementation_helpers.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameter_types.hpp" @@ -88,7 +86,7 @@ auto kamping::Communicator::recv(Args... args) KAMPING_OPTIONAL_PARAMETERS(recv_buf, tag, source, recv_count, recv_type, status) ); using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -105,7 +103,7 @@ auto kamping::Communicator::recv(Args... args) "No recv_buf parameter provided and no receive value given as template parameter. One of these is required." ); - auto&& recv_type = internal::determine_mpi_recv_datatype(args...); + auto recv_type = internal::determine_mpi_recv_datatype(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !internal::has_to_be_computed; using default_source_buf_type = decltype(kamping::source(rank::any)); @@ -132,7 +130,7 @@ auto kamping::Communicator::recv(Args... args) using default_status_param_type = decltype(kamping::status(kamping::ignore<>)); - auto&& status = + auto status = internal::select_parameter_type_or_default( {}, args... @@ -142,7 +140,7 @@ auto kamping::Communicator::recv(Args... args) // Get the optional recv_count parameter. If the parameter is not given, // allocate a new container. using default_recv_count_type = decltype(kamping::recv_count_out()); - auto&& recv_count_param = + auto recv_count_param = internal::select_parameter_type_or_default( std::tuple(), args... diff --git a/include/kamping/p2p/send.hpp b/include/kamping/p2p/send.hpp index 97444aa7d..6f3aece6b 100644 --- a/include/kamping/p2p/send.hpp +++ b/include/kamping/p2p/send.hpp @@ -21,9 +21,7 @@ #include #include "kamping/communicator.hpp" -#include "kamping/data_buffer.hpp" #include "kamping/implementation_helpers.hpp" -#include "kamping/mpi_datatype.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" #include "kamping/named_parameter_types.hpp" @@ -73,8 +71,8 @@ void kamping::Communicator::send(Args... args) KAMPING_OPTIONAL_PARAMETERS(send_count, tag, send_mode, send_type) ); - auto&& send_buf = internal::select_parameter_type(args...) - .template construct_buffer_or_rebind(); + auto send_buf = internal::select_parameter_type(args...) + .template construct_buffer_or_rebind(); constexpr bool is_serialization_used = internal::buffer_uses_serialization; if constexpr (is_serialization_used) { KAMPING_UNSUPPORTED_PARAMETER(Args, send_count, when using serialization); @@ -83,10 +81,10 @@ void kamping::Communicator::send(Args... args) } using send_value_type = typename std::remove_reference_t::value_type; - auto&& send_type = internal::determine_mpi_send_datatype(args...); + auto send_type = internal::determine_mpi_send_datatype(args...); using default_send_count_type = decltype(kamping::send_count_out()); - auto&& send_count = + auto send_count = internal::select_parameter_type_or_default( {}, args... diff --git a/include/kamping/p2p/try_recv.hpp b/include/kamping/p2p/try_recv.hpp index f6e9b74cb..667468b21 100644 --- a/include/kamping/p2p/try_recv.hpp +++ b/include/kamping/p2p/try_recv.hpp @@ -23,7 +23,6 @@ #include "kamping/communicator.hpp" #include "kamping/data_buffer.hpp" -#include "kamping/error_handling.hpp" #include "kamping/implementation_helpers.hpp" #include "kamping/named_parameter_check.hpp" #include "kamping/named_parameter_selection.hpp" @@ -87,7 +86,7 @@ auto kamping::Communicator::try_recv(Args... a // Get the recv buffer using default_recv_buf_type = decltype(kamping::recv_buf(alloc_new>)); - auto&& recv_buf = + auto recv_buf = internal::select_parameter_type_or_default( std::tuple(), args... @@ -99,7 +98,7 @@ auto kamping::Communicator::try_recv(Args... a "No recv_buf parameter provided and no receive value given as template parameter. One of these is required." ); - auto&& recv_type = internal::determine_mpi_recv_datatype(args...); + auto recv_type = internal::determine_mpi_recv_datatype(args...); [[maybe_unused]] constexpr bool recv_type_is_in_param = !internal::has_to_be_computed; // Get the source parameter. If the parameter is not given, use MPI_ANY_SOURCE. @@ -124,7 +123,7 @@ auto kamping::Communicator::try_recv(Args... a } // Get the status parameter. using default_status_param_type = decltype(kamping::status(kamping::ignore<>)); - auto&& status_param = + auto status_param = internal::select_parameter_type_or_default( {}, args...