wsl中ollama不能使用gpu加速

之前还能有gpu加速的, 突然一次发现不能加速了, 启动之后发现只能用cpu了

log

time=2024-04-19T00:05:08.213+08:00 level=INFO source=images.go:806 msg="total blobs: 80"
time=2024-04-19T00:05:08.248+08:00 level=INFO source=images.go:813 msg="total unused blobs removed: 43"
time=2024-04-19T00:05:08.249+08:00 level=INFO source=routes.go:1110 msg="Listening on 127.0.0.1:11434 (version 0.1.29)"
time=2024-04-19T00:05:08.250+08:00 level=INFO source=payload_common.go:112 msg="Extracting dynamic libraries to /tmp/ollama3092358058/runners ..."
time=2024-04-19T00:05:15.442+08:00 level=INFO source=payload_common.go:139 msg="Dynamic LLM libraries [cpu_avx rocm_v60000 cuda_v11 cpu_avx2 cpu]"
time=2024-04-19T00:05:15.442+08:00 level=INFO source=gpu.go:77 msg="Detecting GPU type"
time=2024-04-19T00:05:15.442+08:00 level=INFO source=gpu.go:191 msg="Searching for GPU management library libnvidia-ml.so"
time=2024-04-19T00:05:17.729+08:00 level=INFO source=gpu.go:237 msg="Discovered GPU libraries: [/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.171.04 /usr/lib/wsl/lib/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_059948e396d205d5/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_268e85175aa9e991/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_36f8a434e9b7b9f2/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_84b2c943d6816eb7/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_abf7e4e84f20581c/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_d1bd230cd08e7436/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_f52c4b8723f8dd33/libnvidia-ml.so.1]"
time=2024-04-19T00:05:17.758+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.171.04: nvml vram init failure: 9"
time=2024-04-19T00:05:17.762+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/lib/libnvidia-ml.so.1: nvml vram init failure: 9"
time=2024-04-19T00:05:17.831+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_059948e396d205d5/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:17.881+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_268e85175aa9e991/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:17.931+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_36f8a434e9b7b9f2/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:17.971+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_84b2c943d6816eb7/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:18.038+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_abf7e4e84f20581c/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:18.082+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_d1bd230cd08e7436/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:18.130+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/wsl/drivers/nv_dispi.inf_amd64_f52c4b8723f8dd33/libnvidia-ml.so.1: nvml vram init failure: 3"
time=2024-04-19T00:05:18.130+08:00 level=INFO source=cpu_common.go:11 msg="CPU has AVX2"
time=2024-04-19T00:05:18.131+08:00 level=INFO source=routes.go:1133 msg="no GPU detected"

导致的原因可能是机器休眠过了, wsl的虚拟机不知道如何重连gpu修改正方法是重启wsl,

wsl --shutdown

修复之后的log如下:

time=2024-04-19T00:07:52.288+08:00 level=INFO source=images.go:806 msg="total blobs: 37"
time=2024-04-19T00:07:52.297+08:00 level=INFO source=images.go:813 msg="total unused blobs removed: 0"
time=2024-04-19T00:07:52.297+08:00 level=INFO source=routes.go:1110 msg="Listening on 127.0.0.1:11434 (version 0.1.29)"
time=2024-04-19T00:07:52.299+08:00 level=INFO source=payload_common.go:112 msg="Extracting dynamic libraries to /tmp/ollama1882281951/runners ..."
time=2024-04-19T00:07:54.749+08:00 level=INFO source=payload_common.go:139 msg="Dynamic LLM libraries [cpu_avx2 rocm_v60000 cpu_avx cuda_v11 cpu]"
time=2024-04-19T00:07:54.749+08:00 level=INFO source=gpu.go:77 msg="Detecting GPU type"
time=2024-04-19T00:07:54.751+08:00 level=INFO source=gpu.go:191 msg="Searching for GPU management library libnvidia-ml.so"
time=2024-04-19T00:07:56.867+08:00 level=INFO source=gpu.go:237 msg="Discovered GPU libraries: [/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.171.04 /usr/lib/wsl/lib/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_059948e396d205d5/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_268e85175aa9e991/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_36f8a434e9b7b9f2/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_84b2c943d6816eb7/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_abf7e4e84f20581c/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_d1bd230cd08e7436/libnvidia-ml.so.1 /usr/lib/wsl/drivers/nv_dispi.inf_amd64_f52c4b8723f8dd33/libnvidia-ml.so.1]"
time=2024-04-19T00:07:56.878+08:00 level=INFO source=gpu.go:249 msg="Unable to load CUDA management library /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.171.04: nvml vram init failure: 9"
time=2024-04-19T00:07:56.927+08:00 level=INFO source=gpu.go:82 msg="Nvidia GPU detected"
time=2024-04-19T00:07:56.927+08:00 level=INFO source=cpu_common.go:11 msg="CPU has AVX2"
time=2024-04-19T00:07:56.941+08:00 level=INFO source=gpu.go:119 msg="CUDA Compute Capability detected: 8.6"
相关推荐
jianchwa8 分钟前
3.10 内核 BUG_ON() at xfs_vm_writepage() -> page_buffers()
linux·运维·bug
zqzgng8 分钟前
怎样安装和启动Apache HTTP服务器(httpd)和PHP?
linux·运维·服务器
SRC_BLUE_179 分钟前
UPLOAD LABS | PASS 01 - 绕过前端 JS 限制
开发语言·前端·javascript
NetX行者11 分钟前
Vue3+Typescript+Axios+.NetCore实现导出Excel文件功能
前端·typescript·c#·excel·.netcore
vvw&14 分钟前
如何在 Ubuntu 22.04 上安装 Metabase 数据可视化分析工具
linux·运维·服务器·ubuntu·信息可视化·数据可视化·metabase
美团测试工程师23 分钟前
Fiddler导出JMeter脚本插件原理
前端·jmeter·fiddler
网安CILLE1 小时前
2024下半年——【寒假】自学黑客计划(网络安全)
linux·网络·安全·web安全·网络安全·密码学·ddos
我是唐青枫1 小时前
Linux iptables 命令详解
linux·运维·网络
余生H1 小时前
Angular v19 (二):响应式当红实现signal的详细介绍:它擅长做什么、不能做什么?以及与vue、svelte、react等框架的响应式实现对比
前端·vue.js·react.js·angular.js
聚宝盆_1 小时前
【记录:前端提高用户体验】
前端·css