aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/skiplist_test.cu26
1 files changed, 16 insertions, 10 deletions
diff --git a/db/skiplist_test.cu b/db/skiplist_test.cu
index 9b7ec7e..e83af79 100644
--- a/db/skiplist_test.cu
+++ b/db/skiplist_test.cu
@@ -288,30 +288,36 @@ __device__ void update_list(SkipList<Key, Comparator> * l, Key key) {
}
__global__ void insert_skiplist(int random_seed) {
- Arena arena;
+ //unsigned row = threadIdx.x + blockIdx.x * blockDim.x;
+ /*for (int i = 0; i < 1000; i++ ) {
+ update_list(&skipList, device_rnd->Next());
+ }*/
+}
+
+__global__ void init(Arena ** pArena, SkipList<Key, Comparator> ** pSkipList) {
Comparator cmp;
- auto * skipList = new SkipList<Key, Comparator>(cmp, &arena);
- auto * device_rnd = new Random(random_seed);
- unsigned row = threadIdx.x + blockIdx.x * blockDim.x;
- for (int i = 0; i < 1000; i++ ) {
- update_list(skipList, device_rnd->Next());
- }
+ *pArena = new Arena();
+ *pSkipList = new SkipList<Key, Comparator>(cmp, reinterpret_cast<Arena*>(&*pArena));
}
__host__ void host_insert_test() {
- Key * keys;
+ //Key * keys;
//SkipList<Key, Comparator> list(cmp, &arena);
/*
for (int i = 0; i < 1000; i++) {
keys[i] = .Next();
}*/
+ Arena * pArena;
+ SkipList<Key, Comparator> * skipList;
+ auto * device_rnd = new Random(test::RandomSeed());
- dim3 blockSize(32, 1);
+ dim3 blockSize(1, 1);
- dim3 gridSize(32, 1);
+ dim3 gridSize(1, 1);
+ init<<<gridSize, blockSize>>>(&pArena, &skipList);
insert_skiplist<<<gridSize, blockSize>>>(test::RandomSeed());
cudaDeviceSynchronize();