NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.35k stars 13.59k forks source link

ollama: oneapi version support? #327999

Open KenMacD opened 1 month ago

KenMacD commented 1 month ago

I see ollama has a cuda and rocm version. Ollama appears to support a oneapi version now. From some tests it appears this would require access to a libze_intel_gpu.so library, which I see in the intel-compute-runtime.drivers.

I tested setting OLLAMA_INTEL_GPU=1 (with OLLAMA_DEBUG=1) in the module settings and see the following logs:

ollama[x]: time=x level=DEBUG source=gpu.go:488 msg="discovered GPU libraries" paths=[]
ollama[x]: time=x level=DEBUG source=gpu.go:435 msg="Searching for GPU library" name=libze_intel_gpu.so
ollama[x]: time=x level=DEBUG source=gpu.go:454 msg="gpu library search" globs="[/var/lib/private/ollama/libze_intel_gpu.so* /usr/lib/x86_64-linux-gnu/libze_intel_gpu.so* /usr/lib*/libze_intel_gpu.so*]"

It'd be nice to see an intel/openapi/sycl support added.

abysssol commented 1 month ago

I agree that oneapi support appears to be a good idea, especially given the (admittedly unlikely) possibility of wider industry adoption by amd and nvidia. However, given my lack of access to a supported device for testing, combined with oneapi support being quite new in ollama, possibly being incomplete or buggy for now, as well as my lack of experience with oneapi at the moment, I wouldn't expect oneapi support particularly soon in nix; it'll probably be at least a couple weeks.

If you can help with testing, or want to open a pull request, I'd be happy to work together with you to add support sooner than I'd be able to do myself.

MordragT commented 1 month ago

I have it packaged for oneapi here https://github.com/MordragT/nixos/blob/master/pkgs/by-name/ollama-sycl/default.nix Iam pretty sure you will (if you want to compile from source) need the properitary dpcpp compiler or atleast intels open source llvm sycl compiler. My package uses the former. However I wanted to tryout the open source llvm sycl compiler first before I try to upstream it.