ollama: Add needed rocm libraries to rocmPath#297447
Conversation
|
Result of |
|
What does this fix? 0.1.29 superficially seems to be working fine already? |
It's currently broken on master when building with |
|
@ulrikstrid Thank you for this. It seems strange that ollama lost the ability to detect libraries exposed through Unfortunately, this isn't a complete fix. While ollama seems to build correctly now, it doesn't detect the rocm libraries at runtime. So, it still can't use the gpu, and falls back to cpu mode. I did try adding all the rocm libs to the wrapper script, but that didn't do anything. This is good progress, and I'm happy to see it. It looks ready to merge to me. |
fe394b7 to
0930514
Compare
|
I changed the commit, I'm going to play a bit with the the environment to see if I can make it run on the GPU. If not this should be OK to merge and I can create a followup PR if I figure it out. |
|
According to this comment we need rocm v6: ollama/ollama#738 (comment) Is that OK by you @drupol ? |
|
Of course ! Thank you ! |
|
I tried using nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/af67cfa87bed7fd62812aa888cd134412c9e6d75.tar.gz -p ollama
ollama serveWhile this doesn't have the same rocm v6 issue, it doesn't seem to find the rocm libraries either AFAICT. Here's what I see: HSA_OVERRIDE_GFX_VERSION=10.3.0 ollama serve
time=2024-04-06T22:32:39.267+01:00 level=INFO source=images.go:710 msg="total blobs: 5"
time=2024-04-06T22:32:39.267+01:00 level=INFO source=images.go:717 msg="total unused blobs removed: 0"
time=2024-04-06T22:32:39.268+01:00 level=INFO source=routes.go:1021 msg="Listening on 127.0.0.1:11434 (version 0.1.28)"
time=2024-04-06T22:32:39.268+01:00 level=INFO source=payload_common.go:107 msg="Extracting dynamic libraries..."
time=2024-04-06T22:32:39.290+01:00 level=INFO source=payload_common.go:146 msg="Dynamic LLM libraries [cpu_avx cpu_avx2 cpu]"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=gpu.go:94 msg="Detecting GPU type"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=gpu.go:265 msg="Searching for GPU management library libnvidia-ml.so"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=gpu.go:311 msg="Discovered GPU libraries: []"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=gpu.go:265 msg="Searching for GPU management library librocm_smi64.so"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=gpu.go:311 msg="Discovered GPU libraries: []"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=cpu_common.go:11 msg="CPU has AVX2"
time=2024-04-06T22:32:39.290+01:00 level=INFO source=routes.go:1044 msg="no GPU detected"Might this be because |
@dchambers yes, it compiled without gpu support. I never added support for reading Is there anything stopping you from using the current version of ollama (0.1.30) that's in nixpkgs-unstable? As far as I know, rocm is working correctly now. If 0.1.30 compiled with |
|
Thanks so much @abysssol, that did it! 🎉 In case any other NixOS noobs come this way in the future, here's the config I added to my nixpkgs.overlays = [
(final: prev: {
ollama = prev.ollama.override { acceleration = "rocm"; };
})
]; |
|
@dchambers I'm not sure if I'm missing some important context or something, but shouldn't the nixos service be the most convenient way to use ollama? services.ollama = {
enable = true;
acceleration = "rocm";
# optional: if using stable nixos, you can override the stable, outdated version with the unstable version
package = unstable.ollama;
}; |
Nice, I had no idea you could do that! Thanks again for your help @abysssol 🙇 |
Description of changes
Since version
0.1.29more ROCm libraries are needed in the environment.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.