Skip to content

Commit

Permalink
Bazel: add disk cache to optimize build/test cache hit
Browse files Browse the repository at this point in the history
  • Loading branch information
storypku committed Oct 29, 2020
1 parent 1c60ca6 commit 94ce3a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 4 additions & 12 deletions .teamcity/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ function setup_devices_and_mount_local_volumes() {

local os_release="$(lsb_release -rs)"
case "${os_release}" in
14.04)
warning "[Deprecated] Support for Ubuntu 14.04 will be removed" \
16.04)
warning "[Deprecated] Support for Ubuntu 16.04 will be removed" \
"in the near future. Please upgrade to ubuntu 18.04+."
volumes="${volumes} -v /dev:/dev"
;;
16.04 | 18.04 | 20.04 | *)
18.04 | 20.04 | *)
volumes="${volumes} -v /dev:/dev"
;;
esac
Expand Down Expand Up @@ -137,9 +138,6 @@ function determine_gpu_use_host() {
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
if [ ! -z "$(which nvidia-docker)" ]; then
DOCKER_RUN="nvidia-docker run"
warning "nvidia-docker is deprecated. Please install latest docker " \
"and nvidia-container-toolkit as described by:"
warning " ${nv_docker_doc}"
elif [ ! -z "$(which nvidia-container-toolkit)" ]; then
if dpkg --compare-versions "${DOCKER_VERSION}" "ge" "19.03"; then
DOCKER_RUN="docker run --gpus all"
Expand Down Expand Up @@ -220,12 +218,6 @@ function mount_other_volumes() {
volume_conf="${volume_conf} --volumes-from ${yolo3d_volume}"
fi

# LOCALIZATION
local localization_volume="apollo_localization_volume_${USER}"
local localization_image="${DOCKER_REPO}:localization_volume-${TARGET_ARCH}-latest"
reuse_or_start_volume "${localization_volume}" "${localization_image}"
volume_conf="${volume_conf} --volumes-from ${localization_volume}"

if [ "${TARGET_ARCH}" = "x86_64" ]; then
local local_3rdparty_volume="apollo_local_third_party_volume_${USER}"
local local_3rdparty_image="${DOCKER_REPO}:local_third_party_volume-${TARGET_ARCH}-latest"
Expand Down
2 changes: 2 additions & 0 deletions tools/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def setup_common_dirs(environ_cp):

write_to_bazelrc('startup --output_user_root="{}/bazel"'.format(cache_dir))
write_to_bazelrc('common --distdir="{}"'.format(dist_dir))
write_to_bazelrc('build --repository_cache="{}/repos"'.format(cache_dir))
write_to_bazelrc('build --disk_cache="{}/build"'.format(cache_dir))
write_to_bazelrc('')


Expand Down

0 comments on commit 94ce3a6

Please sign in to comment.