All Projects → swansonk14 → P_tqdm

swansonk14 / P_tqdm

Licence: mit
Parallel processing with progress bars

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to P tqdm

Bashful
Use a yaml file to stitch together commands and bash snippits and run them with a bit of style. Why? Because your bash script should be quiet and shy-like (...and not such a loud mouth).
Stars: ✭ 1,018 (+422.05%)
Mutual labels:  parallel-processing, progress-bar
Lkawavecircleprogressbar
一款带有双波浪动画的圆形进度指示器
Stars: ✭ 175 (-10.26%)
Mutual labels:  progress-bar
Accelerator
The Accelerator is a tool for fast and reproducible processing of large amounts of data.
Stars: ✭ 137 (-29.74%)
Mutual labels:  parallel-processing
Progress Bar.sh
Simple & sexy progress bar for `bash`, give it a duration and it will do the rest.
Stars: ✭ 155 (-20.51%)
Mutual labels:  progress-bar
Radialprogressbar
Radial ProgressBar inspired by Apple Watch OS. It is highly Customisable
Stars: ✭ 141 (-27.69%)
Mutual labels:  progress-bar
Future.apply
🚀 R package: future.apply - Apply Function to Elements in Parallel using Futures
Stars: ✭ 159 (-18.46%)
Mutual labels:  parallel-processing
Tmtoolkit
Text Mining and Topic Modeling Toolkit for Python with parallel processing power
Stars: ✭ 135 (-30.77%)
Mutual labels:  parallel-processing
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+1407.69%)
Mutual labels:  progress-bar
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-11.28%)
Mutual labels:  progress-bar
Ffpb
A progress bar for ffmpeg. Yay !
Stars: ✭ 149 (-23.59%)
Mutual labels:  progress-bar
Pyexpool
Python Multi-Process Execution Pool: concurrent asynchronous execution pool with custom resource constraints (memory, timeouts, affinity, CPU cores and caching), load balancing and profiling capabilities of the external apps on NUMA architecture
Stars: ✭ 149 (-23.59%)
Mutual labels:  parallel-processing
Next Nprogress
Next.js HOC to integrate NProgress inside your app
Stars: ✭ 145 (-25.64%)
Mutual labels:  progress-bar
Ascii Progress
🍓 Ascii progress-bar(s) in the terminal.
Stars: ✭ 167 (-14.36%)
Mutual labels:  progress-bar
Spring Boot Data Aggregator
基于注解实现并行地依赖注入(数据聚合),可以看做 Spring Async 注解的升级版
Stars: ✭ 142 (-27.18%)
Mutual labels:  parallel-processing
Liquid progress indicator
A liquid progress indicator for Flutter
Stars: ✭ 176 (-9.74%)
Mutual labels:  progress-bar
Pygmo2
A Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
Stars: ✭ 134 (-31.28%)
Mutual labels:  parallel-processing
Progresshud
ProgressHUD is a lightweight and easy-to-use HUD for iOS.
Stars: ✭ 2,045 (+948.72%)
Mutual labels:  progress-bar
Gif Progress
🎬 Attach progress bar to animated GIF
Stars: ✭ 156 (-20%)
Mutual labels:  progress-bar
Materialprogressbar
Material Design ProgressBar with consistent appearance
Stars: ✭ 2,145 (+1000%)
Mutual labels:  progress-bar
Hgcircularslider
A custom reusable circular / progress slider control for iOS application.
Stars: ✭ 2,240 (+1048.72%)
Mutual labels:  progress-bar

p_tqdm

PyPI - Python Version PyPI version Build Status

p_tqdm makes parallel processing with progress bars easy.

p_tqdm is a wrapper around pathos.multiprocessing and tqdm. Unlike Python's default multiprocessing library, pathos provides a more flexible parallel map which can apply almost any type of function --- including lambda functions, nested functions, and class methods --- and can easily handle functions with multiple arguments. tqdm is applied on top of pathos's parallel map and displays a progress bar including an estimated time to completion.

Installation

pip install p_tqdm

Example

Let's say you want to add two lists element by element. Without any parallelism, this can be done easily with a Python map.

l1 = ['1', '2', '3']
l2 = ['a', 'b', 'c']

def add(a, b):
    return a + b
    
added = map(add, l1, l2)
# added == ['1a', '2b', '3c']

But if the lists are much larger or the computation is more intense, parallelism becomes a necessity. However, the syntax is often cumbersome. p_tqdm makes it easy and adds a progress bar too.

from p_tqdm import p_map

added = p_map(add, l1, l2)
# added == ['1a', '2b', '3c']
  0%|                                    | 0/3 [00:00<?, ?it/s]
 33%|████████████                        | 1/3 [00:01<00:02, 1.00s/it]
 66%|████████████████████████            | 2/3 [00:02<00:01, 1.00s/it]
100%|████████████████████████████████████| 3/3 [00:03<00:00, 1.00s/it]

p_tqdm functions

Parallel maps

  • p_map - parallel ordered map
  • p_imap - iterator for parallel ordered map
  • p_umap - parallel unordered map
  • p_uimap - iterator for parallel unordered map

Sequential maps

  • t_map - sequential ordered map
  • t_imap - iterator for sequential ordered map

p_map

Performs an ordered map in parallel.

from p_tqdm import p_map

def add(a, b):
    return a + b

added = p_map(add, ['1', '2', '3'], ['a', 'b', 'c'])
# added = ['1a', '2b', '3c']

p_imap

Returns an iterator for an ordered map in parallel.

from p_tqdm import p_imap

def add(a, b):
    return a + b

iterator = p_imap(add, ['1', '2', '3'], ['a', 'b', 'c'])

for result in iterator:
    print(result) # prints '1a', '2b', '3c'

p_umap

Performs an unordered map in parallel.

from p_tqdm import p_umap

def add(a, b):
    return a + b

added = p_umap(add, ['1', '2', '3'], ['a', 'b', 'c'])
# added is an array with '1a', '2b', '3c' in any order

p_uimap

Returns an iterator for an unordered map in parallel.

from p_tqdm import p_uimap

def add(a, b):
    return a + b

iterator = p_uimap(add, ['1', '2', '3'], ['a', 'b', 'c'])

for result in iterator:
    print(result) # prints '1a', '2b', '3c' in any order

t_map

Performs an ordered map sequentially.

from p_tqdm import t_map

def add(a, b):
    return a + b

added = t_map(add, ['1', '2', '3'], ['a', 'b', 'c'])
# added == ['1a', '2b', '3c']

t_imap

Returns an iterator for an ordered map to be performed sequentially.

from p_tqdm import p_imap

def add(a, b):
    return a + b

iterator = t_imap(add, ['1', '2', '3'], ['a', 'b', 'c'])

for result in iterator:
    print(result) # prints '1a', '2b', '3c'

Shared properties

Arguments

All p_tqdm functions accept any number of iterables as input, as long as the number of iterables matches the number of arguments of the function.

To repeat a non-iterable argument along with the iterables, use Python's partial from the functools library. See the example below.

from functools import partial

l1 = ['1', '2', '3']
l2 = ['a', 'b', 'c']

def add(a, b, c=''):
    return a + b + c

added = p_map(partial(add, c='!'), l1, l2)
# added == ['1a!', '2b!', '3c!']

CPUs

All the parallel p_tqdm functions can be passed the keyword num_cpus to indicate how many CPUs to use. The default is all CPUs. num_cpus can either be an integer to indicate the exact number of CPUs to use or a float to indicate the proportion of CPUs to use.

Note that the parallel Pool objects used by p_tqdm are automatically closed when the map finishes processing.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].