Refresh Dockerfile and instructions.

Related to https://github.com/llvm/mlir-npcomp/issues/266
pull/268/head
Sean Silva 2021-08-03 14:54:11 -07:00
parent 453e29ea05
commit a153cf4ef2
2 changed files with 11 additions and 13 deletions

View File

@ -167,7 +167,7 @@ Shell into docker image:
```shell ```shell
docker run \ docker run \
--mount type=bind,source=$HOME/src/mlir-npcomp,target=/src/mlir-npcomp \ --mount type=bind,source=path/to/mlir-npcomp,target=/src/mlir-npcomp \
--mount source=npcomp-build,target=/build \ --mount source=npcomp-build,target=/build \
--rm -it local/npcomp:build-pytorch-nightly /bin/bash --rm -it local/npcomp:build-pytorch-nightly /bin/bash
``` ```
@ -177,7 +177,7 @@ Build/test npcomp (from within docker image):
```shell ```shell
# From within the docker image. # From within the docker image.
cd /src/mlir-npcomp cd /src/mlir-npcomp
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DNPCOMP_ENABLE_PYTORCH=ON . cmake -GNinja -B/build/npcomp -DCMAKE_BUILD_TYPE=Release -DNPCOMP_ENABLE_PYTORCH=ON .
cmake --build /build/npcomp --target check-npcomp check-frontends-pytorch cmake --build /build/npcomp --target check-npcomp check-frontends-pytorch
``` ```

View File

@ -1,15 +1,14 @@
FROM ubuntu:20.04 FROM ubuntu:20.04
MAINTAINER Stella Laurenzo <stellaraccident@gmail.com> LABEL org.opencontainers.image.authors="Stella Laurenzo <stellaraccident@gmail.com>, Sean Silva <silvasean@google.com>"
USER root USER root
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt update RUN apt-get update
# Python and build system. # Python and build system.
RUN apt install -y python3 python-is-python3 RUN apt-get install -y python-is-python3 python3-pip
RUN apt install -y python3-pip RUN apt-get install -y git cmake ccache ninja-build
RUN apt install -y git cmake ccache ninja-build RUN apt-get install -y clang lld
RUN apt install -y clang lld
RUN ln -s /usr/bin/llvm-symbolizer-10 /usr/bin/llvm-symbolizer RUN ln -s /usr/bin/llvm-symbolizer-10 /usr/bin/llvm-symbolizer
# Install PyTorch # Install PyTorch
@ -20,14 +19,13 @@ RUN pip3 install --pre torch torchvision -f https://download.pytorch.org/whl/nig
RUN ln -s /usr/local/lib/python3.8/dist-packages/torch /pytorch RUN ln -s /usr/local/lib/python3.8/dist-packages/torch /pytorch
# Build configuration # Build configuration
RUN mkdir /ccache && ln -s /usr/bin/ccache /ccache/clang && ln -s /usr/bin/ccache /ccache/clang++ RUN mkdir /build && chmod a+rw /build
RUN mkdir /build && chmod a+rw /build /ccache
ENV PATH "/ccache:${PATH}"
ENV CC clang ENV CC clang
ENV CXX clang++ ENV CXX clang++
# Binary distributions of torch force CXX11 ABI 0 :(
ENV CXXFLAGS "-D_GLIBCXX_USE_CXX11_ABI=0"
ENV LDFLAGS "-fuse-ld=/usr/bin/ld.lld" ENV LDFLAGS "-fuse-ld=/usr/bin/ld.lld"
ENV CMAKE_GENERATOR "Ninja"
ENV CMAKE_C_COMPILER_LAUNCHER ccache
ENV CMAKE_CXX_COMPILER_LAUNCHER ccache
ENV CMAKE_PREFIX_PATH /pytorch/share/cmake ENV CMAKE_PREFIX_PATH /pytorch/share/cmake
ENV LLVM_BUILD_DIR /build/llvm-build ENV LLVM_BUILD_DIR /build/llvm-build
ENV LLVM_INSTALL_DIR /build/llvm-install ENV LLVM_INSTALL_DIR /build/llvm-install