HW3: RC4 - Add a qsort for reference
This commit is contained in:
parent
dac00ed194
commit
ac53a58a70
@ -187,6 +187,16 @@ bitonic_v2deb: $(BUILD_DIR)/$(TARGET)
|
||||
cp $(BUILD_DIR)/$(TARGET) $(OUTPUT_DIR)/$(TARGET)
|
||||
|
||||
|
||||
bitonic_ser: CC := nvcc -x cu
|
||||
bitonic_ser: CXX := nvcc -x cu
|
||||
bitonic_ser: LINKER := nvcc
|
||||
bitonic_ser: CFLAGS := $(REL_CFLAGS) -DCODE_VERSION=SERIAL
|
||||
bitonic_ser: CXXFLAGS := $(REL_CXXFLAGS) -DCODE_VERSION=SERIAL
|
||||
bitonic_ser: OUTPUT_DIR := $(OUTPUT_DIR)/serial
|
||||
bitonic_ser: $(BUILD_DIR)/$(TARGET)
|
||||
@mkdir -p $(OUTPUT_DIR)
|
||||
cp $(BUILD_DIR)/$(TARGET) $(OUTPUT_DIR)/$(TARGET)
|
||||
|
||||
|
||||
bitonic_v0: CC := nvcc -x cu
|
||||
bitonic_v0: CXX := nvcc -x cu
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user