how to use the `ccache` package on Ubuntu (#18495)
Summary:
Added full instructions for how to use the `ccache` package. Thanks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18495
Differential Revision: D14635351
Pulled By: ezyang
fbshipit-source-id: 158e1052bae580e95f73644252fdbddcc0213128
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7b7ec5d..25372f1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -319,6 +319,27 @@
ccache: error: Could not find compiler "nvcc" in PATH
+For example, here is how to install/configure `ccache` on Ubuntu:
+
+```bash
+# install ccache
+sudo apt install ccache
+
+# update symlinks and create/re-create nvcc link
+sudo /usr/sbin/update-ccache-symlinks
+sudo ln -s /usr/bin/ccache /usr/lib/ccache/nvcc
+
+# config: cache dir is ~/.ccache, conf file ~/.ccache/ccache.conf
+# max size of cache
+ccache -M 25Gi # -M 0 for unlimited
+# unlimited number of files
+ccache -F 0
+
+# deploy (and add to ~/.bashrc for later)
+export PATH="/usr/lib/ccache:$PATH"
+export CUDA_NVCC_EXECUTABLE=/usr/lib/ccache/nvcc
+```
+
## CUDA Development tips
If you are working on the CUDA code, here are some useful CUDA debugging tips: