how to use the `ccache` package on Ubuntu (#18495)
authorStas Bekman <stas00@users.noreply.github.com>
Wed, 27 Mar 2019 02:56:39 +0000 (19:56 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 27 Mar 2019 03:08:09 +0000 (20:08 -0700)
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

CONTRIBUTING.md

index 7b7ec5d..25372f1 100644 (file)
@@ -319,6 +319,27 @@ be on your `PATH`, otherwise `ccache` will emit the following error:
 
     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: