> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compute.cx/llms.txt
> Use this file to discover all available pages before exploring further.

# First run

> Dry-run a tiny MLP, then execute it on RunPod Secure H100-SXM.

Public self-service leads with **H100-SXM**. `--gpu H100` maps to that SKU.

## 1. Add credit

```bash theme={null}
compute credits add 10
```

Minimum top-up is **\$10**. Complete Checkout in the browser, then:

```bash theme={null}
compute credits
```

The balance updates after the payment webhook, not at the moment the Checkout tab opens. See [Credits](/cli/credits).

## 2. Write a function

Save as `simple_mlp.py`:

```python theme={null}
import compute

app = compute.App("simple-mlp")
image = compute.Image.cuda_pytorch()


@app.function(gpu="H100-80GB", image=image, timeout=600)
def train(steps: int = 40, hidden: int = 32, seed: int = 0) -> dict:
    import torch
    import torch.nn as nn

    torch.manual_seed(seed)
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model = nn.Sequential(
        nn.Linear(16, hidden),
        nn.ReLU(),
        nn.Linear(hidden, 2),
    ).to(device)
    opt = torch.optim.Adam(model.parameters(), lr=1e-3)
    loss_fn = nn.CrossEntropyLoss()
    x = torch.randn(256, 16, device=device)
    y = (x.sum(dim=1) > 0).long()
    last = None
    for _ in range(steps):
        opt.zero_grad()
        last = loss_fn(model(x), y)
        last.backward()
        opt.step()
    return {
        "ok": True,
        "compat": "mlp",
        "device": str(device),
        "cuda": bool(torch.cuda.is_available()),
        "steps": steps,
        "loss": float(last.detach()),
        "torch": torch.__version__,
    }
```

`gpu="H100-80GB"` is the same SKU as `H100-SXM`. Arguments and the return value must be JSON.

## 3. See what would ship

```bash theme={null}
compute run simple_mlp.py::train --gpu H100-SXM --dry-run
```

The dry run prints the file set and manifest. Nothing is uploaded. No machine is created.

## 4. Run it

```bash theme={null}
compute run simple_mlp.py::train --gpu H100-SXM --wait --yes --args '{"steps": 40, "seed": 20260814}'
```

* `--wait` streams status (and logs when present) until a terminal state.
* Without `--wait`, the CLI exits after create; use `compute logs <run_id> -f` later.
* `--yes` skips the interactive price confirmation.

When it succeeds you get JSON back. Then:

```bash theme={null}
compute runs receipt <run_id>
compute machines
```

`compute machines` should be empty after teardown. That is the product: one run, one machine, then gone.

## If create is refused

A new run can be refused by the account's one-active-run, spend, or create-rate limits, or by provider availability, even with a positive balance. `compute doctor --json` and the error body include a request id — send that to [Support](/support).
