HW2: RC2 - Parallel Full Sort

This commit is contained in:
2025-01-03 16:15:13 +02:00
parent 1bd0cbb8d0
commit bc98ef4e9f
4 changed files with 15 additions and 33 deletions
+3 -3
View File
@@ -12,7 +12,7 @@
#include <vector>
#include <algorithm>
//#include <parallel/algorithm>
#include <parallel/algorithm>
#include <cmath>
#include <cstdint>
#if !defined DEBUG
@@ -162,10 +162,10 @@ template<typename RangeT>
void fullSort(RangeT& data, bool ascending) noexcept {
// Use introsort from stdlib++ here, unless ... __gnu_parallel
if (ascending) {
std::sort(data.begin(), data.end(), std::less<>());
__gnu_parallel::sort(data.begin(), data.end(), std::less<>());
}
else {
std::sort(data.begin(), data.end(), std::greater<>());
__gnu_parallel::sort(data.begin(), data.end(), std::greater<>());
}
}
+4 -23
View File
@@ -357,32 +357,13 @@ private:
};
/*!
* Utility high level function to forward a function call to std::invoke and measure
* Utility high level function like to forward a function call and measure
* the excecution time
*
* @tparam Func The function type
* @tparam Args The argument
* @param func
* @param args
* @return
*/
#define timeCall(Tim, Func, ...) \
Tim.start(); \
Func(__VA_ARGS__); \
Tim.stop(); \
Tim.start(); \
Func(__VA_ARGS__); \
Tim.stop(); \
//template <typename Ret, typename Func, typename... Args>
//auto timeCall_r(Ret& ret, Func&& func, Args&&... args) {
// Timing timer;
//
// timer.start();
// ret = std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
// timer.stop();
//
// return timer.dt();
//}
#endif /* UTILS_HPP_ */