AUTH's THMMY "Parallel and distributed systems" course assignments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 line
955 B

  1. /*!
  2. * \file
  3. * \brief Distributed bitonic implementation header
  4. *
  5. * \author
  6. * Christos Choutouridis AEM:8997
  7. * <cchoutou@ece.auth.gr>
  8. */
  9. #ifndef DISTBITONIC_H_
  10. #define DISTBITONIC_H_
  11. #if !defined DEBUG
  12. #define NDEBUG
  13. #endif
  14. #include <cassert>
  15. #include <vector>
  16. #if !defined TESTING
  17. #include <mpi.h>
  18. #endif
  19. using Data_t = std::vector<uint8_t>;
  20. using AllData_t = std::vector<Data_t>;
  21. struct mpi_t {
  22. size_t world_size{};
  23. size_t world_rank{};
  24. std::string processor_name {};
  25. };
  26. extern mpi_t mpi;
  27. bool ascending(size_t node, size_t depth) noexcept;
  28. size_t partner(size_t node, size_t step) noexcept;
  29. bool keepsmall(size_t node, size_t partner, size_t depth) noexcept;
  30. void exchange(size_t node, size_t partner);
  31. void minmax(AllData_t& data, size_t node, size_t partner, bool keepsmall);
  32. void sort_network(AllData_t& data, size_t nodes, size_t depth);
  33. void distbitonic(size_t P, AllData_t& data);
  34. #endif //DISTBITONIC_H_