-
Notifications
You must be signed in to change notification settings - Fork 1.5k
build(cudf): Pin cuDF dependencies and add script for updates #15992
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8e55649
Update and pin cuDF dependencies
bdice d33d905
Add script for updating cuDF and its dependencies.
bdice cf36fc0
Simplify script
bdice a1c6492
feat: Pin RAPIDS dependencies and add --commit mode to update script
bdice c98737c
Update dependencies
bdice 405b774
Merge remote-tracking branch 'upstream/main' into build/update-cudf-deps
bdice f78425b
Merge branch 'main' into build/update-cudf-deps
bdice 824ede7
Update cudf
bdice 7ed1f9c
Fix CudfLocalPartition for cuDF partition offset change
bdice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| usage() { | ||
| cat <<EOF | ||
| Usage: $0 --branch <branch> | ||
| $0 --pr <pr-number> | ||
| $0 --commit <sha> | ||
|
|
||
| Options: | ||
| --branch <branch> Update all cudf dependencies to latest from branch | ||
| --pr <pr-number> Update only cudf from a specific PR | ||
| --commit <sha> Update all dependencies using cudf commit and compatible versions | ||
|
|
||
| Examples: | ||
| $0 --branch main | ||
| $0 --branch release/26.02 | ||
| $0 --pr 12345 | ||
| $0 --commit abc123def456 | ||
| EOF | ||
| } | ||
|
|
||
| [[ $# -eq 0 ]] && usage && exit 1 | ||
|
|
||
| MODE="$1" | ||
| ARG="${2:-}" | ||
| [[ -z $ARG ]] && echo "Error: $MODE requires an argument" && usage && exit 1 | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| CMAKE_FILE="$SCRIPT_DIR/../CMake/resolve_dependency_modules/cudf.cmake" | ||
|
|
||
| get_commit_info() { | ||
| local repo=$1 branch=$2 | ||
| curl -sf "https://api.github.com/repos/rapidsai/${repo}/commits/${branch}" | | ||
| jq -r '[.sha, .commit.committer.date[:10]] | join(" ")' | ||
| } | ||
|
|
||
| get_commit_before_date() { | ||
| local repo=$1 until_date=$2 | ||
| curl -sf "https://api.github.com/repos/rapidsai/${repo}/commits?sha=main&until=${until_date}&per_page=1" | | ||
| jq -r '.[0] | [.sha, .commit.committer.date[:10]] | join(" ")' | ||
| } | ||
|
|
||
| get_sha256() { | ||
| curl -sL "https://github.com/rapidsai/$1/archive/$2.tar.gz" | sha256sum | cut -d' ' -f1 | ||
| } | ||
|
|
||
| get_version() { | ||
| local branch=$1 | ||
| if [[ $branch =~ ^release/([0-9]+\.[0-9]+)$ ]]; then | ||
| echo "${BASH_REMATCH[1]}" | ||
| else | ||
| curl -sf "https://raw.githubusercontent.com/rapidsai/cudf/${branch}/VERSION" | | ||
| grep -oP '^[0-9]+\.[0-9]+' | ||
| fi | ||
| } | ||
|
|
||
| update_dependency() { | ||
| local var=$1 commit=$2 date=$3 checksum=$4 | ||
| sed -i "s/# ${var} commit [a-f0-9]* from [0-9-]*/# ${var} commit ${commit:0:7} from ${date}/" "$CMAKE_FILE" | ||
| sed -i "s/set(VELOX_${var}_COMMIT [a-f0-9]*)/set(VELOX_${var}_COMMIT ${commit})/" "$CMAKE_FILE" | ||
|
|
||
| if [[ $var == "cudf" ]]; then | ||
| sed -i "s/set(VELOX_${var}_VERSION [0-9.]* CACHE/set(VELOX_${var}_VERSION ${VERSION} CACHE/" "$CMAKE_FILE" | ||
| else | ||
| sed -i "s/set(VELOX_${var}_VERSION [0-9.]*)/set(VELOX_${var}_VERSION ${VERSION})/" "$CMAKE_FILE" | ||
| fi | ||
|
|
||
| awk -v var="VELOX_${var}_BUILD_SHA256_CHECKSUM" -v sum="$checksum" ' | ||
| $0 ~ var { found=1 } | ||
| found && /^[[:space:]]*[a-f0-9]{64}[[:space:]]*$/ { sub(/[a-f0-9]{64}/, sum); found=0 } | ||
| { print } | ||
| ' "$CMAKE_FILE" >"${CMAKE_FILE}.tmp" && mv "${CMAKE_FILE}.tmp" "$CMAKE_FILE" | ||
| } | ||
|
|
||
| if [[ $MODE == "--pr" ]]; then | ||
| echo "Fetching cuDF PR #${ARG}..." | ||
| PR_INFO=$(curl -sf "https://api.github.com/repos/rapidsai/cudf/pulls/${ARG}") | ||
| SHA=$(echo "$PR_INFO" | jq -r '.head.sha') | ||
| BASE=$(echo "$PR_INFO" | jq -r '.base.ref') | ||
| VERSION=$(get_version "$BASE") | ||
| DATE=$(curl -sf "https://api.github.com/repos/rapidsai/cudf/commits/${SHA}" | jq -r '.commit.committer.date[:10]') | ||
|
|
||
| echo " Base: $BASE (version $VERSION)" | ||
| echo " Commit: ${SHA:0:7} from $DATE" | ||
| echo " Computing SHA256..." | ||
| CHECKSUM=$(get_sha256 "cudf" "$SHA") | ||
| echo " SHA256: $CHECKSUM" | ||
| echo | ||
|
|
||
| update_dependency "cudf" "$SHA" "$DATE" "$CHECKSUM" | ||
| echo "Done! Updated cudf to PR #${ARG}: ${SHA:0:7} ($DATE)" | ||
|
|
||
| elif [[ $MODE == "--commit" ]]; then | ||
| echo "Fetching cuDF commit ${ARG:0:7}..." | ||
| COMMIT_INFO=$(curl -sf "https://api.github.com/repos/rapidsai/cudf/commits/${ARG}") | ||
| SHA=$(echo "$COMMIT_INFO" | jq -r '.sha') | ||
| DATE=$(echo "$COMMIT_INFO" | jq -r '.commit.committer.date[:10]') | ||
| TIMESTAMP=$(echo "$COMMIT_INFO" | jq -r '.commit.committer.date') | ||
| VERSION=$(curl -sf "https://raw.githubusercontent.com/rapidsai/cudf/${SHA}/VERSION" | grep -oP '^[0-9]+\.[0-9]+') | ||
|
|
||
| echo " Commit: ${SHA:0:7} from $DATE" | ||
| echo " Version: $VERSION" | ||
| echo | ||
|
|
||
| declare -A COMMITS DATES CHECKSUMS | ||
| COMMITS[cudf]=$SHA | ||
| DATES[cudf]=$DATE | ||
|
|
||
| echo "Finding compatible dependency versions (main branch commits before $TIMESTAMP)..." | ||
| echo | ||
|
|
||
| for dep in rapids_cmake rmm kvikio; do | ||
| repo=${dep//_/-} | ||
| echo "Fetching $repo..." | ||
| read -r commit date < <(get_commit_before_date "$repo" "$TIMESTAMP") | ||
| echo " Commit: ${commit:0:7} from $date" | ||
| echo " Computing SHA256..." | ||
| checksum=$(get_sha256 "$repo" "$commit") | ||
| echo " SHA256: $checksum" | ||
|
|
||
| COMMITS[$dep]=$commit | ||
| DATES[$dep]=$date | ||
| CHECKSUMS[$dep]=$checksum | ||
| echo | ||
| done | ||
|
|
||
| echo "Computing SHA256 for cudf..." | ||
| CHECKSUMS[cudf]=$(get_sha256 "cudf" "$SHA") | ||
| echo " SHA256: ${CHECKSUMS[cudf]}" | ||
| echo | ||
|
|
||
| echo "Updating $CMAKE_FILE..." | ||
| for dep in rapids_cmake rmm kvikio cudf; do | ||
| update_dependency "$dep" "${COMMITS[$dep]}" "${DATES[$dep]}" "${CHECKSUMS[$dep]}" | ||
| done | ||
|
|
||
| echo "Done! Updated dependencies:" | ||
| for dep in rapids_cmake rmm kvikio cudf; do | ||
| echo " $dep: ${COMMITS[$dep]:0:7} (${DATES[$dep]})" | ||
| done | ||
|
|
||
| elif [[ $MODE == "--branch" ]]; then | ||
| VERSION=$(get_version "$ARG") | ||
| echo "Updating cuDF dependencies from branch $ARG (version $VERSION)" | ||
| echo | ||
|
|
||
| declare -A COMMITS DATES CHECKSUMS | ||
|
|
||
| for dep in rapids_cmake rmm kvikio cudf; do | ||
| repo=${dep//_/-} | ||
| echo "Fetching $repo..." | ||
|
|
||
| read -r commit date < <(get_commit_info "$repo" "$ARG") | ||
| echo " Commit: ${commit:0:7} from $date" | ||
| echo " Computing SHA256..." | ||
| checksum=$(get_sha256 "$repo" "$commit") | ||
| echo " SHA256: $checksum" | ||
|
|
||
| COMMITS[$dep]=$commit | ||
| DATES[$dep]=$date | ||
| CHECKSUMS[$dep]=$checksum | ||
| echo | ||
| done | ||
|
|
||
| echo "Updating $CMAKE_FILE..." | ||
| for dep in rapids_cmake rmm kvikio cudf; do | ||
| update_dependency "$dep" "${COMMITS[$dep]}" "${DATES[$dep]}" "${CHECKSUMS[$dep]}" | ||
| done | ||
|
|
||
| echo "Done! Updated dependencies:" | ||
| for dep in rapids_cmake rmm kvikio cudf; do | ||
| echo " $dep: ${COMMITS[$dep]:0:7} (${DATES[$dep]})" | ||
| done | ||
| else | ||
| usage | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is optional -- if Velox maintainers have reservations about including this script, we don't have to include it here. We can move it somewhere else.
Its purpose is to pin a compatible cudf dependency tree (rapids-cmake, rmm, kvikio) based on the desired cuDF branch/PR/commit hash.