Updating toolboxes with a two-stage build process to reduce size
This commit is contained in:
@@ -1,38 +1,58 @@
|
||||
FROM fedora:rawhide
|
||||
# build
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# Install build dependencies and tools
|
||||
RUN dnf install -y \
|
||||
# deps + rocm toolchain
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' 'hipblas' 'hipblas-*' \
|
||||
git vim \
|
||||
&& dnf clean all
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' hipblas 'hipblas-*' \
|
||||
git vim rsync sudo tar xz \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# Set up working directory
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp repository (with submodules)
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build llama.cpp with HIP support
|
||||
# build + install
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& \
|
||||
# Configure and compile with HIP toolchain
|
||||
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# make ld see libllama in builder too (kept same step)
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
|
||||
# runtime
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# runtime deps (same rocm packages; no build toolchain)
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' hipblas 'hipblas-*' \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# bits from builder
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
COPY --from=builder /usr/include/rocwmma /usr/include/rocwmma
|
||||
|
||||
# ensure libllama is on the linker path
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# Default to interactive shell
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,45 +1,65 @@
|
||||
FROM fedora:rawhide
|
||||
# build
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# Install build dependencies and tools
|
||||
RUN dnf install -y \
|
||||
# deps + rocm toolchain
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' 'hipblas' 'hipblas-*' \
|
||||
git vim rsync \
|
||||
&& dnf clean all
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' hipblas 'hipblas-*' \
|
||||
git vim rsync sudo tar xz \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
|
||||
WORKDIR /opt/
|
||||
# rocWMMA headers
|
||||
WORKDIR /opt
|
||||
RUN git clone -b release/rocm-rel-7.0 https://github.com/ROCm/rocWMMA.git
|
||||
RUN sudo mkdir -p /usr/include/rocwmma
|
||||
RUN sudo rsync -a rocWMMA/library/include/rocwmma/ /usr/include/rocwmma/
|
||||
|
||||
# Set up working directory
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp repository (with submodules)
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build llama.cpp with HIP support
|
||||
# build + install
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& \
|
||||
# Configure and compile with HIP toolchain
|
||||
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# make ld see libllama in builder too (kept same step)
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
|
||||
# runtime
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# runtime deps (same rocm packages; no build toolchain)
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
rocminfo radeontop 'rocm-*' 'rocblas-*' hipblas 'hipblas-*' \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# bits from builder
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
COPY --from=builder /usr/include/rocwmma /usr/include/rocwmma
|
||||
|
||||
# ensure libllama is on the linker path
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# Default to interactive shell
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
FROM fedora:rawhide
|
||||
# build stage
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# getting Rocm6.4.3 repos
|
||||
RUN <<EOF
|
||||
# rocm 6.4.3 repo
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-6.4.3]
|
||||
name=ROCm6.4.3
|
||||
@@ -11,48 +12,83 @@ priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
|
||||
EOF
|
||||
|
||||
# Install build dependencies and tools
|
||||
RUN dnf install -y \
|
||||
# deps
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
rocm rocminfo radeontop \
|
||||
git vim \
|
||||
&& dnf clean all
|
||||
git vim sudo rsync \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# Set up working directory
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp repository (with submodules)
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build llama.cpp with HIP support
|
||||
# build
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& \
|
||||
# Configure and compile with HIP toolchain
|
||||
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# libs
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
RUN printf '%s\n' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# Default to interactive shell
|
||||
|
||||
# runtime stage
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# rocm 6.4.3 repo
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-6.4.3]
|
||||
name=ROCm6.4.3
|
||||
baseurl=https://repo.radeon.com/rocm/el9/6.4.3/main
|
||||
enabled=1
|
||||
priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
EOF
|
||||
|
||||
# runtime deps
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
rocm rocminfo radeontop \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# copy
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
COPY --from=builder /usr/include/rocwmma /usr/include/rocwmma
|
||||
|
||||
# ld
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# profile
|
||||
RUN printf '%s\n' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh && chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
FROM fedora:rawhide
|
||||
# build stage
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# getting Rocm6.4.3 repos
|
||||
RUN <<EOF
|
||||
# rocm 6.4.3 repo
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-6.4.3]
|
||||
name=ROCm6.4.3
|
||||
@@ -11,55 +12,90 @@ priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
|
||||
EOF
|
||||
|
||||
# Install build dependencies and tools
|
||||
RUN dnf install -y \
|
||||
# deps
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
rocm rocminfo radeontop \
|
||||
git vim \
|
||||
&& dnf clean all
|
||||
git vim sudo rsync \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
|
||||
WORKDIR /opt/
|
||||
# rocWMMA
|
||||
WORKDIR /opt
|
||||
RUN git clone -b release/rocm-rel-7.0 https://github.com/ROCm/rocWMMA.git
|
||||
RUN sudo mkdir -p /usr/include/rocwmma
|
||||
RUN sudo cp -r rocWMMA/library/include/rocwmma /usr/include/
|
||||
|
||||
# Set up working directory
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp repository (with submodules)
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build llama.cpp with HIP support
|
||||
# build
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& \
|
||||
# Configure and compile with HIP toolchain
|
||||
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# libs
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
|
||||
# runtime stage
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# rocm 6.4.3 repo
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-6.4.3]
|
||||
name=ROCm6.4.3
|
||||
baseurl=https://repo.radeon.com/rocm/el9/6.4.3/main
|
||||
enabled=1
|
||||
priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
EOF
|
||||
|
||||
# runtime deps
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
rocm rocminfo radeontop \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# copy
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
COPY --from=builder /usr/include/rocwmma /usr/include/rocwmma
|
||||
|
||||
# ld
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# profile
|
||||
RUN printf '%s\n' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
> /etc/profile.d/rocm.sh && chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# Default to interactive shell
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
FROM fedora:rawhide
|
||||
# build stage
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# getting Rocm7 repos
|
||||
RUN <<EOF
|
||||
# rocm 7.0 repos
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-7.0.0]
|
||||
name=ROCm7.0.0
|
||||
@@ -21,49 +22,92 @@ priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
|
||||
EOF
|
||||
|
||||
# Install build dependencies and tools
|
||||
RUN dnf install -y \
|
||||
# deps
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
rocm rocminfo radeontop \
|
||||
git vim \
|
||||
&& dnf clean all
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# Set up working directory
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp repository (with submodules)
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build llama.cpp with HIP support
|
||||
# build
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& \
|
||||
# Configure and compile with HIP toolchain
|
||||
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
&& HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# libs
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# Ensure we are using hipblaslt
|
||||
|
||||
# runtime stage
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# rocm 7.0 repos
|
||||
RUN <<'EOF'
|
||||
tee /etc/yum.repos.d/rocm.repo <<REPO
|
||||
[ROCm-7.0.0]
|
||||
name=ROCm7.0.0
|
||||
baseurl=https://repo.radeon.com/rocm/el9/7.0_beta/main
|
||||
enabled=1
|
||||
priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
|
||||
tee /etc/yum.repos.d/rocm-graphics.repo <<REPO
|
||||
[ROCm-7.0.0-Graphics]
|
||||
name=ROCm7.0.0-Graphics
|
||||
baseurl=https://repo.radeon.com/graphics/7.0_beta/rhel/9/main/x86_64/
|
||||
enabled=1
|
||||
priority=50
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
|
||||
REPO
|
||||
EOF
|
||||
|
||||
# runtime deps
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
rocm rocminfo radeontop \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# copy
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
|
||||
# ld
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# profile
|
||||
RUN printf '%s\n' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
> /etc/profile.d/rocm.sh && chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# Default to interactive shell
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
FROM fedora:rawhide
|
||||
# build
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# 1) Install dependencies
|
||||
RUN dnf install -y \
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
radeontop git vim patch curl \
|
||||
&& dnf clean all
|
||||
radeontop git vim patch curl ninja-build tar xz \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# 2) Download ROCm nightly tarball
|
||||
WORKDIR /tmp
|
||||
RUN curl -L -o therock.tar.gz \
|
||||
https://therock-nightly-tarball.s3.amazonaws.com/therock-dist-linux-gfx1151-7.0.0rc20250811.tar.gz
|
||||
|
||||
# 3) Extract into /opt/rocm-7.0
|
||||
RUN mkdir -p /opt/rocm-7.0 \
|
||||
&& tar xvf therock.tar.gz -C /opt/rocm-7.0 --strip-components=1
|
||||
&& tar xzf therock.tar.gz -C /opt/rocm-7.0 --strip-components=1
|
||||
|
||||
# 4) Bake in ROCm env + full system PATH
|
||||
ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
HIP_PLATFORM=amd \
|
||||
HIP_PATH=/opt/rocm-7.0 \
|
||||
@@ -29,7 +25,6 @@ ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
CPATH=/opt/rocm-7.0/include \
|
||||
PKG_CONFIG_PATH=/opt/rocm-7.0/lib/pkgconfig
|
||||
|
||||
# 5) profile.d snippet for login & interactive shells
|
||||
RUN printf '%s\n' \
|
||||
'export ROCM_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_PLATFORM=amd' \
|
||||
@@ -48,32 +43,73 @@ RUN printf '%s\n' \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# 6) Clone llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git . \
|
||||
&& git clean -xdf \
|
||||
&& git submodule update --recursive
|
||||
|
||||
# 7) Copy in your external patch and apply
|
||||
COPY hip-rocm7rc.patch /opt/llama.cpp/hip-rocm7rc.patch
|
||||
RUN patch -p1 < hip-rocm7rc.patch
|
||||
|
||||
# 8) Configure, build & install llama.cpp with HIP
|
||||
RUN cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# 9) Copy the .so from build/bin into /usr/lib64 so ldconfig can see it
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
# keep bin; drop headers/docs/static libs; drop source tree
|
||||
RUN find /opt/rocm-7.0 -type f -name '*.a' -delete \
|
||||
&& rm -rf /opt/rocm-7.0/include /opt/rocm-7.0/share \
|
||||
/opt/rocm-7.0/llvm/include /opt/rocm-7.0/llvm/share \
|
||||
&& rm -rf /opt/llama.cpp
|
||||
|
||||
# runtime
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc radeontop vim \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
COPY --from=builder /opt/rocm-7.0 /opt/rocm-7.0
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
|
||||
# 10) Install helper script
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# 11) Default to interactive bash
|
||||
ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
HIP_PLATFORM=amd \
|
||||
HIP_PATH=/opt/rocm-7.0 \
|
||||
HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin \
|
||||
HIP_INCLUDE_PATH=/opt/rocm-7.0/include \
|
||||
HIP_LIB_PATH=/opt/rocm-7.0/lib \
|
||||
HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode \
|
||||
PATH=/opt/rocm-7.0/bin:/opt/rocm-7.0/llvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
LD_LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64:/opt/rocm-7.0/llvm/lib \
|
||||
LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64 \
|
||||
CPATH=/opt/rocm-7.0/include \
|
||||
PKG_CONFIG_PATH=/opt/rocm-7.0/lib/pkgconfig
|
||||
|
||||
RUN printf '%s\n' \
|
||||
'export ROCM_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_PLATFORM=amd' \
|
||||
'export HIP_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin' \
|
||||
'export HIP_INCLUDE_PATH=/opt/rocm-7.0/include' \
|
||||
'export HIP_LIB_PATH=/opt/rocm-7.0/lib' \
|
||||
'export HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode' \
|
||||
'export PATH="$ROCM_PATH/bin:$HIP_CLANG_PATH:$PATH"' \
|
||||
'export LD_LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64:$ROCM_PATH/llvm/lib"' \
|
||||
'export LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64"' \
|
||||
'export CPATH="$HIP_INCLUDE_PATH"' \
|
||||
'export PKG_CONFIG_PATH="$ROCM_PATH/lib/pkgconfig"' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# make /usr/local libs visible without touching env
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
FROM fedora:rawhide
|
||||
# build
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# 1) Install dependencies
|
||||
RUN dnf install -y \
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
radeontop git vim patch curl ninja-build \
|
||||
&& dnf clean all
|
||||
radeontop git vim patch curl ninja-build tar xz \
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# 2) Download ROCm nightly tarball
|
||||
WORKDIR /tmp
|
||||
RUN curl -L -o therock.tar.gz \
|
||||
https://therock-nightly-tarball.s3.amazonaws.com/therock-dist-linux-gfx1151-7.0.0rc20250811.tar.gz
|
||||
|
||||
# 3) Extract into /opt/rocm-7.0
|
||||
RUN mkdir -p /opt/rocm-7.0 \
|
||||
&& tar xvf therock.tar.gz -C /opt/rocm-7.0 --strip-components=1
|
||||
&& tar xzf therock.tar.gz -C /opt/rocm-7.0 --strip-components=1
|
||||
|
||||
# 4) Bake in ROCm env + full system PATH
|
||||
ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
HIP_PLATFORM=amd \
|
||||
HIP_PATH=/opt/rocm-7.0 \
|
||||
@@ -29,7 +25,6 @@ ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
CPATH=/opt/rocm-7.0/include \
|
||||
PKG_CONFIG_PATH=/opt/rocm-7.0/lib/pkgconfig
|
||||
|
||||
# 5) profile.d snippet for login & interactive shells
|
||||
RUN printf '%s\n' \
|
||||
'export ROCM_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_PLATFORM=amd' \
|
||||
@@ -48,28 +43,17 @@ RUN printf '%s\n' \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# Install rocwmma
|
||||
WORKDIR /opt/
|
||||
WORKDIR /opt
|
||||
COPY ./build-rocwmma.sh .
|
||||
RUN chmod +x build-rocwmma.sh
|
||||
RUN ./build-rocwmma.sh
|
||||
RUN chmod +x build-rocwmma.sh && ./build-rocwmma.sh
|
||||
|
||||
# 6) Clone llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git . \
|
||||
&& git clean -xdf \
|
||||
&& git submodule update --recursive
|
||||
COPY ./apply-rocwmma-fix.sh /opt/apply-rocwmma-fix.sh
|
||||
RUN chmod +x /opt/apply-rocwmma-fix.sh && /opt/apply-rocwmma-fix.sh /opt/llama.cpp
|
||||
|
||||
# Apply PAtch for rocwmma
|
||||
COPY ./apply-rocwmma-fix.sh /opt
|
||||
RUN chmod +x /opt/apply-rocwmma-fix.sh
|
||||
RUN /opt/apply-rocwmma-fix.sh /opt/llama.cpp
|
||||
|
||||
# 7) Apply patchpatch and apply
|
||||
COPY hip-rocm7rc.patch /opt/llama.cpp/hip-rocm7rc.patch
|
||||
RUN patch -p1 < hip-rocm7rc.patch
|
||||
|
||||
# 8) Configure, build & install llama.cpp with HIP
|
||||
RUN cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
@@ -79,13 +63,59 @@ RUN cmake -S . -B build \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# 9) Copy the .so from build/bin into /usr/lib64 so ldconfig can see it
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
# keep bin; drop headers/docs/static libs; drop source tree
|
||||
RUN find /opt/rocm-7.0 -type f -name '*.a' -delete \
|
||||
&& rm -rf /opt/rocm-7.0/include /opt/rocm-7.0/share \
|
||||
/opt/rocm-7.0/llvm/include /opt/rocm-7.0/llvm/share \
|
||||
&& rm -rf /opt/llama.cpp
|
||||
|
||||
# runtime
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc radeontop vim \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
COPY --from=builder /opt/rocm-7.0 /opt/rocm-7.0
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
|
||||
# 10) Install helper script
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# 11) Default to interactive bash
|
||||
ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
HIP_PLATFORM=amd \
|
||||
HIP_PATH=/opt/rocm-7.0 \
|
||||
HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin \
|
||||
HIP_INCLUDE_PATH=/opt/rocm-7.0/include \
|
||||
HIP_LIB_PATH=/opt/rocm-7.0/lib \
|
||||
HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode \
|
||||
PATH=/opt/rocm-7.0/bin:/opt/rocm-7.0/llvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
LD_LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64:/opt/rocm-7.0/llvm/lib \
|
||||
LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64 \
|
||||
CPATH=/opt/rocm-7.0/include \
|
||||
PKG_CONFIG_PATH=/opt/rocm-7.0/lib/pkgconfig
|
||||
|
||||
RUN printf '%s\n' \
|
||||
'export ROCM_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_PLATFORM=amd' \
|
||||
'export HIP_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin' \
|
||||
'export HIP_INCLUDE_PATH=/opt/rocm-7.0/include' \
|
||||
'export HIP_LIB_PATH=/opt/rocm-7.0/lib' \
|
||||
'export HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode' \
|
||||
'export PATH="$ROCM_PATH/bin:$HIP_CLANG_PATH:$PATH"' \
|
||||
'export LD_LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64:$ROCM_PATH/llvm/lib"' \
|
||||
'export LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64"' \
|
||||
'export CPATH="$HIP_INCLUDE_PATH"' \
|
||||
'export PKG_CONFIG_PATH="$ROCM_PATH/lib/pkgconfig"' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# make /usr/local libs visible without touching env
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
FROM fedora:rawhide
|
||||
# build stage
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# Install build tools, Vulkan headers/loader, and glslc
|
||||
RUN dnf install --refresh -y \
|
||||
# deps
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
git vim \
|
||||
make gcc cmake ninja-build lld clang clang-devel compiler-rt libcurl-devel \
|
||||
vulkan-loader-devel vulkaninfo mesa-vulkan-drivers \
|
||||
radeontop glslc wget \
|
||||
&& dnf clean all
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# Get AMDVLK drivers
|
||||
# amdvlk
|
||||
RUN curl -L -o /tmp/amdvlk-2025.Q2.1.x86_64.rpm \
|
||||
https://github.com/GPUOpen-Drivers/AMDVLK/releases/download/v-2025.Q2.1/amdvlk-2025.Q2.1.x86_64.rpm
|
||||
RUN dnf install -y /tmp/amdvlk-*.rpm
|
||||
https://github.com/GPUOpen-Drivers/AMDVLK/releases/download/v-2025.Q2.1/amdvlk-2025.Q2.1.x86_64.rpm \
|
||||
&& dnf -y install /tmp/amdvlk-*.rpm \
|
||||
&& rm -f /tmp/amdvlk-*.rpm
|
||||
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build with Vulkan support
|
||||
# build
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
@@ -32,10 +33,43 @@ RUN git clean -xdf \
|
||||
&& cmake --build build --config Release \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# libs
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
# runtime stage
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# runtime deps
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
vulkan-loader vulkan-loader-devel vulkaninfo mesa-vulkan-drivers radeontop \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# amdvlk
|
||||
RUN curl -L -o /tmp/amdvlk-2025.Q2.1.x86_64.rpm \
|
||||
https://github.com/GPUOpen-Drivers/AMDVLK/releases/download/v-2025.Q2.1/amdvlk-2025.Q2.1.x86_64.rpm \
|
||||
&& microdnf -y install /tmp/amdvlk-*.rpm \
|
||||
&& rm -f /tmp/amdvlk-*.rpm
|
||||
|
||||
# copy
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
|
||||
# ld
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
FROM fedora:rawhide
|
||||
# build stage
|
||||
FROM registry.fedoraproject.org/fedora:rawhide AS builder
|
||||
|
||||
# Install build tools, Vulkan headers/loader, and glslc
|
||||
RUN dnf install --refresh -y \
|
||||
# deps
|
||||
RUN dnf -y --nodocs --setopt=install_weak_deps=False install \
|
||||
git vim \
|
||||
make gcc cmake ninja-build lld clang clang-devel compiler-rt libcurl-devel \
|
||||
vulkan-loader-devel vulkaninfo mesa-vulkan-drivers \
|
||||
radeontop glslc \
|
||||
&& dnf clean all
|
||||
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
|
||||
# Clone llama.cpp
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
|
||||
|
||||
# Build with Vulkan support
|
||||
# build
|
||||
RUN git clean -xdf \
|
||||
&& git pull \
|
||||
&& git submodule update --recursive \
|
||||
@@ -27,10 +27,37 @@ RUN git clean -xdf \
|
||||
&& cmake --build build --config Release \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# libs
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
# runtime stage
|
||||
FROM registry.fedoraproject.org/fedora-minimal:rawhide
|
||||
|
||||
# runtime deps
|
||||
RUN microdnf -y --nodocs --setopt=install_weak_deps=0 install \
|
||||
bash ca-certificates libatomic libstdc++ libgcc \
|
||||
vulkan-loader vulkan-loader-devel vulkaninfo mesa-vulkan-drivers radeontop \
|
||||
&& microdnf clean all && rm -rf /var/cache/dnf/*
|
||||
|
||||
# copy
|
||||
COPY --from=builder /usr/local/ /usr/local/
|
||||
|
||||
# ld
|
||||
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf \
|
||||
&& echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local.conf \
|
||||
&& ldconfig \
|
||||
&& cp -n /usr/local/lib/libllama*.so* /usr/lib64/ 2>/dev/null || true \
|
||||
&& ldconfig
|
||||
|
||||
# helper
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# shell
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
Reference in New Issue
Block a user