# Hardware

> Run Pie on CUDA, ROCm, Metal, Vulkan, WebGPU, and Google TPUs.

Source: https://pie-project.org/docs/serve/hardware  

Pie runs the same models and inferlets on datacenter GPUs, Google TPUs, laptops, phones, and browser tabs. Each backend has its own binary build, and the [installer](https://pie-project.org/docs/install) selects the matching build for your machine.

> **Figure.** Pie's backends: CUDA for NVIDIA GPUs, ROCm for AMD GPUs, Metal for Apple silicon, Vulkan for Android, Linux and Windows, WebGPU for browsers, XLA for Google TPUs. One codebase. Each device gets its own backend and its own kernels.

## Backends

| Backend | Devices                                     | Platforms                     | Multi-GPU                     |
| ------- | ------------------------------------------- | ----------------------------- | ----------------------------- |
| CUDA    | NVIDIA GPUs                                 | Linux, Windows                | Tensor and expert parallelism |
| ROCm    | AMD GPUs                                    | Linux                         | Tensor and expert parallelism |
| Metal   | Apple silicon                               | macOS, iOS                    | Single device                 |
| Vulkan  | Cross-vendor GPUs, including Android phones | Linux, Windows, Android       | Single device                 |
| WebGPU  | Web browsers, and native via `wgpu`         | Chrome, Linux, macOS, Windows | Single device                 |
| XLA     | Google TPUs                                 | Linux                         | Single device                 |

All prebuilt binaries are listed on the [install page](https://pie-project.org/docs/install#platform-builds).

## Choosing a device

`pie config init` writes an `[engine]` section for your installed backend. On a single-GPU machine, the defaults work without changes:

```toml
[engine]
type = "cuda"
device = ["cuda:0"]
activation_dtype = "bfloat16"
```

To select a different GPU, change `device`, for example `["cuda:1"]` or `["vulkan:1"]`. Device numbers follow the driver's enumeration order.

## Running on multiple GPUs

On CUDA and ROCm, list the target GPUs and set how the model is sharded across them:

```toml
[engine]
type = "cuda"
device = ["cuda:0", "cuda:1", "cuda:2", "cuda:3"]
tensor_parallel_size = 4
```

* `tensor_parallel_size` shards each layer's weight matrices across GPUs.
* `expert_parallel_size` shards Mixture-of-Experts (MoE) experts across GPUs instead.

Import a deployment that matches your GPU count, such as one ending in `-tp4` (see [Models](https://pie-project.org/docs/serve/models#deployments)). To scale across multiple machines, see [Scale out](https://pie-project.org/docs/serve/scale-out).

## Check your setup

```bash
pie doctor
```

`pie doctor` verifies your config file, imported models, engine libraries, and GPU drivers, and prints what to fix if a check fails. After `pie doctor` passes, run `pie tune` once to benchmark your device. See [Configure & tune](https://pie-project.org/docs/serve/configure#tune-for-your-device).

> **Go deeper:** [How one codebase covers every device](https://pie-project.org/docs/invent/backends). See how Pie shares one runtime across thin per-device engines and generated kernels.
