From d01ba96eb4ae147159f15d5f3cdb076fc60483e4 Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Mon, 29 May 2023 22:45:41 +0800 Subject: feat(exp): Add expt_0529 Signed-off-by: KunoiSayami --- sortlib.cuh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sortlib.cuh') diff --git a/sortlib.cuh b/sortlib.cuh index a7d3e2d..64f355b 100644 --- a/sortlib.cuh +++ b/sortlib.cuh @@ -37,7 +37,7 @@ public: size_t low_bit = index & (-index); return ((LENGTH + index) / low_bit) >> 1; } - +#ifdef ENABLE_SORT_TEST __device__ __host__ __attribute__((unused)) void testCalculation() const { for (size_t i = 0; i < LENGTH; i++) { auto left = calculate_index(i); @@ -50,6 +50,7 @@ public: assert(i + 1 == right); } } +#endif __device__ __host__ const key_type *binary_search(key_type *const start, // const key_type *end, @@ -127,7 +128,7 @@ public: (double)(this->LENGTH - 1); // printf("tmp: %llu %lf %lu\n", *it - *it_prev, tmp, prev_real_location); } - +#ifdef SORT_FIRST_VERSION /// First version __device__ __host__ key_type *original_binary_search(key_type *start, const key_type *end, @@ -172,13 +173,16 @@ public: (double)(x - *it_prev) / (double)(*it - *it_prev)) / (double)((end - start) - 1); } +#endif +#ifdef ENABLE_SORT_TEST static void testSelf(size_t length) { CustomSort(length, sizeof(long) * 8).testCalculation(); #ifndef DISABLE_TEST_WARNING puts("You can remove this function if passed already"); #endif } +#endif __host__ __device__ size_t length() const { return this->LENGTH; } }; @@ -201,6 +205,7 @@ template void rebuildSort(std::vector &original) { rebuild(original); } +#ifdef ENABLE_SORT_TEST __global__ void testCustomCalculation(size_t length) { CustomSort(length, sizeof(long) * 8).testCalculation(); } @@ -209,6 +214,7 @@ __global__ void testCustomCalculationWithPrint(size_t length) { CustomSort(length, sizeof(long) * 8).testCalculation(); printf("%lu pass\n", length); } +#endif class FactorySort { -- cgit v1.3.1