|
| 1 | +--- |
| 2 | +title: Installation |
| 3 | +weight: 1 |
| 4 | +bookToc: true |
| 5 | +--- |
| 6 | + |
| 7 | +# Installation |
| 8 | + |
| 9 | +Zerfoo requires **Go 1.25 or later**. [Download Go](https://go.dev/dl/) if you haven't already. |
| 10 | + |
| 11 | +Verify your Go installation: |
| 12 | + |
| 13 | +```bash |
| 14 | +go version |
| 15 | +# go version go1.25.0 linux/amd64 |
| 16 | +``` |
| 17 | + |
| 18 | +## As a Library |
| 19 | + |
| 20 | +Add Zerfoo to your Go module: |
| 21 | + |
| 22 | +```bash |
| 23 | +go get github.com/zerfoo/zerfoo@latest |
| 24 | +``` |
| 25 | + |
| 26 | +Then import it in your code: |
| 27 | + |
| 28 | +```go |
| 29 | +import "github.com/zerfoo/zerfoo" |
| 30 | +``` |
| 31 | + |
| 32 | +For just tensors and GPU compute, import `github.com/zerfoo/ztensor`. For just tokenization, import `github.com/zerfoo/ztoken`. |
| 33 | + |
| 34 | +## CLI |
| 35 | + |
| 36 | +Install the `zerfoo` command-line tool: |
| 37 | + |
| 38 | +```bash |
| 39 | +go install github.com/zerfoo/zerfoo/cmd/zerfoo@latest |
| 40 | +``` |
| 41 | + |
| 42 | +This places the `zerfoo` binary in your `$GOPATH/bin` (or `$HOME/go/bin` by default). Make sure this directory is in your `PATH`. |
| 43 | + |
| 44 | +## Build from Source |
| 45 | + |
| 46 | +```bash |
| 47 | +git clone https://github.com/zerfoo/zerfoo.git |
| 48 | +cd zerfoo |
| 49 | +go build -o zerfoo ./cmd/zerfoo |
| 50 | +``` |
| 51 | + |
| 52 | +Zerfoo builds with **zero CGo by default** (`CGO_ENABLED=0`). GPU acceleration is loaded dynamically at runtime via purego/dlopen, so you do not need CUDA headers, shared libraries, or build tags to compile. A plain `go build` produces a fully static binary. |
| 53 | + |
| 54 | +## Platform Support |
| 55 | + |
| 56 | +Zerfoo compiles on any platform supported by Go 1.25, including **Linux**, **macOS**, and **Windows**. |
| 57 | + |
| 58 | +GPU acceleration is available on: |
| 59 | + |
| 60 | +| Backend | Hardware | Platforms | |
| 61 | +|---------|----------|-----------| |
| 62 | +| CUDA | NVIDIA GPUs | Linux, Windows | |
| 63 | +| ROCm | AMD GPUs | Linux | |
| 64 | +| OpenCL | Cross-vendor | Linux, macOS | |
| 65 | + |
| 66 | +For GPU setup instructions, see [GPU Setup](/docs/architecture/gpu-setup/). |
| 67 | + |
| 68 | +## Verify Installation |
| 69 | + |
| 70 | +### Library |
| 71 | + |
| 72 | +Create a test file to confirm the library is importable: |
| 73 | + |
| 74 | +```bash |
| 75 | +mkdir zerfoo-test && cd zerfoo-test |
| 76 | +go mod init zerfoo-test |
| 77 | +go get github.com/zerfoo/zerfoo@latest |
| 78 | +``` |
| 79 | + |
| 80 | +```go |
| 81 | +package main |
| 82 | + |
| 83 | +import ( |
| 84 | + "fmt" |
| 85 | + "github.com/zerfoo/zerfoo" |
| 86 | +) |
| 87 | + |
| 88 | +func main() { |
| 89 | + fmt.Println("zerfoo imported successfully") |
| 90 | + _ = zerfoo.Load |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +```bash |
| 95 | +go run main.go |
| 96 | +# zerfoo imported successfully |
| 97 | +``` |
| 98 | + |
| 99 | +### CLI |
| 100 | + |
| 101 | +```bash |
| 102 | +zerfoo version |
| 103 | +``` |
| 104 | + |
| 105 | +This prints the installed version. If the command is not found, ensure `$GOPATH/bin` is in your `PATH`: |
| 106 | + |
| 107 | +```bash |
| 108 | +export PATH="$PATH:$(go env GOPATH)/bin" |
| 109 | +``` |
| 110 | + |
| 111 | +## Next Steps |
| 112 | + |
| 113 | +- [Quickstart](/docs/getting-started/quickstart/) -- pull a model and run your first inference |
| 114 | +- [GPU Setup](/docs/architecture/gpu-setup/) -- configure CUDA, ROCm, or OpenCL for hardware-accelerated inference |
0 commit comments