Quickstart#
1. Install and sign in#
pip install https://runcompute.cloud/sdk/runcompute-0.2.0-py3-none-any.whl
runcompute login
Requires Python 3.10 or newer. Job files (runcompute.toml) need 3.11 or newer.
runcompute login asks for an API key. Create one in the console
by entering your email address, then paste it into the terminal. The key is
saved to ~/.runcompute/credentials.json and the Python client picks it up
without extra setup. No payment method is needed during the preview.
2. Check the price first#
Ask what a job would cost before you submit it. This needs no key.
import runcompute
client = runcompute.Client()
for offer in client.quote(min_vram=24, work_units=4)[:3]:
print(offer["gpu"], offer["provider"], offer["est_hours"], offer["est_cost"])
RTX4090 Vast 7.27 2.72
L4 GCP 11.43 3.42
A6000 RunPod 8.0 4.16
work_units is how much compute the job needs, measured in A100-hours. A job
that takes 4 hours on one A100 is 4 work units. Slower GPUs take longer for
the same work.
3. Run your first job#
Save this as first_job.py:
import runcompute
with runcompute.Client() as client:
job = client.run(
name="smoke-test",
image="pytorch/pytorch:latest",
command=["python", "-c", "import torch; print(torch.cuda.get_device_name(0))"],
min_vram=16,
work_units=0.5,
budget=5,
)
print("Job:", job.id)
done = job.wait()
print(done.status.value, f"${done.spend:.2f}")
if not done.succeeded:
raise SystemExit(f"{done.id} ended as {done.status.value}")
print(done.logs(tail=10))
Run it with python first_job.py. While it waits, each lifecycle event is
printed: the machine it was placed on, checkpoints, preemptions and the move to
a new machine.
run() returns as soon as the job is accepted. wait() returns when the job
reaches a final status, so check succeeded before using its outputs. Pressing
Ctrl+C during wait() cancels the job.
Next#
- Describe the job in a file instead of Python.
- Save checkpoints so a preempted job resumes.
- Set a budget you are comfortable with.