Skip to main content

ray-vast

(work in progress)

Run a Ray cluster with the head on AWS EC2 and GPU workers on vast.ai.

  • The Ray head runs on one EC2 instance in your AWS account.
  • The Ray autoscaler rents GPU workers from vast.ai when your jobs need them, and removes them when they are idle.
  • The workers talk to the head over the public internet, across NAT, with TLS and a token.
  • You do not need a VPN or an overlay network.

Documentation: https://duc-ph.github.io/ray-vast/

Why

  • vast.ai has cheap GPUs. But a vast instance can stop at any time, and its IP can change.
  • ray-vast keeps the head on EC2, so the cluster stays up. Only workers come and go.
  • You keep the normal Ray workflow. Only the cluster commands change.
  • A worker that loses the head destroys its own instance. You do not pay for lost workers.

Install

pip install ray-vast "ray[default]==2.59.*"

The Ray pin keeps Ray on your laptop at the same version as Ray in the cluster image. ray-vast is tested with Ray 2.59.

The CLI is tested on Linux. macOS is not tested. You need Python 3.10 or later, an AWS profile, the IAM policy ray-vast-head-boundary in your AWS account (a one-time step), and a vast.ai API key. Details: Getting started.

Quick start

Copy an example cluster YAML (gpu-24gb.yaml, gpu-80gb.yaml or cpu-heavy.yaml in ray_vast/examples/). Set the region of the head (node_config.region of the head node type) and the budget (max_dollars_per_hour). up makes an SSH key for the cluster.

ray-vast up cluster.yaml --profile my-aws-profile
ray-vast dashboard cluster.yaml   # keep this terminal open; uses the profile that up saved

In a second terminal, run the export line that dashboard printed, and submit a job:

export RAY_AUTH_MODE=token RAY_AUTH_TOKEN_PATH=...     # the line that dashboard printed
ray job submit --address http://127.0.0.1:8265 --working-dir . -- python train.py

When you finish:

ray-vast down cluster.yaml
Plain Ray ray-vast
ray up ray-vast up
ray dashboard ray-vast dashboard
ray down ray-vast down

Some ray cluster commands do not work. Read limits. Use --working-dir and runtime_env to send code to the cluster.

Ray libraries

Each library page shows how to run your work. It also gives the settings that keep a worker in its process limit.

Library One worker Many workers Notes
Ray Core ✅ ✅
Ray Jobs ✅ ✅
Ray Data 🟨 🟨 Write the output to S3. A local output path stays on each worker.
Ray Train 🟨 ❌ Use S3 storage for checkpoints. DDP across workers fails behind the NAT of vast: use one worker with many GPUs.
Ray Tune 🟨 🟨 Use S3 storage for checkpoints.
Ray Serve ✅ ✅
RLlib ✅ 🟨 Put all learners on one worker. Learners across workers fail behind the NAT of vast.

✅ works (the process settings on its page do not lower the mark). 🟨 works with an extra change, or a part fails. ❌ the main use fails.

Documentation

Status

Version 0.2.0. Tested with Ray 2.59.

Contributing

Read CONTRIBUTING.md for the tests and the docs build.

License

MIT. See LICENSE.

Metadata

Release files for ray-vast 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ray-vast 0.2.0
File Size Uploaded Provenance
ray_vast-0.2.0.tar.gz 275.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ray-vast 0.2.0
File Interpreter ABI Platform
ray_vast-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 339.0 kB

Release files / ray_vast-0.2.0.tar.gz

Download URL ray_vast-0.2.0.tar.gz
Size 275.8 kB
Tags Source
SHA-256 checksum
How to use checksums
410c8731fe984f9f02b17a7c7412352815df3e65c536f073bd7236a770d11baf
BLAKE2b-256 checksum
How to use checksums
daa1dda42f6de08b1b48cf49e75297ec7c0905feebb5d3a49980130530a6965e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / ray_vast-0.2.0-py3-none-any.whl

Download URL ray_vast-0.2.0-py3-none-any.whl
Size 63.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52e2a2dd775212f345dde61273a60b91f657886421a8f4aebb315f8d52e9e4db
BLAKE2b-256 checksum
How to use checksums
4793eb6de0dd297cd22aa936493834225c1a6973dbf7881373e28844f2b083f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for ray-vast 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page