Files
bdi_podman_serverconf/containers/vllm/rocm-librccl.Containerfile
T

62 строки
3.3 KiB
Docker

### Container di BUILD (non di runtime) per compilare RCCL dal monorepo UFFICIALE ROCm/rocm-systems (develop, projects/rccl) con lo script install.sh ufficiale, usando il toolchain ufficiale TheRock (piu' aggiornato della vecchia immagine AMD Ryzen AI).
### Base: immagine build manylinux di TheRock (AlmaLinux/RPM, non Ubuntu), con gcc-toolset-13/cmake/ninja/patchelf gia' pronti; il tarball ROCm ci aggiunge hipcc.
### TheRock supporta ufficialmente sia gfx1150 che gfx1151 (RDNA3.5, vedi SUPPORTED_GPUS.md): si puo' quindi buildare UN SOLO librccl.so con kernel per entrambe le architetture insieme.
###
### Uso raccomandato: ./build-librccl.sh (risolve/scarica/riusa la tarball ROCm, builda, estrae librccl.so.1.0 automaticamente).
###
### Uso manuale:
### podman build --pull=never --build-arg ROCM_VERSION=<versione> -t vllm:amd-rccl -f rocm-librccl.Containerfile .
### id=$(podman create vllm:amd-rccl)
### podman cp $id:/output/lib/librccl.so.1 ./librccl.so.1.0
### podman rm $id
FROM ghcr.io/rocm/therock_build_manylinux_x86_64:latest
ARG ROCM_VERSION=
ARG ROCM_AMDGPU_FAMILY=gfx110X-all
ARG ROCM_RELEASE_TYPE=nightlies
ARG GPU_TARGETS=gfx1150;gfx1151
ARG RCCL_REPO=https://github.com/ROCm/rocm-systems.git
ARG RCCL_BRANCH=develop
# Pacchetti RPM mancanti nella base manylinux, necessari per RCCL (equivalenti di libdrm-dev/libnuma-dev/pkg-config su Ubuntu).
RUN dnf install -y libdrm-devel numactl-devel pkgconfig \
&& dnf clean all
WORKDIR /build
# Se una tarball ROCm e' gia' presente accanto al Containerfile (scaricata da build-librccl.sh) la usiamo cosi' com'e', senza rifare il download in rete.
COPY rocm-librccl.Containerfile therock-dist-linux-*.tar.gz /opt/build-context/
RUN TARBALL=$(find /opt/build-context -maxdepth 1 -name 'therock-dist-linux-*.tar.gz' | head -1); \
if [ -n "$TARBALL" ]; then \
echo "Uso tarball ROCm locale: $TARBALL"; \
mkdir -p /opt/rocm-local; \
tar -xzf "$TARBALL" -C /opt/rocm-local; \
ln -sfn /opt/rocm-local /opt/rocm; \
else \
echo "Nessuna tarball locale trovata, scarico ed installo con lo script ufficiale TheRock"; \
if [ -z "${ROCM_VERSION}" ]; then echo "ERRORE: ROCM_VERSION richiesto quando non c'e' una tarball locale in /opt/build-context"; exit 1; fi; \
curl -fsSL -o /tmp/install_rocm_tarball.sh https://raw.githubusercontent.com/ROCm/TheRock/main/dockerfiles/install_rocm_tarball.sh; \
chmod +x /tmp/install_rocm_tarball.sh; \
/tmp/install_rocm_tarball.sh "${ROCM_VERSION}" "${ROCM_AMDGPU_FAMILY}" "${ROCM_RELEASE_TYPE}"; \
rm -f /tmp/install_rocm_tarball.sh; \
fi \
&& rm -rf /opt/build-context
ENV ROCM_PATH=/opt/rocm
ENV PATH=/opt/rocm/bin:$PATH
# Sparse checkout: il monorepo e' enorme, prendiamo solo projects/rccl.
RUN git clone --depth 1 --branch "${RCCL_BRANCH}" --filter=blob:none --sparse "${RCCL_REPO}" rocm-systems \
&& cd rocm-systems \
&& git sparse-checkout set projects/rccl \
&& git submodule update --init --recursive --depth=1 -- projects/rccl || true
# Script di build/install ufficiale del progetto; CMake vuole liste separate da ";" (non ",") per passare piu' target GPU in un solo binario.
RUN cd /build/rocm-systems/projects/rccl \
&& ./install.sh -i --amdgpu_targets="${GPU_TARGETS}" --prefix=/output -j "$(nproc)"
RUN echo "--- Output ---" \
&& find /output -iname 'librccl.so*' -exec ls -la {} \;