HW2: A local version of distbubbletonic added
This commit is contained in:
@@ -20,6 +20,14 @@
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Enumerator for the different versions of the sorting method
|
||||
*/
|
||||
enum class SortMode {
|
||||
Bubbletonic, //!< The v0.5 of the algorithm where we use a bubble-sort like approach
|
||||
Bitonic //!< The v1.0 of the algorithm where we use the bitonic data-exchange approach
|
||||
};
|
||||
|
||||
using Data_t = std::vector<uint8_t>;
|
||||
using AllData_t = std::vector<Data_t>;
|
||||
|
||||
@@ -31,14 +39,49 @@ struct mpi_t {
|
||||
|
||||
extern mpi_t mpi;
|
||||
|
||||
/*
|
||||
* ============================== Sort utilities ==============================
|
||||
*/
|
||||
|
||||
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;
|
||||
/*!
|
||||
* The primary function template of ascending(). It is DISABLED since , it is explicitly specialized
|
||||
* for each of the \c SortMode
|
||||
*/
|
||||
template <SortMode Mode> bool ascending(size_t, [[maybe_unused]] size_t) noexcept = delete;
|
||||
template <> bool ascending<SortMode::Bubbletonic>(size_t node, [[maybe_unused]] size_t depth) noexcept;
|
||||
template <> bool ascending<SortMode::Bitonic>(size_t node, size_t depth) noexcept;
|
||||
|
||||
/*!
|
||||
* The primary function template of partner(). It is DISABLED since , it is explicitly specialized
|
||||
* for each of the \c SortMode
|
||||
*/
|
||||
template <SortMode Mode> size_t partner(size_t, size_t) noexcept = delete;
|
||||
template <> size_t partner<SortMode::Bubbletonic>(size_t node, size_t step) noexcept;
|
||||
template <> size_t partner<SortMode::Bitonic>(size_t node, size_t step) noexcept;
|
||||
|
||||
/*!
|
||||
* The primary function template of keepsmall(). It is DISABLED since , it is explicitly specialized
|
||||
* for each of the \c SortMode
|
||||
*/
|
||||
template<SortMode Mode> bool keepsmall(size_t, size_t, [[maybe_unused]] size_t) noexcept = delete;
|
||||
template<> bool keepsmall<SortMode::Bubbletonic>(size_t node, size_t partner, [[maybe_unused]] size_t depth) noexcept;
|
||||
template<> bool keepsmall<SortMode::Bitonic>(size_t node, size_t partner, size_t depth) noexcept;
|
||||
|
||||
bool isActive(size_t node, size_t nodes) noexcept;
|
||||
|
||||
/*
|
||||
* ============================== Data utilities ==============================
|
||||
*/
|
||||
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);
|
||||
|
||||
/*
|
||||
* ============================== Sort algorithms ==============================
|
||||
*/
|
||||
void bubbletonic_network(AllData_t& data, size_t nodes);
|
||||
void distbubbletonic(size_t P, AllData_t& data);
|
||||
|
||||
void bitonic_network(AllData_t& data, size_t nodes, size_t depth);
|
||||
void distbitonic(size_t P, AllData_t& data);
|
||||
|
||||
#endif //DISTBITONIC_H_
|
||||
|
||||
Reference in New Issue
Block a user