aboutsummaryrefslogtreecommitdiff
path: root/db/skiplist_test.cu
diff options
context:
space:
mode:
Diffstat (limited to 'db/skiplist_test.cu')
-rw-r--r--db/skiplist_test.cu20
1 files changed, 14 insertions, 6 deletions
diff --git a/db/skiplist_test.cu b/db/skiplist_test.cu
index c926575..1827ab7 100644
--- a/db/skiplist_test.cu
+++ b/db/skiplist_test.cu
@@ -407,11 +407,13 @@ __global__ void init(Arena ** pArena, SkipList<Key, Comparator> ** pSkipList) {
printf("init3\n");
}
+constexpr size_t SKIPLIST_TEST_SIZE = 100;
+constexpr size_t TEST_STEP = SKIPLIST_TEST_SIZE / 10;
+
__global__ void testParallel(SkipList<Key, Comparator> * skipList, Key * keys) {
unsigned int start = threadIdx.x;
- printf("skiplist: %p\n", skipList);
printf("start: %u\n", start);
- for (unsigned i = start * 100; i < (start + 1) * 100 ; i++) {
+ for (unsigned i = start * TEST_STEP; i < (start + 1) * TEST_STEP; i++) {
//printf("key: %lu\n", keys[i]);
skipList->Insert(keys[i]);
}
@@ -426,7 +428,7 @@ void host_insert_test() {
for (int i = 0; i < 1000; i++) {
keys[i] = .Next();
}*/
- Key * keys = new Key[1000];
+ Key * keys = new Key[SKIPLIST_TEST_SIZE];
Arena ** pArena;
SkipList<Key, Comparator> ** skipList;
std::set<Key> k;
@@ -435,20 +437,26 @@ void host_insert_test() {
cudaMallocManaged((void**)&skipList, sizeof(void*));
auto * device_rnd = new Random(test::RandomSeed());
Key * device_keys = nullptr;
- cudaMallocManaged((void**)&device_keys, sizeof(Key) * 1000 );
+ cudaMallocManaged((void**)&device_keys, sizeof(Key) * SKIPLIST_TEST_SIZE );
- for (int i = 0; i< 1000; i++) {
+ for (int i = 0; i < SKIPLIST_TEST_SIZE; i++) {
Key tmp;
size_t current = k.size();
do {
tmp = device_rnd->Next();
k.insert(tmp);
} while (k.size() == current);
+
+ /*do {
+ tmp = device_rnd->Next();
+ }
+ while (k.find(tmp) != k.end());*/
+
keys[i] = tmp;
//printf("%ld\n", tmp);
}
- cudaMemcpy(device_keys, keys, 1000, cudaMemcpyHostToDevice);
+ cudaMemcpy(device_keys, keys, SKIPLIST_TEST_SIZE * sizeof(Key), cudaMemcpyHostToDevice);
dim3 gridSize(1, 1);
dim3 blockSize(10, 1);