-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from mortacious/feature/progress_bar_type
Accessible numba type for the ProgressBar class
- Loading branch information
Showing
6 changed files
with
64 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from sleep import clock, usleep | ||
|
||
import numba as nb | ||
|
||
@nb.njit(nogil=True) | ||
def numba_clock(): | ||
c1 = clock() | ||
print("c1", c1) | ||
usleep(1000000) | ||
c2 = clock() | ||
print("c2", c2) | ||
print("time", c2-c1) | ||
|
||
if __name__ == "__main__": | ||
numba_clock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# example code to use the progressbar with an explicit signature | ||
|
||
from sleep import usleep | ||
import numba as nb | ||
from numba_progress import ProgressBar, ProgressBarType | ||
|
||
|
||
@nb.njit(nb.void(nb.uint64, nb.uint64, ProgressBarType), nogil=True) | ||
def numba_sleeper(num_iterations, sleep_us, progress_hook): | ||
for i in range(num_iterations): | ||
usleep(sleep_us) | ||
progress_hook.update(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
num_iterations = 30 | ||
sleep_time_us = 250_000 | ||
with ProgressBar(total=num_iterations, ncols=80) as numba_progress: | ||
numba_sleeper(num_iterations, sleep_time_us, numba_progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .progress import ProgressBar | ||
from .progress import * | ||
from ._version import __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.4" | ||
__version__ = "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters