summaryrefslogtreecommitdiff
path: root/expt_0525.cu
diff options
context:
space:
mode:
Diffstat (limited to 'expt_0525.cu')
-rw-r--r--expt_0525.cu33
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>>>();