summaryrefslogtreecommitdiff
path: root/BS/baselines/gpu/run.py
diff options
context:
space:
mode:
authorJuan Gomez Luna <juan.gomez@safari.ethz.ch>2021-06-16 19:46:05 +0200
committerJuan Gomez Luna <juan.gomez@safari.ethz.ch>2021-06-16 19:46:05 +0200
commit3de4b495fb176eba9a0eb517a4ce05903cb67acb (patch)
treefc6776a94549d2d4039898f183dbbeb2ce013ba9 /BS/baselines/gpu/run.py
parentef5c3688c486b80a56d3c1cded25f2b2387f2668 (diff)
PrIM -- first commit
Diffstat (limited to 'BS/baselines/gpu/run.py')
-rw-r--r--BS/baselines/gpu/run.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/BS/baselines/gpu/run.py b/BS/baselines/gpu/run.py
new file mode 100644
index 0000000..58963b9
--- /dev/null
+++ b/BS/baselines/gpu/run.py
@@ -0,0 +1,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))