Skip to content

Commit 198054b

Browse files
Much more cmake processes when sccache is enabled (because build becomes IO bound task)
1 parent 07de09b commit 198054b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.drone.jsonnet

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
718718
],
719719
},
720720
{
721+
// Get the copy of compile cache from the nightly build from S3
721722
name: 'get-local-sccache',
722723
depends_on: ['submodules'],
723724
image: 'amazon/aws-cli',
@@ -737,7 +738,10 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
737738
'if aws s3 cp s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace(platform, ":", "-") + '/sccache.tar.zst /tmp/sccache.tar.zst; then',
738739
' echo "SCCache archive found. Extracting..."',
739740
' tar -I zstd -xf /tmp/sccache.tar.zst -C /mdb/sccache',
740-
' ls /mdb/sccache/ && mv /mdb/sccache/mdb/sccache /mdb/sccache_inner && rm -rf /mdb/sccache/ && mv /mdb/sccache_inner /mdb/sccache', # TODO remove
741+
742+
// TODO remove when all correct caches are uploaded
743+
' ls /mdb/sccache/; if [ -f /mdb/sccache/mdb ]; then mv /mdb/sccache/mdb/sccache /mdb/sccache_inner && rm -rf /mdb/sccache/ && mv /mdb/sccache_inner /mdb/sccache; fi',
744+
741745
' echo "SCCache successfully downloaded and extracted."',
742746
' ls /mdb/sccache',
743747
'else',

build/bootstrap_mcs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ construct_cmake_flags() {
317317

318318
if [[ $SCCACHE = true ]]; then
319319
warn "Use sccache"
320+
# If sccache works well, the build becomes an IO bound task instead of CPU bound
321+
# It happens because most of the time is spent is hashing the input files
322+
# So we can run more jobs in parallel
323+
CPUS=$((CPUS * 3))
324+
message "Adjusted the number of CPUs for parallel build to $CPUS (multiplied by 3 to reduce IO wait)"
320325
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
321326
fi
322327

0 commit comments

Comments
 (0)