numba-progress

1.1.3last stable release 1 month ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
15
Weekly Downloadsglobal
1,607

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

Numba-progress

A progress bar implementation for numba functions using tqdm. The module provides the class ProgressBar that works as a wrapper around the tqdm.tqdm progress bar.

It works by spawning a separate thread that updates the tqdm progress bar based on an atomic counter which can be accessed and updated in a numba nopython function.

The progress bar works with parallel as well as sequential numba functions.

Installation

Using pip

pip install numba-progress

From source

git clone https://github.com/mortacious/numba-progress.git
cd numba-progress
python setup.py install

Usage

from numba import njit
from numba_progress import ProgressBar

num_iterations = 100

@njit(nogil=True)
def numba_function(num_iterations, progress_proxy):
    for i in range(num_iterations):
        #<DO CUSTOM WORK HERE>
        progress_proxy.update(1)

with ProgressBar(total=num_iterations) as progress:
    numba_function(num_iterations, progress)

The ProgressBar also works within parallel functions out of the box:

from numba import njit, prange
from numba_progress import ProgressBar

num_iterations = 100

@njit(nogil=True, parallel=True)
def numba_function(num_iterations, progress_proxy):
    for i in prange(num_iterations):
        #<DO CUSTOM WORK HERE>
        progress_proxy.update(1)

with ProgressBar(total=num_iterations) as progress:
    numba_function(num_iterations, progress)

Refer to the examples folder for more usage examples.

Dependencies

CVE IssuesActive
0
Scorecards Score
4.60
Test Coverage
No Data
Follows Semver
Yes
Github Stars
43
Dependenciestotal
3
DependenciesOutdated
0
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute numba-progress in your own private PyPI registry

pip install numba-progress
Processing...
Done

8 Releases

PyPI on Cloudsmith

Getting started with PyPI on Cloudsmith is fast and easy.