summaryrefslogtreecommitdiff
path: root/expt_0604.cu
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2023-06-04 19:35:54 +0800
committerKunoiSayami <[email protected]>2023-06-04 19:35:54 +0800
commit155b3a832c590c55ea3d89dd0783713f1d0f19c1 (patch)
treedfeb770865c77f76cf1ab5448f628b7e21bec483 /expt_0604.cu
parent1fbb943005ad78335f0b921be516b3df8140406d (diff)
fix: Fix compile error
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'expt_0604.cu')
-rw-r--r--expt_0604.cu73
1 files changed, 0 insertions, 73 deletions
diff --git a/expt_0604.cu b/expt_0604.cu
deleted file mode 100644
index bd64ad0..0000000
--- a/expt_0604.cu
+++ /dev/null
@@ -1,73 +0,0 @@
-// Experimental content: Print level by cdf
-
-#include "sortlib.cuh"
-#define READ_NO_OUTPUT
-#include "read_helper.h"
-
-long pow_for_sample(long n) {
- auto x = 2;
- for (int i = 1; i < n; i++) {
- x *= 2;
- }
- return x - 1;
-}
-
-static unsigned trailing_zeroes(size_t index) {
- constexpr auto block_size = 2;
- unsigned bits = 0;
- auto x = index / block_size;
-
- if (x) {
- while (x % block_size == 0) {
- ++bits;
- x /= block_size;
- }
- }
- return bits;
-}
-
-inline double calcSliceSize(size_t insertion_size) {
- return 1.0 / (double)insertion_size;
-}
-
-constexpr auto RESULT_LENGTH = 35;
-
-int main(int argc, char const *argv[]) {
-
- if (argc != 3) {
- printf("Usage %s [sample(pow)] [population]\n", argv[0]);
- return 1;
- }
-
- auto sample_length = pow_for_sample(strtol(argv[1], nullptr, 10));
- auto population_length = strtol(argv[2], nullptr, 10);
-
- printf("sample length: %ld, population length: %ld\n", sample_length,
- population_length);
-
- ReadHelper readHelper("normal_distribution.txt", sample_length, 0);
- readHelper.readFile();
-
- std::vector<key_type> sample, population;
- std::vector<unsigned int> result(RESULT_LENGTH);
- readHelper.split_into(sample, population);
- rebuildSort(sample);
-
- auto scale_size = calcSliceSize(population_length);
-
- auto sort = CustomSort(sample_length, sizeof(key_type) * 8);
-
- for (auto element : readHelper.population_vector) {
- auto ret = sort.sample_cdf_custom_version(sample.data(), element);
- auto cdf_index = ret / scale_size;
- auto index = trailing_zeroes((size_t)cdf_index);
- result[index]++;
- }
-
- for (int i = 0; i < 32; i++) {
- if (!result[i]) {
- continue;
- }
- printf("%d: %d\n", i, result[i]);
- }
-}