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.0.tar.gz (9.2 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.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torch_atomic_save-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b545a66d4fdf371091c63befe55ad2672f5af6a2cf543cdc02cdbb4a9d05eb4
MD5 a0ef3ff21b8092bae1b13365429b438b
BLAKE2b-256 85914a74c3165b18ee110e9979ec15d709bdf91b8ea02516b2d6ed9f0acd423e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torch_atomic_save-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e059af8f894d5d4f14d99902c7c0bac291146ee481f13dc7c7f7142466814505
MD5 50bda6689f118cf2e3ca2dcf7246b901
BLAKE2b-256 703f134c11e93e99312fb356479952c859f1fb3de61f472a4ab31c3c644f29f9

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