diff options
| author | KunoiSayami <[email protected]> | 2023-05-28 16:06:33 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-05-28 16:06:33 +0800 |
| commit | 91ba3a5cc7703ae3ba37be3ad43692556177a0a7 (patch) | |
| tree | 85cf1836ef7477b1b486cac89dd2cbe0809be976 /expt_0525.cu | |
| parent | 8d98c61aa03969d064e0081a40a5c22c8e29eadf (diff) | |
fix(exp): Fix sample not sort
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'expt_0525.cu')
| -rw-r--r-- | expt_0525.cu | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/expt_0525.cu b/expt_0525.cu index c780c37..3c5e5c2 100644 --- a/expt_0525.cu +++ b/expt_0525.cu @@ -307,6 +307,7 @@ public: __device__ bool Add(LL); __device__ bool Delete(LL); __device__ bool Search(LL); + //~LockFreeSkipList(){cudaFree()} __device__ size_t searchIndex(key_type key) { auto result = customSort.binary_search(this->sample, key); @@ -314,7 +315,7 @@ public: return index; } - __device__ unsigned trailing_zeroes(size_t index) { + static __device__ unsigned trailing_zeroes(size_t index) { constexpr auto block_size = 2; unsigned bits = 0; LL x = index / block_size; @@ -655,8 +656,7 @@ inline size_t calcBlocks(size_t input) { int main(int argc, char **argv) { if (argc != 4) { - printf("Need two arguments: percent add ops and percent delete ops (e.g., " - "30 50 for 30%% add and 50%% delete).\nAborting...\n"); + printf("Usage %s [sample] [insertion] [search]\n", argv[0]); exit(1); } @@ -673,6 +673,7 @@ int main(int argc, char **argv) { readHelper.split_into(_sample, _population); /*printf("%lu, Create search vector: %ld\n", _population.size(), _population.end() - (_population.begin() + insertion_length));*/ + rebuild(_sample); std::vector<key_type> _search(_population.begin() + insertion_length, _population.end()); _population.resize(insertion_length); @@ -762,33 +763,13 @@ int main(int argc, char **argv) { // Print kernel execution time in milliseconds - printf("%lu: %lf", NUM_ITEMS, time); - - // LL *Cop2; - // cudaMalloc((void **)&Cop2, sizeof(LL) * NUM_ITEMS); - // cudaMemcpy(Cop2, op, sizeof(LL) * NUM_ITEMS, cudaMemcpyHostToDevice); - - cudaEventCreate(&start); - cudaEventCreate(&stop); - cudaEventRecord(start, nullptr); - kernel<<<blocks, NUM_THREADS>>>(cudaOperatorItems, search_length, Cresult); - CudaCheckError(); - cudaDeviceSynchronize(); - cudaEventRecord(stop, nullptr); - cudaEventSynchronize(stop); - cudaEventElapsedTime(&time, start, stop); - cudaEventDestroy(start); - cudaEventDestroy(stop); - - // Print kernel execution time in milliseconds - - printf(" %lf\n", time); - + printf("%lu: %lf", search_length, time); // Check for errors // Move results back to host memory - cudaMemcpy(result, Cresult, sizeof(LL) * NUM_ITEMS, cudaMemcpyDeviceToHost); + cudaMemcpy(result, Cresult, sizeof(LL) * search_length, + cudaMemcpyDeviceToHost); // Uncomment the following for debugging // print<<<1,32>>>(); |
