Skip to content

Commit

Permalink
leave some vram for mkl lib used in ggml-sycl backend
Browse files Browse the repository at this point in the history
  • Loading branch information
zhewang1-intc committed May 10, 2024
1 parent 1dc38d5 commit f66d6f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN mkdir /tmp/scratch && \
(cd /tmp/scratch/ && tar czvf /go/src/github.com/ollama/ollama/dist/deps/ollama-linux-amd64-rocm.tgz . )


FROM --platform=linux/amd64 intel/oneapi-basekit:2024.0.1-devel-rockylinux9 AS oneapi-build-amd64
FROM --platform=linux/amd64 intel/oneapi-basekit:2024.1.1-devel-rockylinux9 AS oneapi-build-amd64
ARG CMAKE_VERSION
COPY ./scripts/rh_linux_deps.sh /
RUN CMAKE_VERSION=${CMAKE_VERSION} sh /rh_linux_deps.sh
Expand Down Expand Up @@ -147,7 +147,7 @@ CMD ["serve"]
# e.g. docker run -it -v "$(pwd):/app:Z" --device /dev/dri/renderD128:/dev/dri/renderD129 --device /dev/dri/card1:/dev/dri/card1 IMAGE_ID
# host machine need to install Intel GPU driver correctly.
# to detect the device info which you want to mount, run sudo intel_gpu_top -L
FROM --platform=linux/amd64 intel/oneapi-basekit:2024.0.1-devel-ubuntu22.04 as runtime-oneapi
FROM --platform=linux/amd64 intel/oneapi-basekit:2024.1.1-devel-ubuntu22.04 as runtime-oneapi
RUN update-pciids
COPY --from=build-amd64 /go/src/github.com/ollama/ollama/ollama /bin/ollama
EXPOSE 11434
Expand Down
2 changes: 2 additions & 0 deletions gpu/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ func GetGPUInfo() GpuInfo {
val = "DeviceType:gpu"
os.Setenv("SYCL_DEVICE_ALLOWLIST", val)
}
var totalFreeMem float64 = float64(memInfo.free) * 0.9 // leave some reverse vram for mkl lib used in ggml-sycl backend.
memInfo.free = C.uint64_t(totalFreeMem)
slog.Info(fmt.Sprintf("oneAPI integrated GPU detected - SYCL_DEVICE_ALLOWLIST=%s", val))
}
resp.Library = "oneapi"
Expand Down

0 comments on commit f66d6f5

Please sign in to comment.