Skip to content

Commit

Permalink
Run sccache in background mode and save logs to file (#7594)
Browse files Browse the repository at this point in the history
Running sccache in foreground mode seems to uniformly slow down the builds and causes virtual memory exhausted errors for gcc7.2 builds. This PR moves sccache to background mode instead and print the compilation log at the end of the build.
  • Loading branch information
yf225 authored May 16, 2018
1 parent 4b6c884 commit 2de1b44
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
11 changes: 7 additions & 4 deletions .jenkins/pytorch/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ declare -f -t trap_add
trap_add cleanup EXIT

if which sccache > /dev/null; then
# Start sccache server in foreground mode, so that we can see better logging
# Save sccache logs to file
sccache --stop-server || true
SCCACHE_NO_DAEMON=1 RUST_LOG=sccache::server=error sccache --start-server
SCCACHE_ERROR_LOG=~/sccache_error.log RUST_LOG=sccache::server=error sccache --start-server

# Report sccache stats for easier debugging
sccache --zero-stats
sccache --show-stats
function sccache_epilogue() {
sccache --show-stats
echo '=================== sccache compilation log ==================='
python $(dirname "${BASH_SOURCE[0]}")/print_sccache_log.py ~/sccache_error.log
echo '=========== If your build fails, please take a look at the log above for possible reasons ==========='
sccache --show-stats
sccache --stop-server || true
}
trap_add sccache_epilogue EXIT
fi
Expand Down
11 changes: 11 additions & 0 deletions .jenkins/pytorch/print_sccache_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

log_file_path = sys.argv[1]

with open(log_file_path) as f:
lines = f.readlines()

for line in lines:
# Ignore errors from CPU instruction set testing
if 'CMakeFiles/CMakeTmp/src.c' not in line:
print(line)
4 changes: 3 additions & 1 deletion .jenkins/pytorch/short-perf-test-gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
COMPACT_JOB_NAME="short-perf-test-gpu"
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

cd .jenkins/pytorch/perf_test
pushd .jenkins/pytorch/perf_test

echo "Running GPU perf test for PyTorch..."

Expand Down Expand Up @@ -64,3 +64,5 @@ if [[ "$COMMIT_SOURCE" == master ]]; then
# but the chance of them executing this line at the same time is low.
aws s3 cp new_gpu_runtime.json s3://ossci-perf-test/pytorch/gpu_runtime/${MASTER_COMMIT_ID}.json --acl public-read
fi

popd

0 comments on commit 2de1b44

Please sign in to comment.