Skip to content

Instantly share code, notes, and snippets.

@otamajakusi
Last active October 30, 2021 05:36
Show Gist options
  • Save otamajakusi/6c061c218d0069a227a69068c03aa92a to your computer and use it in GitHub Desktop.
Save otamajakusi/6c061c218d0069a227a69068c03aa92a to your computer and use it in GitHub Desktop.
dockerfile for pytorch
FROM nvcr.io/nvidia/l4t-base:r32.5.0
ENV DEBIAN_FRONTEND=noninteractive
# https://qengineering.eu/install-pytorch-on-jetson-nano.html
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3.8 python3.8-dev \
ninja-build git cmake clang build-essential \
libopenmpi-dev libomp-dev ccache \
libopenblas-dev libblas-dev libeigen3-dev \
python3-pip libjpeg-dev
RUN python3.8 -m pip install setuptools && \
python3.8 -m pip install wheel && \
python3.8 -m pip install mock pillow && \
python3.8 -m pip install scikit-build && \
python3.8 -m pip install cython
# download PyTorch 1.8.1 with all its libraries
RUN git clone -b lts/release/1.8 --depth 1 --recursive --recurse-submodules --shallow-submodules https://github.com/pytorch/pytorch.git
WORKDIR pytorch
RUN python3.8 -m pip install -r requirements.txt
COPY pytorch-1.8-jetson.patch .
RUN patch -p1 < pytorch-1.8-jetson.patch
ENV BUILD_CAFFE2_OPS=OFF
ENV USE_FBGEMM=OFF
ENV USE_FAKELOWP=OFF
ENV BUILD_TEST=OFF
ENV USE_MKLDNN=OFF
ENV USE_NNPACK=OFF
ENV USE_XNNPACK=OFF
ENV USE_QNNPACK=OFF
ENV USE_PYTORCH_QNNPACK=OFF
ENV USE_CUDA=ON
ENV USE_CUDNN=ON
ENV TORCH_CUDA_ARCH_LIST="5.3;6.2;7.2"
ENV USE_NCCL=OFF
ENV USE_SYSTEM_NCCL=OFF
ENV USE_OPENCV=OFF
#ENV MAX_JOBS=2
# set path to ccache
ENV PATH=/usr/lib/ccache:$PATH
# set clang compiler
ENV CC=clang
ENV CXX=clang++
# create symlink to cublas
# ln -s /usr/lib/aarch64-linux-gnu/libcublas.so /usr/local/cuda/lib64/libcublas.so
# start the build
#RUN python3.8 setup.py bdist_wheel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment