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

# Server startup

> Recognize readiness, reuse compilation caches and diagnose a server that has not opened its port.

`mstar serve` prints its banner before the server can accept a request. Run this in another terminal. When the deployment is ready, it prints `{"status":"healthy"}`.

```bash theme={null}
curl -fsS http://localhost:8000/health
```

## Follow startup in the logs

1. The launcher resolves the deployment YAML and checks for a usable `mstar-server` binary.
2. The conductor validates the deployment and starts one worker per rank.
3. Workers load model weights, compile forwards and capture graphs for the configured shapes. `All workers ready` marks completion of worker setup.
4. The server runs any `warmup_requests`, then starts the HTTP frontend. Look for its listening address.

A refused connection is expected before the frontend binds. After binding, a 503 from `/health` indicates a problem with the serving process or its backend. Check the launcher and worker logs. [Health response details](https://docs.m-star.org/reference/http-api.md#health)

## Estimate startup time

On one H200, BAGEL at `-O1` took 516 seconds from launch to the first successful `/health` with downloaded weights and an empty compile cache. A restart with the compile cache warm took 68 seconds. Include storage and CPU allocation when setting startup timeouts.

## Choose a compile level

For a development restart, use `mstar serve qwen3_5_0.8b -O0`. `-O0` uses the default compiler mode, `-O1` enables coordinate-descent tuning, and `-O2` adds GEMM autotuning. A model can select its own compile mode for specific forwards. Each level has separate cache entries. With `mstar-serve`, set `MSTAR_COMPILE_LEVEL`. [CLI reference](https://docs.m-star.org/reference/cli.md#serve)

### Warm the request shapes clients will use

List representative requests under `warmup_requests` in the YAML. A request can set `text`, `files` (local or `hf://` paths), `output_modalities`, `model_kwargs` and `repeat`. A failed warmup logs an error and is skipped. Read the log and send one request for your actual workload before timing it.

```yaml theme={null}
warmup_requests:
  - text: Hello
    output_modalities: [text]
```

## Reuse compiled kernels

Keep these directories on writable persistent storage. The conductor logs the resolved Inductor and Triton paths at startup.

| Cache | Default location | Variable |
| - | - | - |
| Inductor graphs and autotune picks | `$XDG_CACHE_HOME/mstar/torchinductor` | `TORCHINDUCTOR_CACHE_DIR` |
| Triton kernels | `<Inductor cache>/triton` | `TRITON_CACHE_DIR` |
| FlashInfer JIT builds | `~/.cache/flashinfer` | `FLASHINFER_WORKSPACE_BASE` (default: home) |
| Weights | `$XDG_CACHE_HOME/huggingface` | `HF_HOME` |

`XDG_CACHE_HOME` defaults to `~/.cache`. In a container with a persistent `/cache` mount, set the paths before starting the server:

```bash theme={null}
export TORCHINDUCTOR_CACHE_DIR=/cache/torchinductor
export FLASHINFER_WORKSPACE_BASE=/cache
export HF_HOME=/cache/huggingface
mstar serve qwen3_5_0.8b
```

Use a separate compile cache for each GPU model and software stack. After a driver or `ptxas` change, choose a fresh cache or change `TORCH_COMPILE_CACHE_KEY_TAG`. On a shared filesystem, copy a matching warm cache to node-local storage at job start. Changing `HF_HOME` alone moves the weights, not the compiled kernels.

## Diagnose a failed start

| Symptom | Check |
| - | - |
| Unknown launch key, missing config, or deployment validation error | Use the exact catalog key and its [default YAML](https://docs.m-star.org/models.md#matrix). Match node names and rank count to the visible GPUs. |
| `mstar-server binary not found` or stale Rust extension | Check the active environment. A supported Linux wheel includes the binary and extension. In a checkout, build both from its current source. [Rust installation](https://docs.m-star.org/installation.md#rust) |
| Worker exits during setup | Read the preceding worker error. Check available GPU memory and `--gpus` against the configuration. |
| Snapshot or model file missing | Use the server’s `HF_HOME` and checkpoint access to complete the download before going offline. |
| HTTP bind failure or deployment lock held | Give each server a free port and its own socket prefix. A bind error can occur after the workers have loaded. |
| Startup goes quiet during compilation | First runs may spend minutes in compiler and kernel builds. Look for a fatal worker error or process exit before restarting. |

## Interpret compiler warnings

Autotuning may discard a candidate kernel for exceeding shared memory and continue with another. An optional attention backend can also report a fallback. Check whether the worker subsequently reached readiness. For a required model feature or unexpectedly slow execution, confirm the selected backend in the model guide and startup logs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.