Prerequisites: which GPU and how much VRAM
Ollama’s GPU page says it supports NVIDIA GPUs with compute capability 5.0 and above and driver version 550 or newer; cards with compute capability 5.0 to 6.2 need driver 570 or newer. Almost every data center and workstation card you can rent today qualifies.
The quick sizing rule is to start from the download size on the model’s library page, then add headroom for the context window. The gpt-oss:20b tag is a 14 GB download, and the library page says it can run on systems with as little as 16 GB of memory. gpt-oss:120b is 65 GB and fits on a single 80 GB GPU. llama3.1:8b is 4.9 GB; llama3.1:70b is 43 GB.
Longer contexts and parallel requests grow the KV cache, so leave several gigabytes free. The LLM VRAM budget guide explains the estimate, and LLM quantization for inference covers why these downloads are smaller than 16-bit weights.
| Ollama tag | Download size | Starting GPU |
|---|---|---|
| llama3.1:8b | 4.9 GB | 16 to 24 GB, e.g. L4 or RTX 4090 |
| gpt-oss:20b | 14 GB | 24 GB card |
| llama3.1:70b | 43 GB | 48 GB card such as L40S, or 80 GB for long context |
| gpt-oss:120b | 65 GB | One 80 GB GPU, e.g. H100 or A100 80 GB |
References: Ollama documentation: hardware support (GPU) · Ollama library: gpt-oss · Ollama library: llama3.1 · NVIDIA L4 specifications
Step 1: confirm the GPU and driver
Log in over SSH and run nvidia-smi. Check the product name, total memory and the driver version against the minimums above. If nvidia-smi is missing or errors, Ollama will silently fall back to the CPU, so fix the driver first.
Note the GPU count. On a multi-GPU machine Ollama can spread one model across cards, and CUDA_VISIBLE_DEVICES limits which ones it uses; the GPU page recommends UUIDs over numeric IDs because numbering can change.
References: NVIDIA System Management Interface · Ollama documentation: hardware support (GPU)
Step 2: install Ollama as a service
The Linux install is one command: curl -fsSL https://ollama.com/install.sh | sh. The script installs the binary and, on systemd machines, an ollama service that runs ollama serve as a dedicated ollama user and restarts on failure. Running the same command again updates Ollama.
Check the service with systemctl status ollama and read logs with journalctl -e -u ollama. The startup log reports which GPUs Ollama detected and how much memory each has. If it reports no compatible GPU, stop here and fix the driver.
If you prefer containers, the documented command is docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama, then docker exec -it ollama ollama run llama3.2. Change the publish to -p 127.0.0.1:11434:11434 so the port is not open to the internet. The host needs the NVIDIA Container Toolkit first; see Docker with NVIDIA GPUs.
References: Ollama documentation: Linux · Ollama documentation: Docker · Docker documentation: port publishing
Step 3: pull a model and confirm it runs on the GPU
Pull and run a model: ollama pull gpt-oss:20b, then ollama run gpt-oss:20b to chat in the terminal. The first pull downloads the full file, so keep model storage on a persistent disk; on Linux the service stores models under /usr/share/ollama/.ollama/models by default, and OLLAMA_MODELS moves them.
While the model is loaded, run ollama ps. The Processor column shows whether it is on the GPU, the CPU or split between them. You want 100% GPU. A CPU/GPU split means the model plus its context did not fit in VRAM, and generation will be far slower.
Test the HTTP API from the same machine. Ollama serves an OpenAI-compatible API at http://localhost:11434/v1, so curl -X POST http://localhost:11434/v1/chat/completions with a JSON body naming the model and a messages array should return a reply. The OpenAI SDK needs an api_key value, but Ollama ignores it.
References: Ollama documentation: FAQ · Ollama documentation: OpenAI compatibility · Ollama documentation: quickstart
Step 4: tune the server with environment variables
Ollama is configured through environment variables on the service. Run sudo systemctl edit ollama, add Environment lines under a [Service] section, then sudo systemctl daemon-reload and sudo systemctl restart ollama. Defaults below come from the Ollama FAQ.
The defaults suit a laptop more than a rented server. A 4,096-token context is short for document work, and a single parallel request leaves a large GPU underused. Raise them one at a time and watch ollama ps for a CPU split after each change.
| Variable | Default | When to change it |
|---|---|---|
| OLLAMA_HOST | 127.0.0.1:11434 | Leave on localhost; use a tunnel or proxy instead |
| OLLAMA_CONTEXT_LENGTH | 4096 tokens | Raise for long documents if VRAM allows |
| OLLAMA_NUM_PARALLEL | 1 on non-Metal backends | Raise to serve several users at once |
| OLLAMA_MAX_LOADED_MODELS | 3 × GPU count | Lower if models keep evicting each other |
| OLLAMA_KEEP_ALIVE | 5 minutes | Longer to avoid reload delays on a dedicated card |
| OLLAMA_KV_CACHE_TYPE | f16 | Quantize the KV cache to fit longer context |
| OLLAMA_FLASH_ATTENTION | Automatic where supported | Set 0 or 1 only to override |
| OLLAMA_MODELS | /usr/share/ollama/.ollama/models on Linux | Point at a persistent volume |
References: Ollama documentation: FAQ · Ollama documentation: Linux
Step 5: keep port 11434 private
Ollama binds 127.0.0.1 on port 11434 by default, and the FAQ describes setting OLLAMA_HOST to 0.0.0.0 to expose it. Do not do that on a cloud machine with a public IP. The FAQ documents no login for the local API, so anyone who reaches the port can run models on your GPU and pull or delete models.
Use an SSH tunnel instead: ssh -N -L 11434:localhost:11434 user@your-gpu-host. Your laptop’s localhost:11434 now reaches the remote server, so local tools that expect Ollama work unchanged. The OpenSSH manual describes -L as local port forwarding and -N as forwarding without a remote command.
For a shared team endpoint, run a reverse proxy on the same machine with TLS and per-user keys, keep Ollama on localhost behind it, and close every other port in the provider firewall.
References: Ollama documentation: FAQ · OpenSSH ssh(1) manual
Common errors when you run Ollama on a cloud GPU
Start with journalctl -e -u ollama and ollama ps; between them they explain most problems.
| Symptom | Likely cause | Fix |
|---|---|---|
| ollama ps shows 100% CPU | No usable GPU detected | Check nvidia-smi and the driver version; read the startup log |
| ollama ps shows a CPU/GPU split | Model plus context exceeds VRAM | Smaller tag, shorter OLLAMA_CONTEXT_LENGTH, or a larger card |
| GPU lost after a suspend/resume | NVIDIA UVM driver state | sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm |
| Connection refused from the laptop | Bound to localhost, no tunnel | Start ssh -N -L 11434:localhost:11434 |
| Slow first reply after idle time | Model unloaded after 5 minutes | Raise OLLAMA_KEEP_ALIVE |
| Models disappear after the instance restarts | Stored on ephemeral disk | Set OLLAMA_MODELS to a persistent volume |
| Wrong GPU used on a multi-GPU host | Device ordering | Set CUDA_VISIBLE_DEVICES with GPU UUIDs |
References: Ollama documentation: hardware support (GPU) · Ollama documentation: FAQ · Ollama documentation: Linux
Illustrative cost and when to switch engines
These numbers are illustrative, using assumed rates. A 24 GB card at $0.70 per GPU-hour running gpt-oss:20b for an eight-hour workday costs $5.60 a day, about $123 over 22 working days. An 80 GB card at $2.00 per GPU-hour for gpt-oss:120b costs $16 a day or $352 over the same month. Leaving either running around the clock triples the bill.
Ollama is built for simplicity. If you need many concurrent users and the highest throughput per GPU, a batching server is usually the better fit; vLLM vs Ollama compares the two, and deploy vLLM on a cloud GPU shows the setup.
| Scenario (assumed rate) | Hours | Cost |
|---|---|---|
| 24 GB card at $0.70, one workday | 8 | $5.60 |
| 24 GB card at $0.70, 22 workdays | 176 | $123.20 |
| 80 GB card at $2.00, 22 workdays | 176 | $352.00 |
| 80 GB card at $2.00, always on for 30 days | 720 | $1,440.00 |
References: Ollama library: gpt-oss
Checklist and next step
nvidia-smi shows the rented GPU and a 550+ driver. Ollama installed from the official script and the service running. Models stored on a persistent volume. ollama ps shows 100% GPU for your model and context. OLLAMA_HOST left on 127.0.0.1 and access through an SSH tunnel or TLS proxy. Instance stopped when not in use.
Pick the card from the download size plus context headroom, then rent it. On NeuraMesh you choose the GPU, a plan, GPU count, hours and region on rent GPUs and receive a confirmed quotation, typically within one business day, with nothing charged until you approve. Unsure which card fits your model? Ask the compute advisor.
NeuraMesh prices for these GPUs
| GPU | Memory | Data center | Value |
|---|---|---|---|
| RTX 4090 | 24 GB | $0.46 | $0.40 |
| L40S | 48 GB | $1.26 | $0.54 |
| A100 | 80 GB | $1.56 | $0.98 |
| H100 | 80 GB | $2.88 | $2.00 |
Every order is confirmed in a quotation before you pay. See all GPU prices.
Questions readers ask
How much VRAM do I need to run Ollama on a cloud GPU?
More than the model’s download size, plus headroom for context. gpt-oss:20b is a 14 GB download that its library page says runs in 16 GB, so a 24 GB card is comfortable. gpt-oss:120b is 65 GB and fits on one 80 GB GPU.
How do I know Ollama is using the GPU?
Run ollama ps while the model is loaded. The Processor column shows GPU, CPU or a split. You want 100% GPU; a split means the model and context do not fit in VRAM.
Should I set OLLAMA_HOST to 0.0.0.0?
Not on a server with a public IP. The local API has no login, so anyone who reaches port 11434 can use your GPU. Keep the default 127.0.0.1 binding and use an SSH tunnel or an authenticated reverse proxy.
Where does Ollama store models on Linux?
The Linux service stores models under /usr/share/ollama/.ollama/models by default. Set OLLAMA_MODELS to a path on a persistent volume so models survive the instance being recreated.
Can Ollama use more than one GPU?
Yes. Ollama can load a model across several GPUs and limits which devices it uses through CUDA_VISIBLE_DEVICES. The default number of loaded models is three times the GPU count.
Sources and editorial notes
- Ollama documentation: hardware support (GPU)
- Ollama library: gpt-oss
- Ollama library: llama3.1
- NVIDIA L4 specifications
- NVIDIA System Management Interface
- Ollama documentation: Linux
- Ollama documentation: Docker
- Docker documentation: port publishing
- Ollama documentation: FAQ
- Ollama documentation: OpenAI compatibility
- Ollama documentation: quickstart
- OpenSSH ssh(1) manual
Primary documentation reviewed November 24, 2026. Provider descriptions reflect published documentation. Recommendations are our analysis; worked figures are illustrative unless explicitly stated otherwise. No independent provider benchmark or uptime ranking is claimed.
Need this GPU? Rent it from NeuraMesh: choose a GPU and plan, get a confirmed quotation, and pay only when you approve. See pricing.
