之前还能有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"