A Python parallel computing library
Project description
CPU-Heater
A Python parallel computing library.
Install
pip install cpu-heater
Usage
Multiprocessing:
import cpu_heater
def adder(x, y):
return x + y
def test_cpu_heater():
args_list = [(i, i) for i in range(114514)]
results = cpu_heater.multiprocess(adder, args_list, max_workers=8, show_progress=True, timeout=5)
assert sorted(results) == sorted([i + i for i in range(114514)])
Multithreading:
import cpu_heater
def adder(x, y):
return x + y
def test_cpu_heater():
args_list = [(i, i) for i in range(114514)]
results = cpu_heater.multithreads(adder, args_list, max_workers=8, show_progress=True)
assert sorted(results) == sorted([i + i for i in range(114514)])
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
cpu_heater-0.1.0.tar.gz
(14.8 kB
view hashes)
Built Distribution
cpu_heater-0.1.0-py3-none-any.whl
(14.9 kB
view hashes)
Close
Hashes for cpu_heater-0.1.0-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 40c4aa198cbfede87dfa33b52c7569ad4b0a04ff3a6fc081373b13e6faaf26fb |
|
| MD5 | 112dd6667fe0b5e55c4fb3601a2ede95 |
|
| BLAKE2b-256 | dcb52d00107317474be75894ac605b80897c2c5c0d0749b20c7636c23259afb3 |