{
  "schema_version": "1.0",
  "id": "T-896e01f06ffa",
  "url": "https://gpuatlas.top/articles/T-896e01f06ffa/",
  "title": "llama.cpp 编译成功，为什么运行时还是没用 CUDA？",
  "summary": "llama.cpp未用CUDA先核对构建选项和真实二进制，再检查设备发现、卸载配置及模型执行。",
  "language": "zh-Hans",
  "category": {
    "id": "c-09",
    "name": "框架配置与故障",
    "url": "https://gpuatlas.top/categories/c-09/"
  },
  "topics": [
    {
      "id": "framework-5c58ce0020",
      "name": "llama.cpp",
      "kind": "framework",
      "description": "用 GGUF 在本机运行模型时，GPU layers 和 CPU 卸载怎么分配？先平衡显存占用与生成速度。",
      "url": "https://gpuatlas.top/topics/framework-5c58ce0020/"
    },
    {
      "id": "framework-50241ea523",
      "name": "CUDA",
      "kind": "framework",
      "description": "系统工具包、驱动和框架自带运行库各管什么？先理清版本关系，再定位 GPU 无法使用的原因。",
      "url": "https://gpuatlas.top/topics/framework-50241ea523/"
    }
  ],
  "body_text": "llama.cpp编译成功却没用CUDA，先看构建配置和实际运行文件。普通编译成功不自动启用CUDA，也可能新程序已编好，PATH仍调用旧CPU版本。\n\n固定官方构建说明的CUDA配置包含cmake -B build -DGGML_CUDA=ON，再执行编译；工具链与平台条件需按同一版本准备，不能只加这一项就认定全部依赖成立。\n\n明确运行该构建目录的程序，检查设备列表和启动日志。记录二进制路径及构建版本，若设备未发现，先定位构建、驱动和工具链；架构或内核错误也不能全部当成显存不足。\n\n设备被识别后，再检查GPU层、可见设备与实际映射。配置或容量可能让模型仍主要在CPU，出现CUDA字样不等于所有权重和计算都已转移，运行期日志应与驻留对照。\n\n修复后，直接运行确认过路径的新二进制，让最初那条请求完成，再逐档增加日常长度，观察主存、显存和完整等待。构建启用CUDA、设备被发现和模型实际执行是三步，不能凭某次GPU利用率升高跳过其中一项。把生效参数与日志留下，之后PATH或环境变化时便能定位。",
  "published_at": null,
  "modified_at": "2026-11-26T15:00:32.276655+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "llamacpp-build",
      "url": "https://raw.githubusercontent.com/ggml-org/llama.cpp/master/docs/build.md",
      "retrieved_at": "2026-11-25T10:59:37.755333+00:00"
    },
    {
      "id": "llamacpp-multigpu",
      "url": "https://raw.githubusercontent.com/ggml-org/llama.cpp/master/docs/multi-gpu.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    },
    {
      "id": "cuda-compatibility",
      "url": "https://docs.nvidia.com/deploy/cuda-compatibility/index.html",
      "retrieved_at": "2026-11-25T10:24:21.873697+00:00"
    }
  ],
  "revision_note": "更新使用说明与操作示例；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-896e01f06ffa/",
    "json": "https://gpuatlas.top/data/articles/T-896e01f06ffa.json",
    "markdown": "https://gpuatlas.top/data/articles/T-896e01f06ffa.md"
  }
}
