Skip to main content

A tqdm-compatible progress bar implementation for numba functions

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numba_progress-1.1.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

numba_progress-1.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file numba_progress-1.1.3.tar.gz.

File metadata

  • Download URL: numba_progress-1.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for numba_progress-1.1.3.tar.gz
Algorithm Hash digest
SHA256 4cbdb99f911725c195711e0a0b06e5c89c8ef1126388798779619e11f07b114f
MD5 8d681ca312a584dd6a2220b9d0b6cd72
BLAKE2b-256 40dd105af1a9bab618a57ea0748f6a1169de9887953ba1de511daab9083469db

See more details on using hashes here.

File details

Details for the file numba_progress-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: numba_progress-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for numba_progress-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c06450bb7ef99454d6d3df04a8b26ccc4cc8be5c6e6f5cfdc98badb2d86233f8
MD5 efbf1b04e5dc1612869da1a77ea09a18
BLAKE2b-256 62ec0eba33f08e3f83d75ab5cabae7ed60025504b277156ec899beab804f8c18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page