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.2.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: numba_progress-1.2.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for numba_progress-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c6189119ae901ad106b0cae3796319024d20bbbb3b7ae027b9bfcb08802585a8
MD5 5d8d53493485fe564c97ef56e220f9ab
BLAKE2b-256 a2ae3f8e5e757badaf8e2fe6c596f183c6709c4e7af51cd4bdcbaec61c2c27ca

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for numba_progress-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9404c437d55f6454d907ebad28717baf64593405c68446675c1d0d10c833b21f
MD5 980ed7e39311d46a56a0da4052560b15
BLAKE2b-256 ec4f71b6d8605d46fdf629f0e3f595a6bfd50ad6b731550cbd70ef79d0e3b692

See more details on using hashes here.

Supported by

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