731 字
4 分钟

Running deepseek-r1 617B with Ollama on Ubuntu 22.04 + 8×A800

2025-01-21

Discovered that my machine happens to meet the requirements for deepseek-r1 617B. Since it was sitting idle anyway, I decided to give it a test run.

System & Hardware Overview#

  • Processor : 2*Intel(R) Xeon(R) Platinum 8362 CPU @ 2.80GHz

  • Num of Core : 128 Cor_e

  • Memory : 1024 GB

  • Storage : 1.5T NVMe

  • GPU : 8*A800

  • NVIDIA-SMI 550.127.05

  • Driver Version: 550.127.05

  • CUDA Version: 12.4

Download Ollama#

Download from: https://ollama.com/

Install Ollama#

Directly reuse the official installation script:

Terminal window
curl -fsSL https://ollama.com/install.sh | sh

Configure the model download path#

Terminal window
mkdir -p /root/ollama/ollama_models

Then add it to Ollama.

If OLLAMA_MODELS is not configured at the beginning, the default path is /usr/share/ollama/.ollama/models.

Terminal window
vim .bashrc
export OLLAMA_MODELS=/root/ollama/ollama_models

Start the Ollama service#

Run Ollama#

Terminal window
ollama server

Modify Ollama configuration#

By default, Ollama only listens on localhost:11434, so it is only accessible from localhost.

Terminal window
vim /etc/systemd/system/ollama.service
# Add the following under [Service]
Environment="OLLAMA_HOST=0.0.0.0"
cat /etc/systemd/system/ollama.service
[Unit]
Description=Ollama Service
After=network-online.target
[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
Environment="OLLAMA_HOST=0.0.0.0"
[Install]
WantedBy=default.target

Restart Ollama#

Terminal window
systemctl daemon-reload
systemctl restart ollama
# Stop the service
systemctl stop ollama
# Start the service
systemctl start ollama

Run the model#

Terminal window
ollama run deepseek-r1:671b

Configure Docker + nvidia-docker2#

Install Docker#

Terminal window
export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh

Install GPU-Docker components#

Terminal window
# Install gpu-docker
apt-get install -y nvidia-docker2
nvidia-ctk runtime configure --runtime=docker
# This will modify the daemon.json file and add the container runtime

Configure Docker parameters#

Terminal window
root@catcat:~# cat /etc/docker/daemon.json
{
"data-root": "/root/docker_data",
"experimental": true,
"log-driver": "json-file",
"log-opts": {
"max-file": "3",
"max-size": "20m"
},
"registry-mirrors": [
"https://docker.1ms.run"
],
"runtimes": {
"nvidia": {
"args": [],
"path": "nvidia-container-runtime"
}
}
}

Test#

Terminal window
docker run --rm -it --gpus all ubuntu:22.04 /bin/bash
Terminal window
root@catcat:~# docker run --rm -it --gpus all ubuntu:22.04 /bin/bash
Unable to find image 'ubuntu:22.04' locally
22.04: Pulling from library/ubuntu
6414378b6477: Pull complete
Digest: sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97
Status: Downloaded newer image for ubuntu:22.04
root@e36b1bb454b6:/# nvidia-smi
Wed Jan 22 02:03:29 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.127.05 Driver Version: 550.127.05 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A800-SXM4-80GB Off | 00000000:23:00.0 Off | 0 |
| N/A 29C P0 56W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA A800-SXM4-80GB Off | 00000000:24:00.0 Off | 0 |
| N/A 29C P0 56W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 2 NVIDIA A800-SXM4-80GB Off | 00000000:43:00.0 Off | 0 |
| N/A 28C P0 57W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 3 NVIDIA A800-SXM4-80GB Off | 00000000:44:00.0 Off | 0 |
| N/A 28C P0 58W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 4 NVIDIA A800-SXM4-80GB Off | 00000000:83:00.0 Off | 0 |
| N/A 28C P0 57W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 5 NVIDIA A800-SXM4-80GB Off | 00000000:84:00.0 Off | 0 |
| N/A 29C P0 60W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 6 NVIDIA A800-SXM4-80GB Off | 00000000:C3:00.0 Off | 0 |
| N/A 29C P0 59W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 7 NVIDIA A800-SXM4-80GB Off | 00000000:C4:00.0 Off | 0 |
| N/A 29C P0 60W / 400W | 4MiB / 81920MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+

Deploy Open WebUI#

Terminal window
version: '3.8'
services:
open-webui:
image: ghcr.sakiko.de/open-webui/open-webui:main
container_name: open-webui
restart: always
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
open-webui:
Running deepseek-r1 617B with Ollama on Ubuntu 22.04 + 8×A800
https://catcat.blog/en/ubuntu-22-048a800-ollama-deepseek-r1.html
作者
猫猫博客
发布于
2025-01-21
许可协议
CC BY-NC-SA 4.0