45 lines
955 B
C++
45 lines
955 B
C++
/*!
|
|
* \file
|
|
* \brief Distributed bitonic implementation header
|
|
*
|
|
* \author
|
|
* Christos Choutouridis AEM:8997
|
|
* <cchoutou@ece.auth.gr>
|
|
*/
|
|
|
|
#ifndef DISTBITONIC_H_
|
|
#define DISTBITONIC_H_
|
|
|
|
#if !defined DEBUG
|
|
#define NDEBUG
|
|
#endif
|
|
#include <cassert>
|
|
|
|
#include <vector>
|
|
#if !defined TESTING
|
|
#include <mpi.h>
|
|
#endif
|
|
|
|
using Data_t = std::vector<uint8_t>;
|
|
using AllData_t = std::vector<Data_t>;
|
|
|
|
struct mpi_t {
|
|
size_t world_size{};
|
|
size_t world_rank{};
|
|
std::string processor_name {};
|
|
};
|
|
|
|
extern mpi_t mpi;
|
|
|
|
|
|
bool ascending(size_t node, size_t depth) noexcept;
|
|
size_t partner(size_t node, size_t step) noexcept;
|
|
bool keepsmall(size_t node, size_t partner, size_t depth) noexcept;
|
|
|
|
void exchange(size_t node, size_t partner);
|
|
void minmax(AllData_t& data, size_t node, size_t partner, bool keepsmall);
|
|
void sort_network(AllData_t& data, size_t nodes, size_t depth);
|
|
void distbitonic(size_t P, AllData_t& data);
|
|
|
|
#endif //DISTBITONIC_H_
|