* @note The buffer is empty. Before using it, you have to set its size.
*/
virtual void
- pack_recv_buffer(const int other_rank, std::vector<T1> &send_buffer);
+ create_request(const int other_rank, std::vector<T1> &send_buffer);
/**
* Prepare the buffer where the payload of the answer of the request to
* @param[out] recv_buffer data to be sent part of the request (optional)
*/
virtual void
- prepare_recv_buffer(const int other_rank, std::vector<T2> &recv_buffer);
+ prepare_buffer_for_answer(const int other_rank,
+ std::vector<T2> &recv_buffer);
/**
* Prepare the buffer where the payload of the answer of the request to
* its size.
*/
virtual void
- process_request(const unsigned int other_rank,
- const std::vector<T1> &buffer_recv,
- std::vector<T2> & request_buffer);
+ answer_request(const unsigned int other_rank,
+ const std::vector<T1> &buffer_recv,
+ std::vector<T2> & request_buffer);
/**
* Process the payload of the answer of the request to the process with
* @param[in] recv_buffer data to be sent part of the request (optional)
*/
virtual void
- unpack_recv_buffer(const int other_rank,
- const std::vector<T2> &recv_buffer);
+ read_answer(const int other_rank, const std::vector<T2> &recv_buffer);
};
/**
* request and send an answer.
*/
void
- process_requests();
+ answer_requests();
/**
* Start to send all requests via ISend and post IRecvs for the incoming
* the request and send an answer.
*/
void
- process_requests(int index);
+ answer_requests(int index);
/**
* Start to send all requests via ISend and post IRecvs for the incoming
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::pack_recv_buffer().
+ * Utilities::MPI::ConsensusAlgorithmProcess::create_request().
*/
virtual void
- pack_recv_buffer(const int other_rank,
- std::vector<std::pair<types::global_dof_index,
- types::global_dof_index>>
- &send_buffer) override
+ create_request(const int other_rank,
+ std::vector<std::pair<types::global_dof_index,
+ types::global_dof_index>>
+ &send_buffer) override
{
send_buffer = this->buffers.at(other_rank);
}
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::process_request().
+ * Utilities::MPI::ConsensusAlgorithmProcess::answer_request().
*/
virtual void
- process_request(
+ answer_request(
const unsigned int other_rank,
const std::vector<std::pair<types::global_dof_index,
types::global_dof_index>> &buffer_recv,
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::process_request(),
+ * Utilities::MPI::ConsensusAlgorithmProcess::answer_request(),
* adding the owner of a particular index in request_buffer (and
* keeping track of who requested a particular index in case that
* information is also desired).
*/
virtual void
- process_request(
+ answer_request(
const unsigned int other_rank,
const std::vector<std::pair<types::global_dof_index,
types::global_dof_index>> &buffer_recv,
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::pack_recv_buffer().
+ * Utilities::MPI::ConsensusAlgorithmProcess::create_request().
*/
virtual void
- pack_recv_buffer(const int other_rank,
- std::vector<std::pair<types::global_dof_index,
- types::global_dof_index>>
- &send_buffer) override
+ create_request(const int other_rank,
+ std::vector<std::pair<types::global_dof_index,
+ types::global_dof_index>>
+ &send_buffer) override
{
// create index set and compress data to be sent
auto & indices_i = indices_to_look_up_by_dict_rank[other_rank];
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::prepare_recv_buffer().
+ * Utilities::MPI::ConsensusAlgorithmProcess::prepare_buffer_for_answer().
*/
virtual void
- prepare_recv_buffer(const int other_rank,
- std::vector<unsigned int> &recv_buffer) override
+ prepare_buffer_for_answer(
+ const int other_rank,
+ std::vector<unsigned int> &recv_buffer) override
{
recv_buffer.resize(recv_indices[other_rank].size());
}
/**
* Implementation of
- * Utilities::MPI::ConsensusAlgorithmProcess::unpack_recv_buffer().
+ * Utilities::MPI::ConsensusAlgorithmProcess::read_answer().
*/
virtual void
- unpack_recv_buffer(
- const int other_rank,
- const std::vector<unsigned int> &recv_buffer) override
+ read_answer(const int other_rank,
+ const std::vector<unsigned int> &recv_buffer) override
{
Assert(recv_indices[other_rank].size() == recv_buffer.size(),
ExcMessage("Sizes do not match!"));
using T2 = int;
virtual void
- process_request(const unsigned int other_rank,
- const std::vector<T1> &,
- std::vector<T2> &) override
+ answer_request(const unsigned int other_rank,
+ const std::vector<T1> &,
+ std::vector<T2> &) override
{
this->sources.push_back(other_rank);
}
template <typename T1, typename T2>
void
- ConsensusAlgorithmProcess<T1, T2>::process_request(const unsigned int,
- const std::vector<T1> &,
- std::vector<T2> &)
+ ConsensusAlgorithmProcess<T1, T2>::answer_request(const unsigned int,
+ const std::vector<T1> &,
+ std::vector<T2> &)
{
// nothing to do
}
template <typename T1, typename T2>
void
- ConsensusAlgorithmProcess<T1, T2>::pack_recv_buffer(const int,
- std::vector<T1> &)
+ ConsensusAlgorithmProcess<T1, T2>::create_request(const int,
+ std::vector<T1> &)
{
// nothing to do
}
template <typename T1, typename T2>
void
- ConsensusAlgorithmProcess<T1, T2>::prepare_recv_buffer(const int,
- std::vector<T2> &)
+ ConsensusAlgorithmProcess<T1, T2>::prepare_buffer_for_answer(
+ const int,
+ std::vector<T2> &)
{
// nothing to do
}
template <typename T1, typename T2>
void
- ConsensusAlgorithmProcess<T1, T2>::unpack_recv_buffer(
- const int,
- const std::vector<T2> &)
+ ConsensusAlgorithmProcess<T1, T2>::read_answer(const int,
+ const std::vector<T2> &)
{
// nothing to do
}
// 2) answer requests and check if all requests of this process have been
// answered
while (!check_own_state())
- process_requests();
+ answer_requests();
// 3) signal to all other processes that all requests of this process have
// been answered
// incoming requests until all processes have received the
// answer to all requests
while (!check_global_state())
- process_requests();
+ answer_requests();
// 5) process the answer to all requests
clean_up_and_end_communication();
template <typename T1, typename T2>
void
- ConsensusAlgorithm_NBX<T1, T2>::process_requests()
+ ConsensusAlgorithm_NBX<T1, T2>::answer_requests()
{
#ifdef DEAL_II_WITH_MPI
const int tag_request =
- Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_request;
+ Utilities::MPI::internal::Tags::consensus_algorithm_nbx_answer_request;
const int tag_deliver =
Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_deliver;
// process request
auto &request_buffer = *request_buffers.back();
- this->process.process_request(other_rank,
- buffer_recv,
- request_buffer);
+ this->process.answer_request(other_rank, buffer_recv, request_buffer);
// start to send answer back
ierr = MPI_Isend(request_buffer.data(),
const auto n_targets = targets.size();
const int tag_request =
- Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_request;
+ Utilities::MPI::internal::Tags::consensus_algorithm_nbx_answer_request;
const int tag_deliver =
Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_deliver;
// translate index set to a list of pairs
auto &send_buffer = send_buffers[index];
- this->process.pack_recv_buffer(rank, send_buffer);
+ this->process.create_request(rank, send_buffer);
// start to send data
auto ierr = MPI_Isend(send_buffer.data(),
// start to receive data
auto &recv_buffer = recv_buffers[index];
- this->process.prepare_recv_buffer(rank, recv_buffer);
+ this->process.prepare_buffer_for_answer(rank, recv_buffer);
ierr = MPI_Irecv(recv_buffer.data(),
recv_buffer.size() * sizeof(T2),
MPI_BYTE,
// unpack data
{
for (unsigned int i = 0; i < targets.size(); i++)
- this->process.unpack_recv_buffer(targets[i], recv_buffers[i]);
+ this->process.read_answer(targets[i], recv_buffers[i]);
}
#endif
}
// 2) answer requests
for (unsigned int request = 0; request < n_requests; request++)
- process_requests(request);
+ answer_requests(request);
// 3) process answers
clean_up_and_end_communication();
template <typename T1, typename T2>
void
- ConsensusAlgorithm_PEX<T1, T2>::process_requests(int index)
+ ConsensusAlgorithm_PEX<T1, T2>::answer_requests(int index)
{
#ifdef DEAL_II_WITH_MPI
const int tag_request =
- Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_request;
+ Utilities::MPI::internal::Tags::consensus_algorithm_pex_answer_request;
const int tag_deliver =
Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_deliver;
// process request
auto &request_buffer = requests_buffers[index];
- this->process.process_request(other_rank, buffer_recv, request_buffer);
+ this->process.answer_request(other_rank, buffer_recv, request_buffer);
// start to send answer back
ierr = MPI_Isend(request_buffer.data(),
targets = this->process.compute_targets();
const int tag_request =
- Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_request;
+ Utilities::MPI::internal::Tags::consensus_algorithm_pex_answer_request;
const int tag_deliver =
Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_deliver;
// pack data which should be sent
auto &send_buffer = send_buffers[i];
- this->process.pack_recv_buffer(rank, send_buffer);
+ this->process.create_request(rank, send_buffer);
// start to send data
auto ierr = MPI_Isend(send_buffer.data(),
// start to receive data
auto &recv_buffer = recv_buffers[i];
- this->process.prepare_recv_buffer(rank, recv_buffer);
+ this->process.prepare_buffer_for_answer(rank, recv_buffer);
ierr = MPI_Irecv(recv_buffer.data(),
recv_buffer.size() * sizeof(T2),
MPI_BYTE,
// unpack received data
for (unsigned int i = 0; i < targets.size(); i++)
- this->process.unpack_recv_buffer(targets[i], recv_buffers[i]);
+ this->process.read_answer(targets[i], recv_buffers[i]);
#endif
}