Skip to content

Instantly share code, notes, and snippets.

@rohan-varma
Created November 18, 2020 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohan-varma/116050f432af677f3f79a2819b83e6b6 to your computer and use it in GitHub Desktop.
Save rohan-varma/116050f432af677f3f79a2819b83e6b6 to your computer and use it in GitHub Desktop.
ccache setup for PT
Run this script:
#!/bin/bash
if ! ls ~/ccache/bin/ccache
then
set -ex
sudo apt-get update
sudo apt-get install -y cmake
mkdir -p ~/ccache
pushd ~/ccache
rm -rf ccache
git clone https://github.com/ccache/ccache.git
mkdir -p ccache/build
pushd ccache/build
cmake -DCMAKE_INSTALL_PREFIX=${HOME}/ccache -DENABLE_TESTING=OFF -DZSTD_FROM_INTERNET=ON ..
make -j$(nproc) install
popd
popd
mkdir -p ~/ccache/lib
mkdir -p ~/ccache/cuda
ln -s ~/ccache/bin/ccache ~/ccache/lib/cc
ln -s ~/ccache/bin/ccache ~/ccache/lib/c++
ln -s ~/ccache/bin/ccache ~/ccache/lib/gcc
ln -s ~/ccache/bin/ccache ~/ccache/lib/g++
ln -s ~/ccache/bin/ccache ~/ccache/cuda/nvcc
~/ccache/bin/ccache -M 25Gi
fi
export PATH=~/ccache/lib:$PATH
export CUDA_NVCC_EXECUTABLE=~/ccache/cuda/nvcc
Note if you are on redhat, you have to switch apt-get with yum
Next, set /home/rvarm1/ccache/bin/ccache -M 25Gi
See stats with /home/rvarm1/ccache/bin/ccache -s
After you rebuild pytorch, you should see a faster build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment