# Compute

> Run training and evaluation jobs on GPUs by the minute from the div CLI, with a spend limit in dollars.

## What it is

Compute runs a job on one or more GPUs until the job exits. You start it from your code's directory with `div run`. `div` uploads the directory, starts the run, streams its log, and exits with the run's exit code.

A run ends when its command exits, when you stop it, when it reaches its `--max-spend` limit, or after 24 hours. For a Linux machine that you keep and reuse, use a [sandbox](https://docs.divergentlabs.xyz/sandboxes.md) instead.

## What it costs

Runs are billed per minute, with a one-minute minimum, from the org's credit. A plan's included usage is spent first. Each plan sets how many GPUs the org holds at once: 1 on pay as you go, 4 on Personal, and 8 on Team. See [`div limits`](https://docs.divergentlabs.xyz/compute/cli/limits.md#compute-limits).

| GPU | Per hour, per GPU |
| --- | --- |
| `b300` | $8.30 |
| `h200` | $5.45 |
| `h100` | $4.80 |
| `l40s` | $2.55 |
| `cpu` (no GPU) | $0.30 |

Each GPU includes 1 CPU core and 8 GiB of memory. Extra cores cost $0.15 an hour each and extra memory $0.03 per GiB an hour. [`div catalog`](https://docs.divergentlabs.xyz/compute/cli/catalog.md) prints the current prices.

## Quickstart

1. Install `div`:

   ```bash
   curl -fsSL https://div.io/install.sh | sh
   ```

2. Sign in. The command opens the dashboard in your browser. Approve the request if the code on the page matches the code in the terminal.

   ```bash
   div login
   ```

3. From your code's directory, start a run on one H100 with a $5 spend limit:

   ```bash
   cd ~/very-cool-classifier
   div run --gpu h100 train.py::run --max-spend 5.00
   ```

   The output looks like this:

   ```text
   Created project very-cool-classifier.
   14 files, 38.2 KB → very-cool-classifier-code/code/9f31c2ab
   run-k4t9  H100  $4.80/h  max spend $5.00 (about 1h 2m)
   ...your program's output...
   run-k4t9 finished in 12m 40s and spent $1.05
   ```

   The third line shows the hourly rate and how long the spend limit lasts at that rate. `div` writes its own lines to stderr and your program's output to stdout.

4. Check what is running and stop it:

   ```bash
   div runs --status active
   div stop run-k4t9
   ```

## Next steps

- [Keep data and checkpoints on a volume](https://docs.divergentlabs.xyz/compute/guides/volumes.md)
- [Report a run's metrics and check them](https://docs.divergentlabs.xyz/compute/guides/results.md)
- [Use div in scripts and CI](https://docs.divergentlabs.xyz/compute/scripting.md)
- [Connect an agent with the MCP server](https://docs.divergentlabs.xyz/compute/mcp.md)

## Commands

| Command | Description |
| --- | --- |
| [`div login`](https://docs.divergentlabs.xyz/compute/cli/login.md) | Sign this machine in and save an API key. |
| [`div whoami`](https://docs.divergentlabs.xyz/compute/cli/whoami.md) | Show the org, API key and API URL in use. |
| [`div run`](https://docs.divergentlabs.xyz/compute/cli/run.md) | Start a run and stream its log. |
| [`div logs`](https://docs.divergentlabs.xyz/compute/cli/logs.md) | Print or follow a run's log. |
| [`div result`](https://docs.divergentlabs.xyz/compute/cli/result.md) | Print a run's result JSON, or one value from it. |
| [`div telemetry`](https://docs.divergentlabs.xyz/compute/cli/telemetry.md) | Print the metrics a run recorded. |
| [`div eval`](https://docs.divergentlabs.xyz/compute/cli/eval.md) | Measure a model version and rank it. |
| [`div model`](https://docs.divergentlabs.xyz/compute/cli/model.md) | Publish and list model versions. |
| [`div runs`](https://docs.divergentlabs.xyz/compute/cli/runs.md) | List the org's runs. |
| [`div stop`](https://docs.divergentlabs.xyz/compute/cli/stop.md) | Stop a run. |
| [`div storage`](https://docs.divergentlabs.xyz/compute/cli/storage.md) | List, upload and download files on a volume. |
| [`div secrets`](https://docs.divergentlabs.xyz/compute/cli/secrets.md) | Set, list and delete secrets. |
| [`div papers`](https://docs.divergentlabs.xyz/compute/cli/papers.md) | Search and read arXiv papers. |
| [`div catalog`](https://docs.divergentlabs.xyz/compute/cli/catalog.md) | List GPU types and prices. |
| [`div limits`](https://docs.divergentlabs.xyz/compute/cli/limits.md) | Show usage against the plan's limits. |
| [`div dashboard`](https://docs.divergentlabs.xyz/compute/cli/dashboard.md) | Open the dashboard. |
| [`div upgrade`](https://docs.divergentlabs.xyz/compute/cli/upgrade.md) | Install, upgrade or pin a `div` version. |
