diff options
| author | KunoiSayami <[email protected]> | 2022-08-07 13:24:30 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-08-07 13:24:30 +0800 |
| commit | f8775404ad29a669af3b2aac23dc5de866e4619f (patch) | |
| tree | 2b94f409fc0e030850d4733e2b2a1b24c5ff5e49 /expt_0804.cu | |
| parent | 5e5d17b0f5d97be4c11a96a2ad2c8e10a6127832 (diff) | |
feat: Optimize binary search
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'expt_0804.cu')
| -rw-r--r-- | expt_0804.cu | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/expt_0804.cu b/expt_0804.cu index 3a599ef..73d2c82 100644 --- a/expt_0804.cu +++ b/expt_0804.cu @@ -51,7 +51,7 @@ __device__ const key_type *cudaBinarySearch(key_type *start, if (*last_known_point == val) { return last_known_point; } - son = get_son_from_step(son, (*last_known_point > val)); + son = son * 2 + -((*last_known_point - val) >> 63); last_known_point = next_level_start + son; } return last_known_point; @@ -191,10 +191,10 @@ int main(int argc, char const *argv[]) { initCuda<<<1, 1>>>(cudaSample, cudaPopulation); cudaDeviceSynchronize(); - dim3 grid_dim = 2, block_dim = 512; + dim3 grid_dim = 64, block_dim = 16; unsigned long step = test_size / (grid_dim.x * block_dim.x); - printf("step: %lu\n", step); + printf("(new) step: %lu\n", step); assert(!(test_size % (grid_dim.x * block_dim.x))); for (int scale = 2; scale <= 8; scale++) { |
