HW3: RC4 - Add a qsort for reference

This commit is contained in:
2025-02-21 19:16:21 +02:00
parent dac00ed194
commit ac53a58a70
3 changed files with 20 additions and 1 deletions
+9 -1
View File
@@ -16,6 +16,7 @@
#include <cstdint>
#include <utility>
#include <stdexcept>
#include <algorithm>
#include "utils.hpp"
@@ -117,8 +118,15 @@ __device__ void exchange(ValueT* data, threadId_t tid, threadId_t partner, bool
data[partner] = temp;
}
}
#if CODE_VERSION == SERIAL
#if CODE_VERSION == V0
template <typename DataT>
void bitonicSort(DataT& data) {
std::sort(data.begin(), data.end());
}
#elif CODE_VERSION == V0
/*!
* This is the body of each thread. This function compare and exchange data
+1
View File
@@ -28,6 +28,7 @@ static constexpr char version[] = "0.4";
#define V0 0
#define V1 1
#define V2 2
#define SERIAL 's'
// Fail-safe version selection
#if !defined CODE_VERSION