|
- /*!
- * \file
- * \brief Distributed bitonic implementation header
- *
- * \author
- * Christos Choutouridis AEM:8997
- * <cchoutou@ece.auth.gr>
- */
-
- #ifndef DISTBITONIC_H_
- #define DISTBITONIC_H_
-
- #include <cstdint>
- #include "utils.hpp"
-
-
- /*!
- * 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>;
-
- /*
- * ============================== Sort utilities ==============================
- */
-
- /*!
- * 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(mpi_id_t, [[maybe_unused]] size_t) noexcept = delete;
- template <> bool ascending<SortMode::Bubbletonic>(mpi_id_t node, [[maybe_unused]] size_t depth) noexcept;
- template <> bool ascending<SortMode::Bitonic>(mpi_id_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> mpi_id_t partner(mpi_id_t, size_t) noexcept = delete;
- template <> mpi_id_t partner<SortMode::Bubbletonic>(mpi_id_t node, size_t step) noexcept;
- template <> mpi_id_t partner<SortMode::Bitonic>(mpi_id_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(mpi_id_t, mpi_id_t, [[maybe_unused]] size_t) noexcept = delete;
- template<> bool keepSmall<SortMode::Bubbletonic>(mpi_id_t node, mpi_id_t partner, [[maybe_unused]] size_t depth) noexcept;
- template<> bool keepSmall<SortMode::Bitonic>(mpi_id_t node, mpi_id_t partner, size_t depth) noexcept;
-
- bool isActive(mpi_id_t node, mpi_id_t nodes) noexcept;
-
- /*
- * ============================== Data utilities ==============================
- */
- void exchange(mpi_id_t node, mpi_id_t partner);
- void minmax(AllData_t& data, mpi_id_t node, mpi_id_t partner, bool keepsmall);
-
- /*
- * ============================== Sort algorithms ==============================
- */
- void bubbletonic_network(AllData_t& data, mpi_id_t nodes);
- void distBubbletonic(mpi_id_t P, AllData_t& data);
-
- void bitonic_network(AllData_t& data, mpi_id_t nodes, mpi_id_t depth);
- void distBitonic(mpi_id_t P, AllData_t& data);
-
- #endif //DISTBITONIC_H_
|