Skip to main content

No project description provided

Project description

nshrunner

nshrunner is a Python library that provides a unified way to run functions in various environments, such as local dev machines, cloud VMs, SLURM clusters, and LSF clusters. It was created to simplify the process of running ML training jobs across multiple machines and environments.

Motivation

When running ML training jobs on different machines and environments, it can be challenging to manage the specifics of each environment. nshrunner was developed to address this issue by providing a single function that can be used to run jobs on any supported environment without having to worry about the details of each environment.

Features

  • Supports running functions locally, on SLURM clusters, and on LSF clusters
  • Provides a unified interface for running functions across different environments
  • Allows for easy configuration of job options, such as resource requirements and environment variables
  • Supports snapshotting the environment to ensure reproducibility, using the nshsnap library
  • Provides utilities for logging, seeding, and signal handling

Installation

nshrunner can be installed using pip:

pip install nshrunner

Usage

Here's a simple example of how to use nshrunner to run a function locally:

import nshrunner as R

def run_fn(x: int):
    return x + 5

runs = [(1,)]

runner = R.Runner(run_fn)
list(runner.local(runs))

To run the same function on a SLURM cluster:

runner.submit_slurm(
    runs,
    {
        "partition": "learnaccel",
        "nodes": 4,
        "ntasks_per_node": 8,  # Change this to limit # of GPUs
        "gpus_per_task": 1,
        "cpus_per_task": 1,
    },
    snapshot=True,
)

And on an LSF cluster:

runner.submit_lsf(
    runs,
    {
        "summit": True,
        "queue": "learnaccel",
        "nodes": 4,
        "rs_per_node": 8,  # Change this to limit # of GPUs
    },
    snapshot=True,
)

For more detailed usage examples, please refer to the documentation.

Acknowledgements

nshrunner is heavily inspired by submitit. It builds on submitit's design and adds support for LSF clusters, snapshotting, and other features.

Contributing

Contributions are welcome! For feature requests, bug reports, or questions, please open an issue on GitHub. If you'd like to contribute code, please submit a pull request with your changes.

License

nshrunner is released 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

nshrunner-0.14.4.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

nshrunner-0.14.4-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file nshrunner-0.14.4.tar.gz.

File metadata

  • Download URL: nshrunner-0.14.4.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-39-generic

File hashes

Hashes for nshrunner-0.14.4.tar.gz
Algorithm Hash digest
SHA256 513eccbc420fb937a899d11fed40f7ea65a83c700bc3a6b8e4e66e8a179a0a77
MD5 28a735835653db248b3f0b784b12433f
BLAKE2b-256 9e794a6b0dbe06663b5ea294e61413eed1ef47f34029d1da7238b4d43c01261b

See more details on using hashes here.

File details

Details for the file nshrunner-0.14.4-py3-none-any.whl.

File metadata

  • Download URL: nshrunner-0.14.4-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-39-generic

File hashes

Hashes for nshrunner-0.14.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1ee994e1d4c27cf7f8c797209c6fe0146e8faf90aa58c24f11300bec163c0c8b
MD5 9f7111a2ee2ca63d7add9346dadca008
BLAKE2b-256 8ca8e1a8f61e08991cb5bc07cac6d379b86907ee69a46f99898669246a43e2ab

See more details on using hashes here.

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