Auto-detect best GPU (RTX 5060 preferred) + build CuPy from source for sm_120
This commit is contained in:
20
Dockerfile
20
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
|
||||
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
@ -45,15 +45,15 @@ RUN pip3 install --no-cache-dir \
|
||||
pillow-avif-plugin \
|
||||
cmcrameri
|
||||
|
||||
# Install CuPy for GPU acceleration (optional - will fallback to numpy if not available)
|
||||
# We use CuPy 13.4 (CUDA 11.x wheel) because CuPy 14.x dropped JIT compilation
|
||||
# support. With CUPY_CUDA_COMPILE_WITH_CACHE=1, CuPy 13.4 compiles kernels at
|
||||
# runtime for GPU architectures not in the pre-built wheel (e.g. sm_89 / RTX 4060 Ti).
|
||||
# The devel image includes nvcc, required for JIT compilation.
|
||||
# nvcc stays in PATH for the 'lidar' user.
|
||||
ENV CUPY_CUDA_COMPILE_WITH_CACHE=1
|
||||
ENV PATH=/usr/local/cuda/bin:${PATH}
|
||||
RUN pip3 install --no-cache-dir cupy-cuda11x==13.4.0 || echo "CuPy not available - GPU acceleration disabled"
|
||||
# Build CuPy from source with nvcc, targeting sm_120 (RTX 5060) and nearby archs.
|
||||
# Pre-built wheels (cupy-cuda12x 14.x) don't include sm_120, so we compile.
|
||||
# This step takes ~30 min the first time; the image is cached after that.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git && \
|
||||
git clone --depth 1 --branch v14.0.0 https://github.com/cupy/cupy.git /tmp/cupy-src && \
|
||||
cd /tmp/cupy-src && \
|
||||
CUPY_NVCC_GENERATE_CODE='sm_89;sm_90;sm_120' \
|
||||
pip3 install --no-cache-dir -e . && \
|
||||
rm -rf /tmp/cupy-src
|
||||
|
||||
# Copy and install the pipeline package
|
||||
COPY setup.py .
|
||||
|
||||
Reference in New Issue
Block a user