Created
September 12, 2018 18:19
-
-
Save soumith/7e68de9788e2b571d57f2b757aa20898 to your computer and use it in GitHub Desktop.
This file contains 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
set -e | |
# docker run -it --ipc=host --rm -v $(pwd):/remote ubuntu:xenial bash | |
# bash /remote/run_repro.sh | |
apt-get update | |
apt-get install -y build-essential wget git | |
######################################################## | |
# Setup environment | |
######################################################## | |
mkdir -p tmp | |
cd tmp | |
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
bash Miniconda3-latest-Linux-x86_64.sh -b -p $(pwd)/miniconda | |
. miniconda/bin/activate | |
export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" | |
conda install -y numpy pyyaml mkl mkl-include setuptools cmake cffi typing | |
wget -c http://releases.llvm.org/6.0.1/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz | |
tar -xvf clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz | |
######################################################## | |
# Build and test PyTorch using the default linker | |
######################################################## | |
git clone https://github.com/pytorch/pytorch --recursive | |
pushd pytorch/ | |
git clean -xfd | |
python setup.py install | |
pushd test | |
python test_torch.py TestTorch.test_addmm | |
popd | |
popd | |
echo "PASSED BASIC BUILD AND TEST WITH SYSTEM LINKER" | |
echo "PASSED BASIC BUILD AND TEST WITH SYSTEM LINKER" | |
echo "PASSED BASIC BUILD AND TEST WITH SYSTEM LINKER" | |
######################################################## | |
# replace system linker with lld.ld | |
######################################################## | |
mv /usr/bin/ld /usr/bin/ld.bak | |
ln -s $(pwd)/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/bin/ld.lld /usr/bin/ld | |
pip uninstall -y torch | |
cd pytorch/ | |
git clean -xfd | |
python setup.py install | |
pushd test | |
python test_torch.py TestTorch.test_addmm | |
popd | |
popd | |
######################################################## | |
# replace both system linker and anaconda python-extension linker with ld.lld | |
######################################################## | |
mv miniconda/compiler_compat/ld ld.bak | |
ln -s $(pwd)/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/bin/ld.lld miniconda/compiler_compat/ld | |
pip uninstall -y torch | |
cd pytorch/ | |
git clean -xfd | |
python setup.py install | |
pushd test | |
python test_torch.py TestTorch.test_addmm | |
popd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment