diff options
| author | KunoiSayami <[email protected]> | 2021-11-29 10:09:43 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2021-11-29 10:09:43 +0800 |
| commit | 8126602f094fa6644ee109d7f8b49fa0a02b5451 (patch) | |
| tree | c6d67ce671bb10f89f9e4ba9681731500584f86a /db | |
| parent | 0e18a4800b0737dc8f1d3720bc79bf000529ddef (diff) | |
dump: 20211129
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'db')
| -rw-r--r-- | db/skiplist_test.cu | 26 |
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(); |
