Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/algorithms/include/timpi/parallel_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace TIMPI {
* map entry; this will avoid any unnecessary communication.
*
* Data which is received from other processors will be operated on by
* act_on_data(processor_id_type pid, const std::vector<datum> & data)
* act_on_data(processor_id_type pid, std::vector<datum> && data)
*
* If data exists for the local processor in the map, it will be acted
* on directly, without any network operations.
Expand Down Expand Up @@ -110,7 +110,7 @@ void push_parallel_vector_data(const Communicator & comm,
*
* Answer data from each query will be operated on by
* act_on_data(processor_id_type pid, const std::vector<id> & ids,
* const std::vector<datum> & data);
* std::vector<datum> && data);
*
* If a query vector exists for the local processor in the map,
* gather_data will be called on it directly, and act_on_data will be
Expand Down Expand Up @@ -148,7 +148,7 @@ void pull_parallel_vector_data(const Communicator & comm,
* map entry; this will avoid any unnecessary communication.
*
* Data which is received from other processors will be operated on by
* act_on_data(processor_id_type pid, const std::vector<datum> & data)
* act_on_data(processor_id_type pid, std::vector<datum> && data)
*
* If data exists for the local processor in the map, it will be acted
* on directly, without any network operations. This *also* avoids
Expand Down Expand Up @@ -211,12 +211,13 @@ template <typename MapToContainers,
typename ActionFunctor>
void
push_parallel_nbx_helper(const Communicator & comm,
MapToContainers & data,
MapToContainers && data,
const SendFunctor & send_functor,
const PossiblyReceiveFunctor & possibly_receive_functor,
const ActionFunctor & act_on_data)
{
typedef typename MapToContainers::value_type::second_type container_type;
typedef typename std::remove_reference<MapToContainers>::type::value_type::second_type
container_type;

// This function must be run on all processors at once
timpi_parallel_only(comm);
Expand Down Expand Up @@ -249,7 +250,7 @@ push_parallel_nbx_helper(const Communicator & comm,

// Just act on data if the user requested a send-to-self
if (dest_pid == comm.rank())
act_on_data(dest_pid, datum);
act_on_data(dest_pid, std::move(datum));
else
{
requests.emplace_back();
Expand Down Expand Up @@ -325,7 +326,7 @@ push_parallel_nbx_helper(const Communicator & comm,
info.request.wait();

// Act on the data
act_on_data(info.src_pid, info.data);
act_on_data(info.src_pid, std::move(info.data));

// This removes it from the list
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/packed_range_unit.C
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ Communicator *TestCommWorld;
auto collect_data =
[&received_data]
(processor_id_type pid,
std::vector<std::unique_ptr<int>> & vector_received)
std::vector<std::unique_ptr<int>> && vector_received)
{
auto & received = received_data[pid];
for (auto & val : vector_received)
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_sync_unit.C
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Communicator *TestCommWorld;
auto collect_data =
[&received_data]
(processor_id_type pid,
typename std::vector<unsigned int> & vec_received)
typename std::vector<unsigned int> && vec_received)
{
auto & vec = received_data[pid];
for (auto & val : vec_received)
Expand Down