A helper package to easily time Numba CUDA GPU events
Project description
Numba GPU Timer
A helper package to easily time Numba CUDA GPU events.
Compatibility
As this package uses Numba, refer to the Numba compatibility guide.
Installation
To use Pip: pip install gpu_timer
Or Conda: conda install gpu_timer
Example
from numba_timer import cuda_timer
def increment_by_one(an_array):
pos = cuda.grid(1)
if pos < an_array.size:
an_array[pos] += 1
an_array = [0, 1, 2]
threadsperblock = (16, 16)
blockspergrid_x = math.ceil(an_array.shape[0] / threadsperblock[0])
blockspergrid_y = math.ceil(an_array.shape[1] / threadsperblock[1])
blockspergrid = (blockspergrid_x, blockspergrid_y)
timer = cuda_timer.Timer()
timer.start()
increment_a_2D_array[blockspergrid, threadsperblock](an_array)
timer.stop()
print(f'Elapsed time: {timer.elapsed()} ms')
Numba specific code is borrowed from the Numba documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
numba_timer-0.1.0.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for numba_timer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b14b96e3f5512ab2c1b08b8019f6faeea468a8a7383b0b8714642191ef2bc0b3 |
|
MD5 | 13c5a2ddbe2319f5e3ac147c6b45a735 |
|
BLAKE2b-256 | 3c2c05ed5c282d2b244e11acf63d196c6f6863742b5afbda96e541beb5913181 |