Setup cache folder for tensorflow build

Is there anyway to specify the cache folder for TF build, so that I don’t have to rebuilt everytime after the computer is rebooted?

I tried to set the TMP folder, but it does not help.

 TMP=~/tmp bazel build //tensorflow/tools/pip_package:build_pip_package

This seems does not work, the ~/tmp folder is empty all the time.

The default is ~/.cache/bazel so it is available after reboot.

You can add an extra cache with:

But you need to consider also the cache invalidation effect of large regular changes like this one:

More in general you could be interested in: