|
| 1 | +--- |
| 2 | +date: 2025-12-17 |
| 3 | +title: Running AI Inference on AMD EPYC Without a GPU in Sight |
| 4 | +authors: |
| 5 | + - cloudnull |
| 6 | +description: > |
| 7 | + Running AI Inference on AMD EPYC Without a GPU in Sight |
| 8 | +categories: |
| 9 | + - OpenStack |
| 10 | + - Zen |
| 11 | + - AMD |
| 12 | + - ZenDNN |
| 13 | + - ZenTorch |
| 14 | + - Virtualization |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +# Running AI Inference on AMD EPYC Without a GPU in Sight |
| 19 | + |
| 20 | +**Spoiler: You don't need a $40,000 GPU to run LLM inference. Sometimes 24 CPU cores and the right software stack will do just fine.** |
| 21 | + |
| 22 | +The AI infrastructure conversation has become almost synonymous with GPU procurement battles, NVIDIA allocation queues, and eye-watering hardware costs. But here's a reality that doesn't get enough attention: for many inference workloads—especially during development, testing, and moderate-scale production—modern CPUs with optimized software can deliver surprisingly capable performance at a fraction of the cost. |
| 23 | + |
| 24 | +<!-- more --> |
| 25 | + |
| 26 | +I recently spent some time exploring AMD's ZenDNN optimization library paired with vLLM on Rackspace OpenStack Flex, and the results challenge the assumption that CPU inference is merely a curiosity. Let me walk through what I found. |
| 27 | + |
| 28 | +## The Setup: AMD EPYC 9454 on OpenStack Flex |
| 29 | + |
| 30 | +For this testing, I spun up a general-purpose VM in Rackspace OpenStack Flex's DFW3 environment using the `gp.5.24.96` flavor: |
| 31 | + |
| 32 | +| Resource | Specification | |
| 33 | +|----------|---------------| |
| 34 | +| vCPUs | 24 | |
| 35 | +| RAM | 96 GB | |
| 36 | +| Root Disk | 240 GB | |
| 37 | +| Ephemeral | 128 GB | |
| 38 | +| Processor | AMD EPYC 9454 (Genoa) | |
| 39 | +| Hourly Cost | $0.79 | |
| 40 | + |
| 41 | +The AMD EPYC 9454 is a 4th-generation Zen 4 processor with AVX-512 support—including the BF16 and VNNI extensions that matter for inference workloads. These aren't just marketing checkboxes; they translate directly into optimized matrix operations that LLMs depend on. |
| 42 | + |
| 43 | +!!! note "Containerization with Docker" |
| 44 | + |
| 45 | + This post isn't going into how to install [Docker](https://docs.docker.com/engine/install), but before getting started, it should be installed. |
| 46 | + |
| 47 | +## Getting vLLM |
| 48 | + |
| 49 | +vLLM is an open-source library designed for efficient large language model inference. It supports CPU and GPU backends and features a pluggable architecture that allows integration with optimization libraries like ZenDNN. To get started, clone the vLLM repository: |
| 50 | + |
| 51 | +```bash |
| 52 | +git clone https://github.com/vllm-project/vllm |
| 53 | +``` |
| 54 | + |
| 55 | +## Building vLLM with ZenTorch |
| 56 | + |
| 57 | +AMD's ZenDNN library provides optimized deep learning primitives specifically tuned for Zen architecture processors. The ZenTorch plugin integrates these optimizations into PyTorch, and by extension, into vLLM's inference pipeline. |
| 58 | + |
| 59 | +Build the initial Docker Image for vLLM with CPU optimizations enabled. |
| 60 | + |
| 61 | +```shell |
| 62 | +docker build -f docker/Dockerfile.cpu \ |
| 63 | + --build-arg VLLM_CPU_AVX512BF16=1 \ |
| 64 | + --build-arg VLLM_CPU_AVX512VNNI=1 \ |
| 65 | + --build-arg VLLM_CPU_DISABLE_AVX512=0 \ |
| 66 | + --tag vllm-cpu \ |
| 67 | + --target vllm-openai \ |
| 68 | + . |
| 69 | +``` |
| 70 | + |
| 71 | +With the base container built, we now add the layers to make sure we can leverage ZenDNN optimizations. The build process involves creating a custom Docker image that layers ZenDNN-pytorch-plugin on top of vLLM's CPU-optimized base image. |
| 72 | + |
| 73 | +```dockerfile |
| 74 | +FROM vllm-cpu:latest |
| 75 | +RUN apt-get update -y \ |
| 76 | + && apt-get install -y --no-install-recommends make cmake ccache git curl wget ca-certificates \ |
| 77 | + gcc-12 g++-12 libtcmalloc-minimal4 libnuma-dev ffmpeg \ |
| 78 | + libsm6 libxext6 libgl1 jq lsof libjemalloc2 gfortran \ |
| 79 | + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12 |
| 80 | + |
| 81 | +RUN git clone https://github.com/amd/ZenDNN-pytorch-plugin.git && \ |
| 82 | + cd ZenDNN-pytorch-plugin && \ |
| 83 | + uv pip install -r requirements.txt && \ |
| 84 | + CC=gcc CXX=g++ python3 setup.py bdist_wheel && \ |
| 85 | + uv pip install dist/*.whl |
| 86 | + |
| 87 | +ENTRYPOINT ["vllm", "serve"] |
| 88 | +``` |
| 89 | + |
| 90 | +The key build flags enable AVX-512 extensions: |
| 91 | + |
| 92 | +```bash |
| 93 | +docker build -f docker/Dockerfile.cpu-amd \ |
| 94 | + --build-arg VLLM_CPU_AVX512BF16=1 \ |
| 95 | + --build-arg VLLM_CPU_AVX512VNNI=1 \ |
| 96 | + --build-arg VLLM_CPU_DISABLE_AVX512=0 \ |
| 97 | + --tag vllm-cpu-zentorch \ |
| 98 | + --target vllm-openai \ |
| 99 | + . |
| 100 | +``` |
| 101 | + |
| 102 | +Runtime configuration binds vLLM to available CPU cores and allocates substantial memory for the KV cache: |
| 103 | + |
| 104 | +For the test environment I set the shared memory size to 94G to accommodate larger models. |
| 105 | + |
| 106 | +??? example "computing SHM_SIZE" |
| 107 | + |
| 108 | + ```bash |
| 109 | + export SHM_SIZE="$(($(free -m | awk '/Mem/ {print $2}') - 1024))" |
| 110 | + ``` |
| 111 | + |
| 112 | +Now run the vLLM container with ZenTorch enabled. |
| 113 | + |
| 114 | +```bash |
| 115 | +docker run --net=host \ |
| 116 | + --ipc=host \ |
| 117 | + --shm-size=${SHM_SIZE}m \ |
| 118 | + --privileged=true \ |
| 119 | + --detach \ |
| 120 | + --volume /var/lib/huggingface:/root/.cache/huggingface \ |
| 121 | + --env HUGGING_FACE_HUB_TOKEN="${HF_TOKEN}" \ |
| 122 | + --env VLLM_PLUGINS="zentorch" \ |
| 123 | + --env VLLM_CPU_KVCACHE_SPACE=50 \ |
| 124 | + --env VLLM_CPU_OMP_THREADS_BIND=${CORES} \ |
| 125 | + --env VLLM_CPU_NUM_OF_RESERVED_CPU=1 \ |
| 126 | + --name vllm-server \ |
| 127 | + --rm \ |
| 128 | + vllm-cpu-zentorch:latest --dtype=bfloat16 \ |
| 129 | + --max-num-seqs=5 \ |
| 130 | + --model=${MODEL} |
| 131 | +``` |
| 132 | + |
| 133 | +## Benchmark Results: What Can CPU Inference Actually Do? |
| 134 | + |
| 135 | +I ran vLLM's built-in benchmark suite across several model families with 128-token input/output sequences and 4 concurrent requests. Here's what the numbers look like: |
| 136 | + |
| 137 | +!!! example "Benchmark setup and command" |
| 138 | + |
| 139 | + ```bash |
| 140 | + # Install |
| 141 | + apt install python3.12-venv |
| 142 | + python3 -m venv ~/.venvs/vllm |
| 143 | + ~/.venvs/vllm/bin/pip install vllm ijson |
| 144 | + |
| 145 | + # Run benchmark |
| 146 | + HUGGING_FACE_HUB_TOKEN=${2:-"None"} ~/.venvs/vllm/bin/python3 \ |
| 147 | + -m vllm.entrypoints.cli.main bench serve --backend vllm \ |
| 148 | + --base-url http://localhost:8000 \ |
| 149 | + --model ${MODEL} \ |
| 150 | + --tokenizer ${MODEL} \ |
| 151 | + --random-input-len 128 \ |
| 152 | + --random-output-len 128 \ |
| 153 | + --num-prompts 20 \ |
| 154 | + --max-concurrency 4 \ |
| 155 | + --temperature 0.7 |
| 156 | + ``` |
| 157 | + |
| 158 | +### Qwen3 Family |
| 159 | + |
| 160 | +| Model | Parameters | Output Tokens/sec | TTFT (median) | Tokens per Output (median) | |
| 161 | +|-------|------------|-------------------|---------------|---------------------------| |
| 162 | +| Qwen3-0.6B | 0.6B | 121.17 | 247ms | 29.74ms | |
| 163 | +| Qwen3-1.7B | 1.7B | 69.00 | 542ms | 52.55ms | |
| 164 | +| Qwen3-4B | 4B | 35.77 | 1,366ms | 99.59ms | |
| 165 | +| Qwen3-8B | 8B | 20.65 | 2,156ms | 176.40ms | |
| 166 | + |
| 167 | +### Llama 3.2 Family |
| 168 | + |
| 169 | +| Model | Parameters | Output Tokens/sec | TTFT (median) | Tokens per Output (median) | |
| 170 | +|-------|------------|-------------------|---------------|---------------------------| |
| 171 | +| Llama-3.2-1B | 1B | 93.89 | 385ms | 38.46ms | |
| 172 | +| Llama-3.2-3B | 3B | 43.61 | 934ms | 83.52ms | |
| 173 | + |
| 174 | +### Gemma 3 Family |
| 175 | + |
| 176 | +| Model | Parameters | Output Tokens/sec | TTFT (median) | Tokens per Output (median) | |
| 177 | +|-------|------------|-------------------|---------------|---------------------------| |
| 178 | +| Gemma-3-1b-it | 1B | 83.81 | 337ms | 43.66ms | |
| 179 | +| Gemma-3-4b-it | 4B | 36.38 | 1,050ms | 102.40ms | |
| 180 | +| Gemma-3-12b-it | 12B | 13.93 | 3,873ms | 260.42ms | |
| 181 | + |
| 182 | +## Resource Utilization: What the System Actually Does |
| 183 | + |
| 184 | +Beyond throughput numbers, understanding resource consumption patterns matters for capacity planning. Here's what the system looked like under load during these benchmarks. |
| 185 | + |
| 186 | +!!! info "Dashboard: System metrics showing CPU, memory, network, and load patterns during vLLM inference testing" |
| 187 | + |
| 188 | + { align=left : style="max-width:512px;width:75%;" } |
| 189 | + |
| 190 | + * CPU load patterns (1-minute load spiking to 5-6 during inference) |
| 191 | + * Memory utilization bands (50-70% during active runs) |
| 192 | + * Network traffic spikes during HuggingFace model downloads (16 MB/s peak) |
| 193 | + * Process table data showing VLLM::EngineCore threads (50-2000% CPU, 106-151 threads) |
| 194 | + |
| 195 | +### CPU Behavior |
| 196 | + |
| 197 | +The load average tells the real story. During active inference, the 1-minute load spiked to 5-6 on this 24-vCPU system—significant but not saturated. The CPU usage percentage chart shows bursty patterns: idle between requests, then concentrated utilization during token generation. |
| 198 | + |
| 199 | +The process table captures vLLM's multi-threaded architecture in action. Multiple `VLLM::EngineCore` processes consumed 50-2000% CPU (remember, 100% = one core, so 2000% means 20 cores active). Thread counts ranged from 106 to 151 per engine process, reflecting the parallelized inference pipeline. |
| 200 | + |
| 201 | +### Memory Patterns |
| 202 | + |
| 203 | +Memory utilization climbed to 50-70% during model loading and sustained inference—consuming roughly 48-67GB of the 96GB available. This tracks with model size plus KV cache allocation (configured at 50GB via `VLLM_CPU_KVCACHE_SPACE`). |
| 204 | + |
| 205 | +Container-level metrics show memory consumption scaling with model complexity: |
| 206 | + |
| 207 | +| Model Size Class | Memory Consumption | |
| 208 | +|-----------------|-------------------| |
| 209 | +| Sub-1B models | ~27-57 GB | |
| 210 | +| 3-4B models | ~56-60 GB | |
| 211 | +| 8B+ models | ~69-74 GB | |
| 212 | + |
| 213 | +The larger memory footprint relative to model parameter count reflects vLLM's continuous batching and KV cache management overhead—memory traded for throughput optimization. |
| 214 | + |
| 215 | +### Network and Storage I/O |
| 216 | + |
| 217 | +Network traffic spiked dramatically during model downloads from HuggingFace Hub, reaching 16 MB/s receive rates. Once models cached locally in `/var/lib/huggingface`, subsequent runs showed minimal network activity. |
| 218 | + |
| 219 | +Disk I/O patterns were write-heavy during model caching (21GB+ written across test runs) with modest read activity. The root disk sat at 17% utilization—model weights and container layers fit comfortably within the 240GB allocation. |
| 220 | + |
| 221 | +### Container Resource Summary |
| 222 | + |
| 223 | +Across all benchmark runs, the vLLM containers exhibited these aggregate characteristics: |
| 224 | + |
| 225 | +| Metric | Range | Notes | |
| 226 | +|--------|-------|-------| |
| 227 | +| CPU % | 44-873% | Multi-core utilization during inference | |
| 228 | +| Memory | 682MB - 74GB | Scales with model size | |
| 229 | +| Thread Count | 73-253 | Parallel inference workers | |
| 230 | +| Network Rx | 46-97 GB | Model downloads from HuggingFace | |
| 231 | + |
| 232 | +The key insight: CPU inference is memory-bandwidth bound more than compute-bound. The EPYC 9454's 12-channel DDR5 memory architecture matters as much as its core count for this workload class. |
| 233 | + |
| 234 | +## Reading the Results |
| 235 | + |
| 236 | +Let's be direct about what these numbers mean for practical use cases. |
| 237 | + |
| 238 | +**Sub-2B models are genuinely usable.** The Qwen3-0.6B and 1.7B models deliver 69-121 tokens per second with sub-second time-to-first-token. That's responsive enough for interactive applications—chatbots, code completion, document summarization. You're not waiting around. |
| 239 | + |
| 240 | +**4B models hit a sweet spot for quality vs. speed.** At 35-43 tokens per second, models like Qwen3-4B and Llama-3.2-3B provide meaningfully better outputs than their smaller siblings while remaining practical for batch processing and near-real-time applications. A 1.3-second TTFT is noticeable but not painful. |
| 241 | + |
| 242 | +**8B+ models work but require patience.** The Qwen3-8B at ~21 tokens/sec and Gemma-3-12b at ~14 tokens/sec are slower but absolutely functional for use cases where quality trumps latency—document analysis, async processing, development and testing workflows. |
| 243 | + |
| 244 | +## The Economics: GPU-Free Doesn't Mean Value-Free |
| 245 | + |
| 246 | +Here's where this gets interesting from an infrastructure planning perspective. |
| 247 | + |
| 248 | +That `gp.5.24.96` flavor runs at $0.79/hour—roughly $575/month for continuous operation. Compare that to GPU instance pricing where you're looking at $2-4/hour for entry-level accelerator access, assuming availability. |
| 249 | + |
| 250 | +For development teams iterating on prompts, testing model behavior, or running moderate inference loads, CPU-based instances provide a dramatically lower barrier to entry. You can spin up the infrastructure in minutes without joining a GPU allocation queue. |
| 251 | + |
| 252 | +This isn't about replacing GPU infrastructure for training or high-throughput production inference. It's about recognizing that not every AI workload requires the same hardware profile—and that forcing GPU dependency on all AI workloads is both expensive and often unnecessary. |
| 253 | + |
| 254 | +## Practical Applications |
| 255 | + |
| 256 | +Where does CPU inference with ZenDNN actually make sense? |
| 257 | + |
| 258 | +**Development and testing environments.** Every AI application needs a place to iterate that doesn't burn through GPU budget. CPU inference lets teams test model behavior, refine prompts, and validate integrations without competing for accelerator resources. |
| 259 | + |
| 260 | +**Batch processing at moderate scale.** Processing thousands of documents overnight? Analyzing logs for anomalies? Generating embeddings for search indexing? These workloads often care more about cost-per-token than tokens-per-second. |
| 261 | + |
| 262 | +**Edge and hybrid deployments.** Not every deployment location has GPU infrastructure. Branch offices, on-premise installations, and resource-constrained environments can still run inference workloads. |
| 263 | + |
| 264 | +**Burst capacity.** When your GPU fleet is fully loaded, CPU instances can absorb overflow traffic rather than dropping requests or queuing indefinitely. |
| 265 | + |
| 266 | +## Running This Yourself |
| 267 | + |
| 268 | +The complete setup on Rackspace OpenStack Flex involves: |
| 269 | + |
| 270 | +1. Launch an AMD EPYC instance (gp.5 flavor family) |
| 271 | +2. Install Docker and clone the vLLM repository |
| 272 | +3. Build the CPU-optimized image with ZenTorch |
| 273 | +4. Configure CPU binding and memory allocation |
| 274 | +5. Deploy and test |
| 275 | + |
| 276 | +The vLLM server exposes an OpenAI-compatible API, so existing tooling and integrations work without modification: |
| 277 | + |
| 278 | +```bash |
| 279 | +curl http://localhost:8000/v1/models | jq |
| 280 | +``` |
| 281 | + |
| 282 | +From there, your application code doesn't need to know whether inference is happening on a GPU or CPU—the API contract remains identical. |
| 283 | + |
| 284 | +## The Bigger Picture |
| 285 | + |
| 286 | +The AI infrastructure narrative has over-indexed on GPU scarcity and the assumption that meaningful work requires accelerators. That's true for training and high-throughput production inference, but it misses a substantial category of workloads where CPU-based solutions deliver genuine value. |
| 287 | + |
| 288 | +AMD's investment in ZenDNN, combined with vLLM's architecture that supports pluggable backends, creates a practical path for organizations to deploy AI capabilities without GPU dependency. Running this on OpenStack Flex demonstrates that cloud infrastructure doesn't need to be hyperscaler-specific to support modern AI workloads. |
| 289 | + |
| 290 | +The 24-core EPYC VM running inference at 120 tokens per second for a 0.6B model—or 35 tokens per second for a 4B model—isn't a compromise. It's the right tool for a substantial portion of the AI workload landscape. |
| 291 | + |
| 292 | +Sometimes the most expensive hardware isn't the most appropriate hardware. And sometimes, 24 CPU cores are exactly what you need. |
0 commit comments