Last active
November 20, 2020 06:08
-
-
Save wngr/d7de37e31551362223be39c80641c1b4 to your computer and use it in GitHub Desktop.
Compile PyTorch on Raspberry Pi 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you want to cross compile, look into qemu | |
FROM resin/armv7hf-debian | |
WORKDIR /usr/src/app | |
RUN apt-get update && apt-get install -y git | |
# get v0.3.1 release | |
RUN git clone -b v0.3.1 --recursive https://github.com/pytorch/pytorch ./pytorch | |
WORKDIR /usr/src/app/pytorch | |
# https://github.com/pytorch/pytorch/issues/4472 | |
RUN git config user.email foo@foo && git config user.name foo && git cherry-pick af8b64aadca379397ff27c135eccb1cfaee5f524 | |
#deps | |
RUN sed -i 's/jessie/stretch/g' /etc/apt/sources.list && apt-get update && apt-get install -y gcc-6 g++-6 | |
RUN apt-get install -y libopenblas-dev cython libatlas-dev m4 libblas-dev python3-dev cmake python3-yaml python3-pip python3-setuptools git make wget libffi-dev | |
#https://gist.github.com/fgolemo/e19ef13183f1a4b5b59c24ae2ae31273 | |
RUN pip3 install setuptools wheel typing numpy pyyaml cffi | |
ARG CC=/usr/bin/gcc-6 | |
ARG CXX=/usr/bin/g++-6 | |
# cmake 3.4 | |
RUN wget https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz && tar -xvzf cmake-3.4.1.tar.gz && cd cmake-3.4.1 && ./bootstrap && make && make install && cd .. && rm -rf cmake-3.4.1.tar.gz | |
#build pytorch | |
RUN NO_CUDA=1 NO_DISTRIBUTED=1 python3 setup.py build | |
CMD [ "/bin/bash" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment