Skip to content

[ci] Use sccache in builds - #10246

Closed
driazati wants to merge 2 commits into
apache:mainfrom
driazati:use_scc
Closed

[ci] Use sccache in builds#10246
driazati wants to merge 2 commits into
apache:mainfrom
driazati:use_scc

Conversation

@driazati

@driazati driazati commented Feb 14, 2022

Copy link
Copy Markdown
Member

This sets the builds for each platform to use sccache as a build cache. For a fully cached rebuild, this reduces the time (in testing) from 30+ minutes to 1-2 minutes (e.g. if the build isn't touching any C++ files). We can run this for a while and if it is successful then remove the extra code around rebuilding using the existing on-instance build directory.

The sccache server is backed by an S3 bucket configured in tlc-pack/ci-terraform#3.

Example run: https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-10353/5/pipeline/57

@Mousius Mousius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is very exciting 😸!

  • update tlc-pack/ci with terraform for public S3 bucket

Why do we need to have this public? Can't the instances assume a role to access it?

  • update docker images so they all have sccache

Are we just missing ci_cpu now? I think I got the others you added sccache to 😸

Comment thread tests/scripts/task_build.sh Outdated
sccache --show-stats

# Use ninja as the builder for cmake
pip install --user ninja

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not apt-get install ninja-build rather than using pip here?

@leandron leandron Feb 15, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When these task_*.sh run, it is with a non-privileged user, so we can't apt-get in these scripts. Perhaps an alternative solution is to add Ninja in the Docker image in the docker/install/*.sh scripting rather install it for every single build job we run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! Yeah, that'd be much better than a side channel pip install thanks @leandron!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah installing in the image is definitely better, #10257 adds it (separate PR so we can land the images and then merge this one). I kept it with pip since the Ubuntu 18 ninja-build is pretty old (1.8, 2017) compared to the binaries in pip (1.10, 2020) and they should be equivalent otherwise

@driazati

Copy link
Copy Markdown
Member Author

Why do we need to have this public? Can't the instances assume a role to access it?

Sorry public wasn't the right word, I meant OSS, we had spun this up in the octo-staging Jenkins to test. The bucket would be private to the runners. Though having a public-readable sccache bucket is potentially on the list of followups since it means anyone could benefit from the cached build.

Are we just missing ci_cpu now? I think I got the others you added sccache to 😸

Yup that's the only one, might be good to roll #10257 into the update too

@driazati driazati changed the title [skip ci][ci] Use sccache in builds [ci] Use sccache in builds Feb 22, 2022
@driazati
driazati marked this pull request as ready for review February 22, 2022 23:38
@driazati
driazati requested review from Mousius and leandron and removed request for a team February 22, 2022 23:39
@driazati

driazati commented Feb 22, 2022

Copy link
Copy Markdown
Member Author

cc @Mousius @areusch this is ready to go (after pushing to a branch), see #10353 for testing. I updated the build to work without ninja and use sccache only if present

Comment thread tests/scripts/task_build.sh
Comment thread tests/scripts/task_build.sh
Comment thread tests/scripts/task_config_build_gpu.sh
Comment thread Jenkinsfile
@driazati

driazati commented Mar 3, 2022

Copy link
Copy Markdown
Member Author

Closing in favor of #10359 which adds a proper -j to builds first

@driazati driazati closed this Mar 3, 2022
Mousius pushed a commit that referenced this pull request Mar 16, 2022
…10257)

Following on from #10246, this moves the `pip install`-at-runtime deps to the docker image install so they are baked in.
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
…pache#10257)

Following on from apache#10246, this moves the `pip install`-at-runtime deps to the docker image install so they are baked in.
driazati added a commit to tlc-pack/ci that referenced this pull request May 31, 2022
This adds the secret to the config so apache/tvm#10246 will work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants