Skip to main content

A python package for running parallel experiments across parameter grids with MPI.

Project description

Read the Docs tests codecov Ruff GitHub License

A python package for running parallel experiments across parameter grids with MPI.

Features

  • Flexible Experimentation with Parameter Grids: SweepExp simplifies running experiments over a grid of parameter combinations. Results are stored in an xarray dataset for easy access and analysis.
  • Parallelization: Support for parallelization using multiprocessing, or MPI for high-performance computing.
  • User-Friendly API: Define the function to be tested, set up parameter sweeps, and specify return types effortlessly.

Installation

SweepExp can be installed via pip:

pip install sweepexp

Usage

The followin example shows how to setup a simple experiment that is run on a grid of parameters. Where each parameter combination is run in parallel on separate processes.

from sweepexp import SweepExpParallel

# Define a function to be tested
def my_custom_experiment(x: float, y: float) -> dict:
    """Add and multiply two numbers."""
    return {"addition": x + y, "multiplication": x * y}

sweep = SweepExpParallel(
    func = my_custom_experiment,
    parameters = { "x": [1, 2], "y": [3, 4, 5] },
    return_values = { "addition": float, "multiplication": float },
)

sweep.run()

print(sweep.data)

with the output:

<xarray.Dataset> Size: 160B
Dimensions:         (x: 2, y: 3)
Coordinates:
    * x               (x) int64 16B 1 2
    * y               (y) int64 24B 3 4 5
Data variables:
    status          (x, y) <U1 24B 'C' 'C' 'C' 'C' 'C' 'C'
    addition        (x, y) float64 48B 4.0 5.0 6.0 5.0 6.0 7.0
    multiplication  (x, y) float64 48B 3.0 4.0 5.0 6.0 8.0 10.0

For more information on how to use the package, please refer to the documentation

Author

License

SweepExp is licensed under the MIT License. See LICENSE for more information.

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

sweepexp-1.0.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

sweepexp-1.0.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file sweepexp-1.0.0.tar.gz.

File metadata

  • Download URL: sweepexp-1.0.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sweepexp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 73b55894c9faadf07a33d58eed8236de5323893a0af77a9fa07ceba32ca3f674
MD5 101cab7b0981c4f92b44f4afad032707
BLAKE2b-256 f9e8b95158e66144c737564c56be2d014896ce54aff3bc2d4edbdb3f6ed91c51

See more details on using hashes here.

Provenance

The following attestation bundles were made for sweepexp-1.0.0.tar.gz:

Publisher: publish-to-test-pypi.yml on Gordi42/sweepexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sweepexp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sweepexp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sweepexp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a89c4708d249b63faec950ab14d28a79fc21b5bd44efca2d030fdf6495ce7fb
MD5 d5aa21925485bb34bf3f254826d80071
BLAKE2b-256 cb3557a2e03dc38b220b79d63ae0cc75ed16a76a090fd5dc9b4d6f45eb9fc03a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sweepexp-1.0.0-py3-none-any.whl:

Publisher: publish-to-test-pypi.yml on Gordi42/sweepexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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