Skip to main content

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)

Uploaded Source

Built Distribution

cpu_heater-0.1.0-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

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