diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 79cac5c9a76..2857720b410 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -22,31 +22,37 @@ # Only users that have write access to the repo can be added as owners. # See the official docs for more details on syntax and precedence of rules: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file +# Velox-cuDF codeowners +* @rapidsai/velox-cudf-codeowners + # Build & CI -CMake/ @assignUser @majetideepak -/CMakeLists.txt @assignUser -*.cmake @majetideepak -**/CMakeLists.txt @majetideepak -scripts/ @assignUser @majetideepak -.github/ @assignUser @majetideepak +# CMake/ @assignUser @majetideepak +# /CMakeLists.txt @assignUser +# *.cmake @majetideepak +# **/CMakeLists.txt @majetideepak +# scripts/ @assignUser @majetideepak +# .github/ @assignUser @majetideepak # Breeze -velox/experimental/breeze @dreveman +#velox/experimental/breeze @dreveman + +# cuDF +velox/experimental/cudf @bdice @karthikeyann @devavret # cuDF velox/experimental/cudf/ @bdice @karthikeyann @devavret @mhaseeb123 # Parquet -velox/dwio/parquet/ @majetideepak +#velox/dwio/parquet/ @majetideepak # Storage Adapters -velox/connectors/hive/storage_adapters/ @majetideepak +#velox/connectors/hive/storage_adapters/ @majetideepak # Connectors -velox/connectors/ @majetideepak +#velox/connectors/ @majetideepak # Caching -velox/common/caching/ @majetideepak +# velox/common/caching/ @majetideepak -# Spark Functions -velox/functions/sparksql/ @jinchengchenghh @rui-mo @zhli1142015 +# # Spark Functions +# velox/functions/sparksql/ @jinchengchenghh @rui-mo @zhli1142015 diff --git a/.github/copy-pr-bot.yaml b/.github/copy-pr-bot.yaml new file mode 100644 index 00000000000..b28d1fe0a0c --- /dev/null +++ b/.github/copy-pr-bot.yaml @@ -0,0 +1,17 @@ +# 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. +# Configuration file for `copy-pr-bot` GitHub App +# https://docs.gha-runners.nvidia.com/apps/copy-pr-bot/ + +enabled: true diff --git a/.github/disabled-workflows/benchmark.yml b/.github/disabled-workflows/benchmark.yml new file mode 100644 index 00000000000..1103d024645 --- /dev/null +++ b/.github/disabled-workflows/benchmark.yml @@ -0,0 +1,224 @@ +# 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. + +name: Ubuntu Benchmark + +on: + pull_request: + paths: + - .github/workflows/benchmark.yml + - scripts/ci/benchmark-requirements.txt + - scripts/setup-ubuntu.sh + + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + benchmark: + if: github.repository == 'facebookincubator/velox' + runs-on: 8-core-ubuntu-22.04 + env: + CCACHE_DIR: ${{ github.workspace }}/ccache/ + CCACHE_BASEDIR: ${{ github.workspace }} + BINARY_DIR: ${{ github.workspace }}/benchmarks/ + CONTENDER_OUTPUT_PATH: ${{ github.workspace }}/benchmark-results/contender/ + INSTALL_PREFIX: ${{ github.workspace }}/dependencies + steps: + + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: velox + + persist-credentials: false + + - name: Restore Dependencies + uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: restore-deps + with: + path: ${{ env.INSTALL_PREFIX }} + key: dependencies-benchmark-${{ hashFiles('velox/scripts/setup-ubuntu.sh') }} + + - name: Install apt dependencies + env: + UV_TOOL_BIN_DIR: /usr/local/bin + run: | + source velox/scripts/setup-ubuntu.sh + install_apt_deps + + - name: Install compiled dependencies + if: ${{ steps.restore-deps.outputs.cache-hit != 'true' }} + env: + CCACHE_DISABLE: 'true' + run: | + source velox/scripts/setup-ubuntu.sh + run_and_time install_fmt + run_and_time install_protobuf + run_and_time install_boost + run_and_time install_fast_float + run_and_time install_folly + run_and_time install_stemmer + run_and_time install_thrift + run_and_time install_arrow + + - name: Save Dependencies + if: ${{ steps.restore-deps.outputs.cache-hit != 'true' }} + uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: ${{ env.INSTALL_PREFIX }} + key: dependencies-benchmark-${{ hashFiles('velox/scripts/setup-ubuntu.sh') }} + + - name: Restore ccache + uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4 + id: restore-cache + with: + clean: true + path: ccache + key: ccache-benchmark + + - name: Clear CCache Statistics + run: | + ccache -sz + + - name: Build Contender Benchmarks + working-directory: velox + run: | + n_cores=$(nproc) + make benchmarks-basic-build NUM_THREADS=$n_cores MAX_HIGH_MEM_JOBS=$n_cores MAX_LINK_JOBS=$n_cores + mkdir -p ${BINARY_DIR}/contender/ + cp -r --verbose _build/release/velox/benchmarks/basic/* ${BINARY_DIR}/contender/ + + - name: CCache after + run: | + ccache -vs + + - name: Save ccache" + uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4 + with: + path: ccache + key: ccache-benchmark + + - name: Install benchmark dependencies + run: | + python3 -m pip install -r velox/scripts/ci/benchmark-requirements.txt + + - name: Run Benchmarks - Contender + working-directory: velox + run: | + make benchmarks-basic-run \ + EXTRA_BENCHMARK_FLAGS="--binary_path ${BINARY_DIR}/contender/ --output_path ${CONTENDER_OUTPUT_PATH}" + + - name: Upload result artifact + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + with: + path: benchmark-results + name: benchmark-results + retention-days: 5 + + upload: + runs-on: ubuntu-latest + needs: benchmark + if: false && github.event_name == 'push' + permissions: + actions: read + statuses: write + steps: + + - name: Download artifacts + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 + with: + merge-multiple: true + path: /tmp/artifacts/ + + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: velox + persist-credentials: false + + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.10' + cache: pip + cache-dependency-path: velox/scripts/* + + - name: Install dependencies + run: pip install -r velox/scripts/ci/benchmark-requirements.txt + + - name: Upload results + env: + CONBENCH_URL: https://velox-conbench.voltrondata.run/ + CONBENCH_MACHINE_INFO_NAME: GitHub-runner-8-core + CONBENCH_EMAIL: ${{ secrets.CONBENCH_EMAIL }} + CONBENCH_PASSWORD: ${{ secrets.CONBENCH_PASSWORD }} + CONBENCH_PROJECT_REPOSITORY: ${{ github.repository }} + CONBENCH_PROJECT_COMMIT: ${{ github.sha }} + RUN_ID: GHA-${{ github.run_id }}-${{ github.run_attempt }} + run: | + ./velox/scripts/ci/benchmark-runner.py upload \ + --run_id "$RUN_ID" \ + --sha "$CONBENCH_PROJECT_COMMIT" \ + --output_dir "/tmp/artifacts/contender/" + + - name: Check the status of the upload + # Status functions like failure() only work in `if:` + if: failure() + id: status + run: echo "failed=true" >> $GITHUB_OUTPUT + + - name: Create a GitHub Status on the contender commit (whether the upload was successful) + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + if: ${{ !cancelled() && steps.extract.conclusion != 'failure' }} + with: + script: | + let url = 'https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}' + let state = 'success' + let description = 'Result upload succeeded!' + + if(${{ steps.status.outputs.failed == 'true' && true || false }}) { + state = 'failure' + description = 'Result upload failed!' + } + + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: state, + target_url: url, + description: description, + context: 'Benchmark Result Upload' + }) + + - name: Create a GitHub Check benchmark report on the merged PR + env: + CONBENCH_URL: https://velox-conbench.voltrondata.run/ + GITHUB_APP_ID: ${{ secrets.GH_APP_ID }} + GITHUB_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }} + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + CONTENDER_SHA: ${{ github.sha }} + run: | + ./velox/scripts/ci/benchmark-alert.py \ + --contender-sha "$CONTENDER_SHA" \ + --merge-commit-message "$COMMIT_MESSAGE" \ + --z-score-threshold 50 diff --git a/.github/workflows/breeze.yml b/.github/disabled-workflows/breeze.yml similarity index 100% rename from .github/workflows/breeze.yml rename to .github/disabled-workflows/breeze.yml diff --git a/.github/workflows/build-impact-comment.yml b/.github/disabled-workflows/build-impact-comment.yml similarity index 100% rename from .github/workflows/build-impact-comment.yml rename to .github/disabled-workflows/build-impact-comment.yml diff --git a/.github/workflows/build-impact.yml b/.github/disabled-workflows/build-impact.yml similarity index 100% rename from .github/workflows/build-impact.yml rename to .github/disabled-workflows/build-impact.yml diff --git a/.github/workflows/build-metrics.yml b/.github/disabled-workflows/build-metrics.yml similarity index 100% rename from .github/workflows/build-metrics.yml rename to .github/disabled-workflows/build-metrics.yml diff --git a/.github/workflows/build_pyvelox.yml b/.github/disabled-workflows/build_pyvelox.yml similarity index 100% rename from .github/workflows/build_pyvelox.yml rename to .github/disabled-workflows/build_pyvelox.yml diff --git a/.github/workflows/ci-failure-comment.yml b/.github/disabled-workflows/ci-failure-comment.yml similarity index 100% rename from .github/workflows/ci-failure-comment.yml rename to .github/disabled-workflows/ci-failure-comment.yml diff --git a/.github/workflows/claude-review.yml b/.github/disabled-workflows/claude-review.yml similarity index 100% rename from .github/workflows/claude-review.yml rename to .github/disabled-workflows/claude-review.yml diff --git a/.github/workflows/claude.yml b/.github/disabled-workflows/claude.yml similarity index 100% rename from .github/workflows/claude.yml rename to .github/disabled-workflows/claude.yml diff --git a/.github/workflows/docker.yml b/.github/disabled-workflows/docker.yml similarity index 100% rename from .github/workflows/docker.yml rename to .github/disabled-workflows/docker.yml diff --git a/.github/workflows/docs.yml b/.github/disabled-workflows/docs.yml similarity index 100% rename from .github/workflows/docs.yml rename to .github/disabled-workflows/docs.yml diff --git a/.github/workflows/linux-build-base.yml b/.github/disabled-workflows/linux-build-base.yml similarity index 100% rename from .github/workflows/linux-build-base.yml rename to .github/disabled-workflows/linux-build-base.yml diff --git a/.github/workflows/macos.yml b/.github/disabled-workflows/macos.yml similarity index 100% rename from .github/workflows/macos.yml rename to .github/disabled-workflows/macos.yml diff --git a/.github/workflows/scheduled.yml b/.github/disabled-workflows/scheduled.yml similarity index 100% rename from .github/workflows/scheduled.yml rename to .github/disabled-workflows/scheduled.yml diff --git a/.github/workflows/tag.yml b/.github/disabled-workflows/tag.yml similarity index 100% rename from .github/workflows/tag.yml rename to .github/disabled-workflows/tag.yml diff --git a/.github/workflows/ubuntu-bundled-deps.yml b/.github/disabled-workflows/ubuntu-bundled-deps.yml similarity index 100% rename from .github/workflows/ubuntu-bundled-deps.yml rename to .github/disabled-workflows/ubuntu-bundled-deps.yml diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index f91a404668d..0b9020be107 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -17,31 +17,8 @@ name: Linux Build using GCC on: push: branches: - - main - paths: - - velox/** - - '!velox/docs/**' - - CMakeLists.txt - - CMake/** - - scripts/setup-ubuntu.sh - - scripts/setup-common.sh - - scripts/setup-versions.sh - - scripts/setup-helper-functions.sh - - .github/workflows/linux-build.yml - - .github/workflows/linux-build-base.yml - - pull_request: - paths: - - velox/** - - '!velox/docs/**' - - CMakeLists.txt - - CMake/** - - scripts/setup-ubuntu.sh - - scripts/setup-common.sh - - scripts/setup-versions.sh - - scripts/setup-helper-functions.sh - - .github/workflows/linux-build.yml - - .github/workflows/linux-build-base.yml + - velox-cudf + - pull-request/[0-9]+ permissions: contents: read @@ -51,6 +28,231 @@ concurrency: cancel-in-progress: true jobs: - linux-gcc: - name: Build with GCC - uses: ./.github/workflows/linux-build-base.yml + adapters: + name: Linux release with adapters + runs-on: linux-amd64-cpu16 + container: ghcr.io/facebookincubator/velox-dev:adapters + defaults: + run: + shell: bash + env: + CCACHE_DIR: "${{ github.workspace }}/ccache" + VELOX_DEPENDENCY_SOURCE: SYSTEM + GTest_SOURCE: BUNDLED + simdjson_SOURCE: BUNDLED + xsimd_SOURCE: BUNDLED + Arrow_SOURCE: BUNDLED + Thrift_SOURCE: BUNDLED + cudf_SOURCE: BUNDLED + CUDA_VERSION: "12.9" + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Fix git permissions + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Install Dependencies + run: | + if ! yum list installed cuda-nvcc-$(echo ${CUDA_VERSION} | tr '.' '-') 1>/dev/null || \ + ! yum list installed libnvjitlink-devel-$(echo ${CUDA_VERSION} | tr '.' '-') 1>/dev/null; then + source scripts/setup-centos-adapters.sh + install_cuda ${CUDA_VERSION} + fi + pip install cmake==3.30.4 + + - uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4 + with: + path: "${{ env.CCACHE_DIR }}" + key: ccache-linux-adapters + + - name: Zero Ccache Statistics + run: ccache -sz + + - name: Make Release Build + env: + MAKEFLAGS: TREAT_WARNINGS_AS_ERRORS=0 NUM_THREADS=16 MAX_HIGH_MEM_JOBS=4 + CUDA_ARCHITECTURES: 70 + CUDA_COMPILER: /usr/local/cuda-${CUDA_VERSION}/bin/nvcc + CUDA_FLAGS: -ccbin /opt/rh/gcc-toolset-14/root/usr/bin + run: | + EXTRA_CMAKE_FLAGS=( + "-DVELOX_ENABLE_BENCHMARKS=ON" + "-DVELOX_ENABLE_ARROW=ON" + "-DVELOX_ENABLE_PARQUET=ON" + "-DVELOX_ENABLE_HDFS=ON" + "-DVELOX_ENABLE_S3=ON" + "-DVELOX_ENABLE_GCS=ON" + "-DVELOX_ENABLE_ABFS=ON" + "-DVELOX_ENABLE_REMOTE_FUNCTIONS=ON" + "-DVELOX_ENABLE_GPU=ON" + "-DVELOX_ENABLE_CUDF=ON" + "-DVELOX_MONO_LIBRARY=ON" + ) + source /opt/rh/gcc-toolset-14/enable + CC=gcc CXX=g++ make release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS[*]}" + + - name: Ccache after + run: ccache -s + + - uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4 + with: + path: "${{ env.CCACHE_DIR }}" + key: ccache-linux-adapters + + - name: Run non-GPU tests + env: + LIBHDFS3_CONF: "${{ github.workspace }}/scripts/hdfs-client.xml" + working-directory: _build/release + run: | + if [ -f "/opt/miniforge/etc/profile.d/conda.sh" ]; then + source "/opt/miniforge/etc/profile.d/conda.sh" + conda activate adapters + fi + + export CLASSPATH=`/usr/local/hadoop/bin/hdfs classpath --glob` + ctest -j 8 --output-on-failure --no-tests=error \ + -E "velox_exec_test|velox_hdfs_file_test|velox_s3|velox_cudf_" + + - name: Copy Shared Libraries for cuDF Test Binaries + env: + CUDF_DIR: _build/release/velox/experimental/cudf + run: | + mkdir -p "$CUDF_DIR/cudf-libs" + deps=$( + find "$CUDF_DIR/tests" -name "velox_cudf_*" -type f -executable | + xargs ldd 2>/dev/null | + sed -n 's/[^\/]*\(\/[^ ]*\) .*/\1/p' | + grep -vE '^/(lib|usr/lib|lib64)/(libcuda|librt\.so|libm\.so|libstdc\+\+\.so|ld-linux-x86-64\.so|libc\.so)' | + sort -u + ) + if [ -z "$deps" ]; then + echo "Error: No dependencies found" + exit 1 + fi + ( + echo "$deps" | + xargs readlink -f | + xargs -I {} cp {} "$CUDF_DIR/cudf-libs/" + ) + lndeps=$(echo "$deps" | xargs -I {} bash -c '[ -L "$1" ] && echo "$1" || true' bash {}) + ( + cd "$CUDF_DIR/cudf-libs" || exit 1 + while IFS= read -r link; do + [[ -L "$link" ]] || continue + target=$(readlink -f "$link") || continue + target_basename=$(basename "$target") || continue + link_basename=$(basename "$link") || continue + ln -sf "$target_basename" "$link_basename" + done <<< "$lndeps" + ) + tar -cvf "$CUDF_DIR/cudf-libs.tar" -C "$CUDF_DIR" cudf-libs + + - name: Upload cuDF Test Binaries + uses: actions/upload-artifact@v4 + with: + name: cudftestbinaries + path: | + velox/dwio/parquet/tests/examples/int.parquet + velox/experimental/cudf/tests/CMakeLists.txt + _build/release/velox/experimental/cudf/tests/velox_cudf_* + _build/release/velox/experimental/cudf/tests/CTestTestfile.cmake + _build/release/velox/experimental/cudf/cudf-libs.tar + + cudf-tests: + name: cuDF GPU tests + runs-on: linux-amd64-gpu-l4-latest-1 + needs: adapters + timeout-minutes: 30 + env: + CUDF_DIR: _build/release/velox/experimental/cudf + steps: + - name: Install Packages + run: | + sudo apt-get update + sudo apt-get install -y cmake patchelf cuda-toolkit-12-9 + export MINIO_VERSION="2022-05-26T05-48-41Z" + export MINIO_BINARY_NAME="minio-2022-05-26" + wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE."${MINIO_VERSION}" -O "${MINIO_BINARY_NAME}" + sudo mv ./"${MINIO_BINARY_NAME}" /usr/local/bin/ + sudo chmod +x /usr/local/bin/"${MINIO_BINARY_NAME}" + + - name: Check NVIDIA Driver Version + run: nvidia-smi + + - name: Download cuDF Test Binaries + uses: actions/download-artifact@v4 + with: + name: cudftestbinaries + + - name: Adapt Downloaded Files + run: | + sed -i 's|/__w/velox/velox|${{ github.workspace }}|g' $CUDF_DIR/tests/CTestTestfile.cmake + grep "Source directory" $CUDF_DIR/tests/CTestTestfile.cmake + grep "Build directory" $CUDF_DIR/tests/CTestTestfile.cmake + (cd $CUDF_DIR && tar -xf cudf-libs.tar) + for exe in $CUDF_DIR/tests/velox_cudf_*; do + patchelf --force-rpath --set-rpath '$ORIGIN/../cudf-libs' "$exe" + chmod +x "$exe" + done + + - name: Run cuDF Tests + run: | + cd $CUDF_DIR/tests/ + ctest --output-on-failure + +# ubuntu-debug: +# runs-on: linux-amd64-cpu16 +# name: "Ubuntu debug with resolve_dependency" +# env: +# CCACHE_DIR: "${{ github.workspace }}/ccache" +# defaults: +# run: +# shell: bash +# working-directory: velox +# steps: + +# - name: Get Ccache Stash +# - uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4 +# with: +# path: '${{ env.CCACHE_DIR }}' +# key: ccache-ubuntu-debug-default + +# - name: Ensure Stash Dirs Exists +# working-directory: ${{ github.workspace }} +# run: | +# mkdir -p '${{ env.CCACHE_DIR }}' + +# - uses: actions/checkout@v4 +# with: +# path: velox + +# - name: Install Dependencies +# run: | +# source scripts/setup-ubuntu.sh && install_apt_deps + +# - name: Clear CCache Statistics +# run: | +# ccache -sz + +# - name: Make Debug Build +# env: +# VELOX_DEPENDENCY_SOURCE: BUNDLED +# MAKEFLAGS: "TREAT_WARNINGS_AS_ERRORS=0 NUM_THREADS=16 MAX_HIGH_MEM_JOBS=4" +# EXTRA_CMAKE_FLAGS: "-DVELOX_ENABLE_ARROW=ON -DVELOX_ENABLE_PARQUET=ON" +# run: | +# make debug + +# - name: CCache after +# run: | +# ccache -vs + +# - uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4 +# with: +# path: '${{ env.CCACHE_DIR }}' +# key: ccache-ubuntu-debug-default + +# - name: Run Tests +# run: | +# cd _build/debug && ctest -j 8 --output-on-failure --no-tests=error -E "velox_exec_test" diff --git a/.github/workflows/preliminary_checks.yml b/.github/workflows/preliminary_checks.yml index 19ef224aa52..e78b1393ef4 100644 --- a/.github/workflows/preliminary_checks.yml +++ b/.github/workflows/preliminary_checks.yml @@ -14,12 +14,9 @@ name: Run Checks on: - pull_request: - types: - - opened - - reopened - - edited - - synchronize + push: + branches: + - pull-request/[0-9]+ permissions: contents: read @@ -32,28 +29,28 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: persist-credentials: false - - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3.1.4 - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 - title-check: - name: PR Title Format - runs-on: ubuntu-latest - steps: - - shell: python - env: - title: "${{ github.event.pull_request.title }}" - run: | - import re - import os - title = os.environ["title"] - title_re = r"^(feat|fix|perf|build|test|docs|refactor|misc)(\(.+\))?!?: ([A-Z].+)[^.]$" - match = re.search(title_re, title) + # title-check: + # name: PR Title Format + # runs-on: ubuntu-latest + # steps: + # - shell: python + # env: + # title: '${{ github.event.pull_request.title }}' + # run: | + # import re + # import os + # title = os.environ["title"] + # title_re = r"^(feat|fix|build|test|docs|refactor|misc)(\(.+\))?!?: ([A-Z].+)[^.]$" + # match = re.search(title_re, title) - if match is None: - print("::error::Please follow conventional commit guidelines in commit titles as described in CONTRIBUTING.md: https://github.com/facebookincubator/velox/blob/main/CONTRIBUTING.md#commit-messages") - exit(1) - else: - exit(0) + # if match is None: + # print("::error::Please follow conventional commit guidelines in commit titles as described in CONTRIBUTING.md: https://github.com/facebookincubator/velox/blob/main/CONTRIBUTING.md#commit-messages") + # exit(1) + # else: + # exit(0) diff --git a/.gitignore b/.gitignore index 9ce01803eaf..7d2179e9633 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,7 @@ m4/lt~obsolete.m4 #m4/ build/ _build/ +.cache/ .ccache/ ccache/ #*.m4 @@ -309,7 +310,7 @@ third_party/imdb/data .last_format # Benchmarks .last_benchmarked_commit -benchmark_results/ +benchmark_results* duckdb_unittest_tempdir/ grammar.y.tmp src/amalgamation/ @@ -327,3 +328,9 @@ scripts/bm-report/report.html scripts/bm-report/result dist/ wheelhouse/ + +# Custom ignores +aws-sdk-cpp +cufile.log +velox-tpch-*-data +xsimd diff --git a/CMakeLists.txt b/CMakeLists.txt index b19f09d7673..bd6d45055ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,6 +464,8 @@ if(ENABLE_ALL_WARNINGS) -Wno-unused-parameter \ -Wno-sign-compare \ -Wno-ignored-qualifiers \ + -Wno-missing-field-initializers \ + -Wno-deprecated-copy \ ${KNOWN_COMPILER_SPECIFIC_WARNINGS}" ) diff --git a/README.md b/README.md index 1c8c5711509..2043c7ca65b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ +> [!IMPORTANT] +> # Experimental RAPIDS cuDF Backend for Velox +> This repository is a fork of +> [Velox](https://github.com/facebookincubator/velox) with support for [RAPIDS +> cuDF](https://github.com/rapidsai/cudf/) as a GPU-accelerated Velox backend. +> We are working to upstream the contents of this repository to the Velox +> public repository. That effort is +> tracked in [Velox issue +> #12412](https://github.com/facebookincubator/velox/issues/12412), with a +> description of the high level design and merge plan for upstreaming this +> work. +> +> ### Quickstart +> This repository contains scripts for quickly building and running Velox with +> the cuDF backend. To launch the CUDA container: +> ``` +> docker-compose run -e NUM_THREADS=$(nproc) --rm adapters-cuda /bin/bash +> ``` +> Then invoke `./build.sh` to build Velox with cuDF support and run tests. + Velox logo [![Linux Build using GCC](https://github.com/facebookincubator/velox/actions/workflows/linux-build.yml/badge.svg)](https://github.com/facebookincubator/velox/actions/workflows/linux-build.yml) diff --git a/benchmark.sh b/benchmark.sh new file mode 100755 index 00000000000..0eb380f3112 --- /dev/null +++ b/benchmark.sh @@ -0,0 +1,83 @@ +#!/bin/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 + +# To get the data, copy from /datasets/velox-tpch-sf10-data to this repo: +# cp -r /datasets/velox-tpch-sf10-data . + +# Run this to launch the CUDA container: +# docker-compose run -e NUM_THREADS=$(nproc) --rm adapters-cuda /bin/bash +# Then invoke ./build.sh to build with GPU support and run tests. + +# Run a GPU build and test +pushd "$(dirname ${0})" + +mkdir -p benchmark_results + +queries=${1:-$(seq 1 22)} +devices=${2:-"cpu gpu"} +profile=${3:-"false"} + +num_drivers=${NUM_DRIVERS:-4} +output_batch_rows=${BATCH_SIZE_ROWS:-100000} +cudf_chunk_read_limit=$((1024 * 1024 * 1024 * 1)) +cudf_pass_read_limit=0 +VELOX_CUDF_MEMORY_RESOURCE="async" + +for query_number in ${queries}; do + printf -v query_number '%02d' "${query_number}" + for device in ${devices}; do + case "${device}" in + "cpu") + num_drivers=${NUM_DRIVERS:-32} + VELOX_CUDF_ENABLED=false + ;; + "gpu") + VELOX_CUDF_ENABLED=true + ;; + esac + echo "Running query ${query_number} on ${device} with ${num_drivers} drivers." + # The benchmarks segfault after reporting results, so we disable errors + PROFILE_CMD="" + if [[ ${profile} == "true" ]]; then + PROFILE_CMD="nsys profile -t nvtx,cuda,osrt -f true --cuda-memory-usage=true --cuda-um-cpu-page-faults=true --cuda-um-gpu-page-faults=true --output=benchmark_results/q${query_number}_${device}_${num_drivers}_drivers.nsys-rep" + # Enable GPU metrics if supported (Ampere or newer) + if [[ "$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader -i 0 | cut -d '.' -f 1)" -gt 7 ]]; then + device_id=${CUDA_VISIBLE_DEVICES:-"0"} + PROFILE_CMD="${PROFILE_CMD} --gpu-metrics-devices=${device_id}" + fi + fi + + set +e -x + ${PROFILE_CMD} \ + ./_build/release/velox/benchmarks/tpch/velox_tpch_benchmark \ + --data_path=velox-tpch-sf100-data \ + --data_format=parquet \ + --run_query_verbose=${query_number} \ + --num_repeats=1 \ + --velox_cudf_enabled=${VELOX_CUDF_ENABLED} \ + --velox_cudf_memory_resource=${VELOX_CUDF_MEMORY_RESOURCE} \ + --num_drivers=${num_drivers} \ + --preferred_output_batch_rows=${output_batch_rows} \ + --max_output_batch-rows=${output_batch_rows} \ + --cudf_chunk_read_limit=${cudf_chunk_read_limit} \ + --cudf_pass_read_limit=${cudf_pass_read_limit} 2>&1 | + tee benchmark_results/q${query_number}_${device}_${num_drivers}_drivers + { set -e +x; } &>/dev/null + done +done + +popd diff --git a/build.sh b/build.sh new file mode 100755 index 00000000000..12ca0786f3a --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/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 + +# Run this to launch the CUDA container: +# docker-compose run -e NUM_THREADS=$(nproc) --rm adapters-cuda /bin/bash +# Then invoke ./build.sh to build with GPU support and run tests. + +# Run a GPU build and test +pushd "$(dirname ${0})" + +CUDA_ARCHITECTURES="native" EXTRA_CMAKE_FLAGS="-DVELOX_ENABLE_ARROW=ON -DVELOX_ENABLE_PARQUET=ON -DVELOX_ENABLE_BENCHMARKS=ON -DVELOX_ENABLE_BENCHMARKS_BASIC=ON" make cudf + +cd _build/release + +ctest -R cudf -V + +popd diff --git a/docker-compose.yml b/docker-compose.yml index d0a96bd7553..c7c47c575f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,7 @@ services: environment: NUM_THREADS: ${NUM_THREADS:-8} # default value for NUM_THREADS CCACHE_DIR: /velox/.ccache + CMAKE_EXPORT_COMPILE_COMMANDS: 1 volumes: - .:/velox:delegated working_dir: /velox