semvec/pypi-packages huggingface dataset:
pymulticore 0.1.7
A secure python library for parallelizing tasks across several CPU cores

# Warning, Not ready for use!!

# Parallel Processing Library

This Python library provides a set of functions for parallel processing. It includes functions for mapping, filtering, and reducing over iterable objects, as well as functions for computing statistical measures such as mean, variance, and standard deviation. The library also includes a function for measuring the execution time of other functions.

The library is designed to take advantage of multiple cores for increased performance. It uses the `joblib` library for parallelization, and the `numpy` library for efficient numerical computations.

## Installation

To install the library, use the install command `pip install pymulticore`.

## Usage

Here is an example of how to use the library:

```python
import pymulticore as pmc

# Define a function to apply
def square(x):
    return x**2

# Define an iterable
numbers = range(10)

# Apply the function in parallel
squares = pmc.map(square, numbers)

# Filter the results
large_squares = pmc.filter(lambda x: x > 10, squares)

# Compute the mean of the results
average_large_square = pmc.mean(large_squares)
```

## Functions

The library provides the following functions:

- `map(func, iterable, num_cores=None, log_time=False)`: Applies a function to all items in an iterable in parallel.
- `filter(func_bool, iterable, num_cores=None, log_time=False)`: Filters items in an iterable based on a boolean function, in parallel.
- `mean(iterable, num_cores=None, log_time=False)`: Computes the mean of an iterable, in parallel.
- `var(iterable, num_cores=None, log_time=False)`: Computes the variance of an iterable, in parallel.
- `std(iterable, num_cores=None, log_time=False)`: Computes the standard deviation of an iterable, in parallel.
- `cpu_count(only_physical_cores=False)`: Returns the number of CPU cores available.
- `measure_time(func, args=[], num_trials=1)`: Measures and returns the average execution time of a function over a given number of trials.

Each function takes an optional `num_cores` argument, which specifies the number of cores to use. If `num_cores` is not provided, the function will estimate the optimal number of cores. Each function also takes an optional `log_time` argument, which specifies whether to print the time taken to execute the function.

## Contributing

Contributions are welcome. Please submit a pull request with any improvements.