diff options
| author | KunoiSayami <[email protected]> | 2023-06-01 16:09:13 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-06-01 16:09:13 +0800 |
| commit | d8384bdc4aa7fa1ccc24aec296fac83f1d43a2b4 (patch) | |
| tree | 31f2dfd29c191596bf6d7275b82826de745943f0 /expt_0525.cu | |
| parent | 5d373e5db4d1626f085c5f19ab8481f8a0b14226 (diff) | |
feat: Optimize read_helper library
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'expt_0525.cu')
| -rw-r--r-- | expt_0525.cu | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/expt_0525.cu b/expt_0525.cu index c2ee041..8867cee 100644 --- a/expt_0525.cu +++ b/expt_0525.cu @@ -76,7 +76,6 @@ typedef unsigned long long LL; // #define MEASURE_TIME // #define MEASURE_ACCESS -#define READ_NO_OUTPUT #include "read_helper.h" #if (defined(MEASURE_ACCESS) && defined(MEASURE_TIME)) @@ -108,12 +107,6 @@ constexpr size_t FACTOR = 1; typedef LL key_type; -#ifdef RANDOM_TARGET -constexpr const char *TARGET_STRING = "RANDOM"; -#else -// constexpr const char *TARGET_STRING = "PERFECT"; -#endif - #define CUDA_ERROR_CHECK #define CudaSafeCall(err) __cudaSafeCall(err, __FILE__, __LINE__) @@ -153,7 +146,13 @@ inline void __cudaCheckError(const char *file, const int line) { // Definition of generic node class -class __attribute__((aligned(16))) Node { +class +#ifndef _MSC_VER + __attribute__((aligned(16))) +#else + __declspec(align(16)) +#endif + Node { public: int topLevel; // Level of the node LL key; // Key value @@ -636,7 +635,7 @@ inline double calcSliceSize(size_t insertion_size) { return 1.0 / (double)insertion_size; } -inline size_t calcBlocks(size_t input) { +inline auto calcBlocks(size_t input) { return (input % (NUM_THREADS * FACTOR) == 0) ? input / (NUM_THREADS * FACTOR) : (input / (NUM_THREADS * FACTOR)) + 1; @@ -660,8 +659,8 @@ int main(int argc, char **argv) { insertion_length, search_length); ReadHelper readHelper("normal_distribution.txt", sample_length, - insertion_length); - readHelper.readFile(nullptr); + insertion_length, 0); + readHelper.readFile(); std::vector<key_type> _sample, _population; readHelper.split_into(_sample, _population); /*printf("%lu, Create search vector: %ld\n", _population.size(), |
