update bitsandbytes build script

This commit is contained in:
Mathieu Broillet 2024-08-19 18:43:30 +02:00
parent 7417e9e5d1
commit c90ace69e8
Signed by: mathieu
GPG Key ID: A08E484FE95074C1
2 changed files with 17 additions and 11 deletions

View File

@ -1,33 +1,39 @@
FROM rocm/dev-ubuntu-22.04:6.1.2 FROM rocm/dev-ubuntu-22.04:6.1.2
ENV DEBIAN_FRONTEND=noninteractive \ ENV ROCM_ARCH="gfx1030" \
TORCH_VERSION="rocm6.1" \
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \ PYTHONIOENCODING=UTF-8
ROCM_ARCH="gfx1030"
WORKDIR /tmp WORKDIR /tmp
RUN apt-get update -y RUN apt-get update -y
RUN apt-get install -y wget git cron cmake make RUN apt-get install -y wget git cron cmake make software-properties-common
# Install python3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-get update -y
RUN apt-get install -y python3.10 python3.10-dev python3.10-venv
ENV VIRTUAL_ENV=/opt/venv
RUN python3.10 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install python3
RUN apt-get install -y python3 python3-dev
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3
RUN pip3 install --upgrade pip wheel setuptools RUN pip3 install --upgrade pip wheel setuptools
# Install pytorch for rocm # Install pytorch for rocm
RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.1 RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/${TORCH_VERSION}
# ROCM bitsandbytes # ROCM bitsandbytes
RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev
## Clone repo and install python requirements ## Clone repo and install python requirements
RUN git clone --recurse https://github.com/ROCm/bitsandbytes RUN git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git
WORKDIR /tmp/bitsandbytes WORKDIR /tmp/bitsandbytes
RUN git checkout rocm_enabled
RUN pip3 install -r requirements-dev.txt RUN pip3 install -r requirements-dev.txt
## Build ## Build
RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH} RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH}
RUN make RUN make
RUN python3 setup.py bdist_wheel --universal RUN python3.10 setup.py bdist_wheel --universal
# Cleanup # Cleanup
RUN apt-get clean && pip3 cache purge RUN apt-get clean && pip3 cache purge