太长不看;

CachyOS 上的 ollama-cuda(截至目前)只支持 compute >= 7.5。

如果你的显卡比较老、compute 版本更低,那你就必须二选一:

  • 从源码编译 ollama-cuda,并加上对旧 compute 目标的支持
  • 安装 ollama-vulkan

我选了 ollama-vulkan,运行得完美无缺!

故事时间

今天我灵光一闪,决定终于把 Windows 11 虚拟机关掉,迁移到 Linux 上。

需求是要能运行:

  • Ollama - 用来玩本地模型的魔法
  • Docker - 用于远程开发
  • Steam - 用来打游戏
  • Jellyfin - 用来存放家庭视频档案

这里我只聊 Ollama,因为这段经历挺有意思,也让我琢磨为什么事情不能更直观一点。

这台机器里有 2 块显卡:

  • GTX 1070 - 8GB
  • GTX 970 - 4GB

我想在它们上面跑 Ollama,折腾一下本地模型,看看怎么把它集成进一些项目里。比如:在本地对数据做匿名化、按我的使用场景搭一个非破坏性的 OpenClaw 实现、对手机扫描的文档做本地 OCR、自动化处理家里日常管理的一些事情。

所以我很自然地装上了 ollama 和 ollama-cuda,毕竟里面有 2 块 Nvidia 显卡,我以为肯定没问题,毕竟几分钟前它在 Windows 上还跑得好好的。

我启动了 Ollama,加载 qwen3:8b 做个快速实验,然后……它居然在用 CPU 跑 🤔

显卡的显存明明完全装得下,可不知为什么 Ollama 偏偏选择用 CPU 来跑。

我试着从日志里找原因,后来请 Claude 帮了把手,它给出了一个相当让人头大的结论:

The logs tell the story clearly. Both your GPUs are detected but then filtered out because they fail CUDA initialization:

  "filtering device which didn't fully initialize" id=GPU-eb132a13-b9f4-40e3-d85d-60f211dfd21e ... library=CUDA
  "filtering device which didn't fully initialize" id=GPU-550263c8-37e2-2a25-c0b6-10cc7511ed20 ... library=CUDA

  The reason is the CUDA library bundled with Ollama 0.17.4 was compiled for these architectures only:

  CUDA.0.ARCHS=750,800,860,870,880,890,900,1000,1030,1100,1200,1210

  The minimum supported compute capability is 7.5 (Turing / RTX 20xx series). Your GPUs are older than that:

  ┌──────────┬────────────────────┬──────────────┐
  │   GPU    │ Compute Capability │ Architecture │
  ├──────────┼────────────────────┼──────────────┤
  │ GTX 1070 │ 6.1                │ Pascal       │
  ├──────────┼────────────────────┼──────────────┤
  │ GTX 970  │ 5.2                │ Maxwell      │
  └──────────┴────────────────────┴──────────────┘

  Neither is in the supported list, so CUDA initialization fails for both, and Ollama falls back to CPU-only inference.

  Your options:

  1. Downgrade Ollama to an older version that still included Pascal/Maxwell support (pre-0.6.x era had broader arch coverage, but check release notes for specifics).
  2. Build Ollama from source with CUDA_ARCHITECTURES="52;61;75;80;86" to include your GPU architectures.
  3. Upgrade GPUs to at least an RTX 2060 or newer (compute 7.5+).

说实话,这让我有点失望,因为在换新显卡之前,我想尽可能把这些旧卡榨干。

我真不想从源码重新编译 Ollama,它本来就该开箱即用,而且我很困惑它为什么不行,毕竟在 Windows 上安装的版本是支持这些架构的。

这些显卡在 Ollama 官网上也被列为受支持的!

长话短说,我在 Google 上折腾了一圈之后发现:

原来 ollama-cuda 就只满足上面列出的那些要求……而给出的建议是安装 ollama-vulkan。

装上之后,一切都顺滑地跑起来了!