summaryrefslogtreecommitdiff
path: root/BS/baselines/gpu/run.py
blob: 58963b9284d9291282b3fc5a5e8ff126e9a9e508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- coding: utf-8 -*-

import numpy as np
import time

#Local Imports
from cu_lib_import import binary_search as gpu_search

# Set an array size to create
arr_len = 2048576
num_querys = 16777216

# Dummy array created
arr = np.arange(0, arr_len, 1).astype("i8")

# Random search querys created
querys = np.random.randint(1, arr_len, num_querys)

# GPU search function call
t0 = time.time()
res_gpu = gpu_search(arr, len(arr), querys, len(querys))
print("Total GPU Time: %i ms" % ((time.time() - t0)*1e003))