Docker: added build args for non AVX2 CPU (#5154)

This commit is contained in:
Adam Florizone 2024-01-03 18:43:02 -05:00 committed by GitHub
parent b80e6365d0
commit 894e1a0700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -4,6 +4,23 @@ services:
build: build:
context: . context: .
args: args:
# Requirements file to use:
# | GPU | CPU | requirements file to use |
# |--------|---------|---------|
# | NVIDIA | has AVX2 | `requirements.txt` |
# | NVIDIA | no AVX2 | `requirements_noavx2.txt` |
# | AMD | has AVX2 | `requirements_amd.txt` |
# | AMD | no AVX2 | `requirements_amd_noavx2.txt` |
# | CPU only | has AVX2 | `requirements_cpu_only.txt` |
# | CPU only | no AVX2 | `requirements_cpu_only_noavx2.txt` |
# | Apple | Intel | `requirements_apple_intel.txt` |
# | Apple | Apple Silicon | `requirements_apple_silicon.txt` |
# Default: requirements.txt`
# BUILD_REQUIREMENTS: requirements.txt
# Extension requirements to build:
# BUILD_EXTENSIONS:
# specify which cuda version your card supports: https://developer.nvidia.com/cuda-gpus # specify which cuda version your card supports: https://developer.nvidia.com/cuda-gpus
TORCH_CUDA_ARCH_LIST: ${TORCH_CUDA_ARCH_LIST:-7.5} TORCH_CUDA_ARCH_LIST: ${TORCH_CUDA_ARCH_LIST:-7.5}
BUILD_EXTENSIONS: ${BUILD_EXTENSIONS:-} BUILD_EXTENSIONS: ${BUILD_EXTENSIONS:-}

View File

@ -3,6 +3,7 @@ FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 as builder
WORKDIR /builder WORKDIR /builder
ARG TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX}" ARG TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX}"
ARG BUILD_EXTENSIONS="${BUILD_EXTENSIONS:-}" ARG BUILD_EXTENSIONS="${BUILD_EXTENSIONS:-}"
ARG BUILD_REQUIREMENTS="${BUILD_REQUIREMENTS:-requirements.txt}"
ARG APP_UID="${APP_UID:-6972}" ARG APP_UID="${APP_UID:-6972}"
ARG APP_GID="${APP_GID:-6972}" ARG APP_GID="${APP_GID:-6972}"
# create / update build env # create / update build env
@ -18,7 +19,7 @@ RUN --mount=type=cache,target=/root/.cache/pip,rw \
USER app:app_grp USER app:app_grp
# build wheels for runtime # build wheels for runtime
WORKDIR /home/app/build WORKDIR /home/app/build
COPY --chown=app:app_grp requirements.txt /home/app/build COPY --chown=app:app_grp "$BUILD_REQUIREMENTS" /home/app/build/requirements.txt
COPY --chown=app:app_grp extensions /home/app/build/extensions COPY --chown=app:app_grp extensions /home/app/build/extensions
RUN --mount=type=cache,target=/root/.cache/pip,rw \ RUN --mount=type=cache,target=/root/.cache/pip,rw \
# build all requirements files as wheel dists # build all requirements files as wheel dists