-
Notifications
You must be signed in to change notification settings - Fork 21
sccache: integrate with Velox build
#52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
02c005f
398dae0
2cb9835
3d3c7a7
0c690f5
f412028
eadaefa
4350283
188fdaf
f7eb417
a458d0d
48d0224
5a27fe2
251e566
3df2a85
7cdbd64
700d2ee
cf288c4
9a74c25
165ad9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,29 @@ A Docker-based build infrastructure has been added to facilitate building Velox | |
|
|
||
| Specifically, the `velox-testing` and `velox` repositories must be checked out as sibling directories under the same parent directory. Once that is done, navigate (`cd`) into the `velox-testing/velox/scripts` directory and execute the build script `build_velox.sh`. After a successful build, the Velox libraries and executables are available in the container at `/opt/velox-build/release`. | ||
|
|
||
| ## `sccache` Usage | ||
| `sccache` has been integrated to significantly accelerate builds using remote S3 caching and optional distributed compilation. Currently supported for Velox builds only (not Presto). | ||
|
|
||
| The fork `rapidsai/sccache` is integrated and configured for use with the `NVIDIA` GitHub organization. | ||
|
|
||
| ### Setup and Usage | ||
| First, set up authentication credentials: | ||
| ```bash | ||
| cd velox-testing/velox/scripts | ||
| ./setup_sccache_auth.sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running this script results in the following error:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh oops I think I forgot to include a dockerfile in this PR, my bad. |
||
| ``` | ||
|
|
||
| Then build Velox with sccache enabled: | ||
| ```bash | ||
| # Default: Remote S3 cache + local compilation (recommended) | ||
| ./build_velox.sh --sccache | ||
|
|
||
| # Optional: Enable distributed compilation (may cause build differences such as additional warnings) | ||
| ./build_velox.sh --sccache --sccache-enable-dist | ||
| ``` | ||
|
|
||
| Authentication files are stored in `~/.sccache-auth/` by default and credentials are valid for 12 hours. By default, distributed compilation is disabled to avoid compiler version differences that can cause build failures. | ||
|
|
||
| ## Velox Benchmarking | ||
| A Docker-based benchmarking infrastructure has been added to facilitate running Velox benchmarks with support for CPU/GPU execution engines and profiling capabilities. The infrastructure uses a dedicated `velox-benchmark` Docker service with pre-configured volume mounts that automatically sync benchmark data and results. The data follows Hive directory structure, making it compatible with Presto. Currently, only TPC-H is implemented, but the infrastructure is designed to be easily extended to support additional benchmarks in the future. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # Check for required auth files | ||
| if [[ ! -f /sccache_auth/github_token ]]; then | ||
| echo "ERROR: GitHub token not found at /sccache_auth/github_token" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -f /sccache_auth/aws_credentials ]]; then | ||
| echo "ERROR: AWS credentials not found at /sccache_auth/aws_credentials" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Set up directories | ||
| mkdir -p ~/.config/sccache ~/.aws | ||
|
|
||
| # Install AWS credentials (safe in Docker container environment) | ||
| cp /sccache_auth/aws_credentials ~/.aws/credentials | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this override existing credential setup?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, there is a warning put in place to notify the user that this will happen here: https://github.com/rapidsai/velox-testing/pull/52/files/2cb983596eb88b719f86819ee4e6b88fc55dd1f2#diff-d2d6851dcf7cc303d86898bf66d55ab402ed49efa26304f2940a8d1218519026R28-R34
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also only affects the |
||
|
|
||
| # Read GitHub token | ||
| GITHUB_TOKEN=$(cat /sccache_auth/github_token | tr -d '\n\r ') | ||
|
|
||
| # Create sccache config | ||
| SCCACHE_ARCH=$(uname -m | sed 's/x86_64/amd64/') | ||
|
|
||
| # Check if we should disable distributed compilation (disabled by default) | ||
| if [[ "${SCCACHE_DISABLE_DIST:-ON}" == "ON" ]]; then | ||
| cat > ~/.config/sccache/config << SCCACHE_EOF | ||
| [cache.disk] | ||
| size = 107374182400 | ||
|
|
||
| [cache.disk.preprocessor_cache_mode] | ||
| use_preprocessor_cache_mode = true | ||
|
|
||
| [cache.s3] | ||
| bucket = "rapids-sccache-devs" | ||
| region = "us-east-2" | ||
| no_credentials = false | ||
|
|
||
| # No [dist] section -> disables distributed compilation | ||
| SCCACHE_EOF | ||
| else | ||
| cat > ~/.config/sccache/config << SCCACHE_EOF | ||
| [cache.disk] | ||
| size = 107374182400 | ||
|
|
||
| [cache.disk.preprocessor_cache_mode] | ||
| use_preprocessor_cache_mode = true | ||
|
|
||
| [cache.s3] | ||
| bucket = "rapids-sccache-devs" | ||
| region = "us-east-2" | ||
| no_credentials = false | ||
|
|
||
| [dist] | ||
| scheduler_url = "https://${SCCACHE_ARCH}.linux.sccache.rapids.nvidia.com" | ||
|
|
||
| [dist.auth] | ||
| type = "token" | ||
| token = "${GITHUB_TOKEN}" | ||
| SCCACHE_EOF | ||
| fi | ||
|
|
||
| # Configure sccache for high parallelism | ||
| # Increase file descriptor limit for high parallelism (if possible) | ||
| ulimit -n $(ulimit -Hn) || echo "Could not increase file descriptor limit" | ||
|
|
||
| # Start sccache server | ||
| sccache --start-server | ||
|
|
||
| # Test sccache | ||
| sccache --show-stats | ||
|
|
||
| # Testing distributed compilation status (only if enabled) | ||
| if [[ "${SCCACHE_DISABLE_DIST:-ON}" == "ON" ]]; then | ||
| echo "Distributed compilation is DISABLED by default - using local compilation with remote S3 caching" | ||
| else | ||
| if sccache --dist-status; then | ||
| echo "Distributed compilation is available" | ||
| else | ||
| echo "Error: Distributed compilation not available, check connectivity" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this dockerfile based on an existing dockerfile or documentation?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This dockerfile is largely based on documentation in a slack channel which I can link offline. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| FROM ubuntu:22.04 | ||
|
|
||
| # Prevent interactive prompts during package installation | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install basic dependencies | ||
| RUN <<EOF | ||
| apt-get update && apt-get install -y \ | ||
| curl \ | ||
| wget \ | ||
| ca-certificates \ | ||
| gnupg \ | ||
| lsb-release \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| EOF | ||
|
|
||
| # Install GitHub CLI | ||
| RUN <<EOF | ||
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | ||
| chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | ||
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
| apt-get update | ||
| apt-get install gh -y | ||
| rm -rf /var/lib/apt/lists/* | ||
| EOF | ||
|
|
||
| # Install gh-nv-gha-aws plugin manually | ||
| RUN <<EOF | ||
| NV_GHA_AWS_VERSION="0.1.1" | ||
| ARCH=$(dpkg --print-architecture) | ||
| if [ "$ARCH" = "amd64" ]; then ARCH="amd64"; elif [ "$ARCH" = "arm64" ]; then ARCH="arm64"; fi | ||
| mkdir -p /root/.local/share/gh/extensions/gh-nv-gha-aws | ||
| wget --no-hsts -q -O /root/.local/share/gh/extensions/gh-nv-gha-aws/gh-nv-gha-aws \ | ||
| "https://github.com/nv-gha-runners/gh-nv-gha-aws/releases/download/v${NV_GHA_AWS_VERSION}/gh-nv-gha-aws_v${NV_GHA_AWS_VERSION}_linux-${ARCH}" | ||
| chmod 0755 /root/.local/share/gh/extensions/gh-nv-gha-aws/gh-nv-gha-aws | ||
| EOF | ||
|
|
||
| # Create plugin manifest | ||
| RUN <<EOF | ||
| cat > /root/.local/share/gh/extensions/gh-nv-gha-aws/manifest.yml << 'MANIFEST' | ||
| owner: nv-gha-runners | ||
| name: gh-nv-gha-aws | ||
| host: github.com | ||
| tag: v0.1.1 | ||
| ispinned: false | ||
| path: $HOME/.local/share/gh/extensions/gh-nv-gha-aws/gh-nv-gha-aws | ||
| MANIFEST | ||
| EOF | ||
|
|
||
| # Create output directory for credentials | ||
| RUN mkdir -p /output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses the default AWS credentials available through GHA secrets instead of generating them every time. The same applies for the GitHub token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to make these changes in this PR, enabling
sccachefor CI is a separate work item which will have a follow-up PR.