Dockerfile.cpu 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. # This Aphrodite Dockerfile is used to construct image that can build and run Aphrodite on x86 CPU platform.
  2. FROM ubuntu:22.04
  3. RUN apt-get update -y \
  4. && apt-get install -y git wget vim numactl gcc-12 g++-12 python3 python3-pip libtcmalloc-minimal4 \
  5. && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
  6. # https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/performance_tuning/tuning_guide.html
  7. # intel-openmp provides additional performance improvement vs. openmp
  8. # tcmalloc provides better memory allocation efficiency, e.g, holding memory in caches to speed up access of commonly-used objects.
  9. RUN pip install intel-openmp
  10. ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/usr/local/lib/libiomp5.so:$LD_PRELOAD"
  11. RUN pip install https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_dev/cpu/intel_extension_for_pytorch-2.3.100%2Bgit0eb3473-cp310-cp310-linux_x86_64.whl
  12. RUN pip install --upgrade pip \
  13. && pip install wheel packaging ninja "setuptools>=49.4.0" numpy
  14. COPY ./ /workspace/aphrodite-engine
  15. WORKDIR /workspace/aphrodite-engine
  16. RUN pip install -v -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu
  17. # Support for building with non-AVX512 Aphrodite:
  18. # docker build --build-arg APHRODITE_CPU_DISABLE_AVX512="true" ...
  19. ARG APHRODITE_CPU_DISABLE_AVX512
  20. ENV APHRODITE_CPU_DISABLE_AVX512=${APHRODITE_CPU_DISABLE_AVX512}
  21. RUN APHRODITE_TARGET_DEVICE=cpu python3 setup.py install
  22. RUN pip install -v triton
  23. WORKDIR /workspace/
  24. ENTRYPOINT ["python3", "-m", "aphrodite.endpoints.openai.api_server"]