PDS/homework_2/src/distsort.cpp

28 lines
756 B
C++

/*!
* \file
* \brief Distributed sort implementation
*
* \author
* Christos Choutouridis AEM:8997
* <cchoutou@ece.auth.gr>
*/
#include "utils.hpp"
#include "distsort.hpp"
//! Statistic variables for exchange optimization
distStat_t localStat, remoteStat;
//! Performance timers for each one of the "costly" functions
Timing TfullSort, Texchange, Tminmax, TelbowSort;
bool isActive(mpi_id_t node, size_t nodes) {
if (!((nodes > 0) &&
(nodes <= std::numeric_limits<mpi_id_t>::max()) ))
throw std::runtime_error("(isActive) Non-acceptable value of MPI Nodes\n");
// ^ Assert that mpi_id_t can hold nodes, and thus we can cast without data loss!
return (node >= 0) && (node < static_cast<mpi_id_t>(nodes));
}