ai-suite-rocm-local/bitsandbytes-rocm-build/Dockerfile

40 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2024-06-30 22:06:23 +02:00
FROM rocm/dev-ubuntu-22.04:6.1.2
2024-08-19 18:43:30 +02:00
ENV ROCM_ARCH="gfx1030" \
TORCH_VERSION="rocm6.1" \
DEBIAN_FRONTEND=noninteractive \
2024-06-30 22:06:23 +02:00
PYTHONUNBUFFERED=1 \
2024-08-19 18:43:30 +02:00
PYTHONIOENCODING=UTF-8
2024-06-30 22:06:23 +02:00
WORKDIR /tmp
RUN apt-get update -y
2024-08-19 18:43:30 +02:00
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"
2024-06-30 22:06:23 +02:00
RUN pip3 install --upgrade pip wheel setuptools
2024-08-19 18:43:30 +02:00
2024-06-30 22:06:23 +02:00
# Install pytorch for rocm
2024-08-19 18:43:30 +02:00
RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/${TORCH_VERSION}
2024-06-30 22:06:23 +02:00
# ROCM bitsandbytes
RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev
## Clone repo and install python requirements
2024-08-19 18:43:30 +02:00
RUN git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git
2024-06-30 22:06:23 +02:00
WORKDIR /tmp/bitsandbytes
RUN pip3 install -r requirements-dev.txt
## Build
RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH}
RUN make
2024-08-19 18:43:30 +02:00
RUN python3.10 setup.py bdist_wheel --universal
2024-06-30 22:06:23 +02:00
# Cleanup
2024-06-30 22:19:28 +02:00
RUN apt-get clean && pip3 cache purge