2020-09-25 08:40:25 +08:00
|
|
|
FROM ubuntu:20.04
|
|
|
|
MAINTAINER Stella Laurenzo <stellaraccident@gmail.com>
|
|
|
|
|
|
|
|
USER root
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt update
|
|
|
|
|
|
|
|
# Python and build system.
|
|
|
|
RUN apt install -y python3 python-is-python3
|
2021-03-01 08:19:03 +08:00
|
|
|
RUN apt install -y python3-pip
|
2020-09-25 08:40:25 +08:00
|
|
|
RUN apt install -y git cmake ccache ninja-build
|
|
|
|
RUN apt install -y clang lld
|
|
|
|
RUN ln -s /usr/bin/llvm-symbolizer-10 /usr/bin/llvm-symbolizer
|
|
|
|
|
|
|
|
# Install PyTorch
|
|
|
|
# Installs under: /usr/local/lib/python3.8/dist-packages/torch
|
2020-10-16 09:28:30 +08:00
|
|
|
RUN pip3 install numpy
|
2021-03-01 08:19:03 +08:00
|
|
|
RUN pip3 install pybind11
|
2020-10-16 09:28:30 +08:00
|
|
|
RUN pip3 install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
2020-09-25 08:40:25 +08:00
|
|
|
RUN ln -s /usr/local/lib/python3.8/dist-packages/torch /pytorch
|
|
|
|
|
|
|
|
# Build configuration
|
|
|
|
RUN mkdir /ccache && ln -s /usr/bin/ccache /ccache/clang && ln -s /usr/bin/ccache /ccache/clang++
|
2020-10-08 09:31:24 +08:00
|
|
|
RUN mkdir /build && chmod a+rw /build /ccache
|
2020-09-25 08:40:25 +08:00
|
|
|
ENV PATH "/ccache:${PATH}"
|
|
|
|
ENV CC 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 CMAKE_PREFIX_PATH /pytorch/share/cmake
|
2020-10-08 09:31:24 +08:00
|
|
|
ENV LLVM_BUILD_DIR /build/llvm-build
|
|
|
|
ENV LLVM_INSTALL_DIR /build/llvm-install
|
|
|
|
ENV NPCOMP_BUILD_DIR /build/npcomp
|