Skip to main content

A lightweight wrapper that scaffolds PyTorch's Distributed (Data) Parallel.

Project description

DDPW

Distributed Data Parallel Wrapper (DDPW) is a lightweight Python wrapper relevant to PyTorch users.

DDPW handles basic logistical tasks such as creating threads on GPUs/SLURM nodes, setting up inter-process communication, etc., and provides simple, default utility methods to move modules to devices and get dataset samplers, allowing the user to focus on the main aspects of the task. It is written in Python 3.12. The documentation contains details on how to use this package.

Overview

Installation

PyPI

# with uv

# to instal and add to pyroject.toml
uv add [--active] ddpw
# or to simply instal
uv pip install ddpw

# with pip
pip install ddpw

Examples

With the decorator wrapper

from ddpw import Platform, wrapper

platform = Platform(device="gpu", n_cpus_per_node=32, mem_per_node=64, n_gpus_per_node=4, verbose=True)

@wrapper(platform)
def run(*args, **kwargs):
    # global and local ranks, and the process group in:
    # kwargs['global_rank'], # kwargs['local_rank'], kwargs['group']
    pass

if __name__ == '__main__':
    run(*args, **kwargs)

As a callable

from ddpw import Platform, Wrapper

# some task
def run(*args, **kwargs):
    # global and local ranks, and the process group in:
    # kwargs['global_rank'], # kwargs['local_rank'], kwargs['group']
    pass

if __name__ == '__main__':
    # platform (e.g., 4 GPUs)
    platform = Platform(device='gpu', n_gpus_per_node=4)

    # wrapper
    wrapper = Wrapper(platform=platform)

    # start
    wrapper.start(task, *args, **kwargs)

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

ddpw-6.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

ddpw-6.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file ddpw-6.1.0.tar.gz.

File metadata

  • Download URL: ddpw-6.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ddpw-6.1.0.tar.gz
Algorithm Hash digest
SHA256 299b6dc95533c3fc7c8c00e4684d5828606a0dbfdcc785dd904b26f8df0d1393
MD5 c53208cdc02aeb1194a01b67ad26dda5
BLAKE2b-256 671744dde51b177180b7a04e55915048f8f07f6aa91f43e3cf533b76ac01d285

See more details on using hashes here.

File details

Details for the file ddpw-6.1.0-py3-none-any.whl.

File metadata

  • Download URL: ddpw-6.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ddpw-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be911dcda9e746eb80bec66ead5414710bf4c3c231218b006b004143cb3f259e
MD5 cf8a6091ffb9dbe1f8397cf3e8df31b4
BLAKE2b-256 d5cf482e7a873505097cca94bc0f390d1ff8e54d54bdf55beb971a608ce27d9f

See more details on using hashes here.

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