Skip to main content

Atomic, asynchronous checkpoint saving for Pytorch for Slurm/Lustre environments

Project description

torch-atomic-save

Pytest License: MIT

An asynchronous, atomic checkpointing utility for PyTorch, optimized for Slurm and Lustre/NFS environments.

Key Features

  • Atomic Moves: Prevents corrupted checkpoints during Slurm preemption.
  • Non-Blocking: Offloads I/O to a background thread pool.
  • Race Condition Protection: Automatically clones tensors to CPU before background saving.
  • Cross-FS Support: Handles moves between local SSD and network storage safely.

Installation

pip install torch-atomic-save

Usage

from torch_atomic_save import SlurmAtomicManager

# Initialize the manager
manager = SlurmAtomicManager(max_workers=4)

# In your training loop:
if epoch % save_interval == 0:
    manager.save(model, "path/to/checkpoints/model.pt", tmp_dir="/scratch/user/tmp")

# Ensure all I/O is finished before exiting
manager.wait_for_all()

Attribution

If you use this software in your research, please cite it using the "Cite this repository" button or the provided CITATION.cff.

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

torch_atomic_save-0.1.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

torch_atomic_save-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file torch_atomic_save-0.1.2.tar.gz.

File metadata

  • Download URL: torch_atomic_save-0.1.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for torch_atomic_save-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f9deed4c9bbf4ae18f050332891fd5243f6000e0d8273b5af3274d29fa4aaddb
MD5 e9fb81231d888e2b09b79135097a6b6d
BLAKE2b-256 f40c242ea888d3d3e913c198898bb614d017861422625fb040f0a94935cedda2

See more details on using hashes here.

File details

Details for the file torch_atomic_save-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for torch_atomic_save-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d84461a6350db6b376195d59d3c2e50ae26a15063eca44614a1a456483eeda55
MD5 34afa8556b47384fc3dc18e7757fe8d8
BLAKE2b-256 93ce39e924183ddb8e55c4d04b55cb376661bc64051908ea033880f8a85b628f

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