@@ -23,6 +23,9 @@ RUN echo "FA_BRANCH is $FA_BRANCH"
23
23
# In that case, we need to use the python reference attention implementation in vllm
24
24
ARG BUILD_FA="1"
25
25
26
+ # whether to build cupy on rocm
27
+ ARG BUILD_CUPY="1"
28
+
26
29
# Install some basic utilities
27
30
RUN apt-get update && apt-get install python3 python3-pip -y
28
31
@@ -70,16 +73,33 @@ RUN if [ "$BUILD_FA" = "1" ]; then \
70
73
&& cd ..; \
71
74
fi
72
75
73
- COPY ./ /app/vllm
74
-
75
- RUN python3 -m pip install --upgrade pip
76
- RUN python3 -m pip install xformers==0.0.23 --no-deps
77
-
78
76
# Error related to odd state for numpy 1.20.3 where there is no METADATA etc, but an extra LICENSES_bundled.txt.
79
77
# Manually removed it so that later steps of numpy upgrade can continue
80
78
RUN if [ "$BASE_IMAGE" = "rocm/pytorch:rocm6.0_ubuntu20.04_py3.9_pytorch_2.1.1" ]; then \
81
79
rm -rf /opt/conda/envs/py_3.9/lib/python3.9/site-packages/numpy-1.20.3.dist-info/; fi
82
80
81
+ # build cupy
82
+ RUN if [ "$BUILD_CUPY" = "1" ]; then \
83
+ mkdir -p libs \
84
+ && cd libs \
85
+ && git clone -b hipgraph_enablement --recursive https://github.com/ROCm/cupy.git \
86
+ && cd cupy \
87
+ && pip install mpi4py-mpich \
88
+ && pip install scipy==1.9.3 \
89
+ && pip install cython==0.29.* \
90
+ && env CC=$MPI_HOME/bin/mpicc python -m pip install mpi4py \
91
+ && export CUPY_INSTALL_USE_HIP=1 \
92
+ && export ROCM_HOME=/opt/rocm \
93
+ && export HCC_AMDGPU_TARGET="gfx90a,gfx942,gfx1100" \
94
+ && pip install . \
95
+ && cd ..; \
96
+ fi
97
+
98
+ COPY ./ /app/vllm
99
+
100
+ RUN python3 -m pip install --upgrade pip
101
+ RUN python3 -m pip install xformers==0.0.23 --no-deps
102
+
83
103
RUN cd /app \
84
104
&& cd vllm \
85
105
&& pip install -U -r requirements-rocm.txt \
0 commit comments