Skip to content

Commit

Permalink
build(ci): Add breeze build and test job (facebookincubator#11637)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookincubator#11637

Reviewed By: Yuhta

Differential Revision: D66560387

Pulled By: xiaoxmeng

fbshipit-source-id: b82a544d4f6a2e37abaa5bcc9dba4af4e7cba6c6
  • Loading branch information
韦佟 committed Nov 29, 2024
1 parent 565d07a commit 6e08715
Show file tree
Hide file tree
Showing 12 changed files with 871 additions and 106 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/breeze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# 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: Breeze Linux Build

on:
push:
branches:
- "main"
paths:
- "velox/experimental/breeze/**"
- "velox/external/perfetto/**"
- "CMake/**"
- "scripts/setup-ubuntu.sh"
- "scripts/setup-helper-functions.sh"
- ".github/workflows/breeze.yml"

pull_request:
paths:
- "velox/experimental/breeze/**"
- "velox/external/perfetto/**"
- "CMake/**"
- "scripts/setup-ubuntu.sh"
- "scripts/setup-helper-functions.sh"
- ".github/workflows/breeze.yml"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
ubuntu-debug:
runs-on: ubuntu-22.04
# prevent errors when forks ff their main branch
if: ${{ github.repository == 'facebookincubator/velox' }}
name: "Ubuntu debug"
defaults:
run:
shell: bash
working-directory: velox
steps:

- uses: actions/checkout@v4
with:
path: velox

- name: Install Dependencies
run: |
source scripts/setup-ubuntu.sh && install_apt_deps
- name: Make Debug Build
env:
VELOX_DEPENDENCY_SOURCE: BUNDLED
# OpenMP build with asan+ubsan enabled
run: |
cmake -S velox/experimental/breeze -B _build-breeze/debug \
-DCMAKE_BUILD_TYPE=Asan \
-DCMAKE_CXX_FLAGS="-fsanitize=undefined" \
-DBUILD_GENERATE_TEST_FIXTURES=OFF \
-DBUILD_OPENMP=ON
cmake --build _build-breeze/debug -j 8
- name: Run Tests
run: |
cd _build-breeze/debug && ctest -j 8 --output-on-failure --no-tests=error
ubuntu-gpu-relwithdebinfo:
runs-on: 4-core-ubuntu-gpu-t4
# prevent errors when forks ff their main branch
if: ${{ github.repository == 'facebookincubator/velox' }}
name: "Ubuntu GPU debug"
env:
CUDA_VERSION: "12.2"
defaults:
run:
shell: bash
working-directory: velox
steps:

- uses: actions/checkout@v4
with:
path: velox

- name: Install Dependencies
run: |
source scripts/setup-ubuntu.sh && install_apt_deps && install_cuda ${CUDA_VERSION}
sudo chmod 755 -R /usr/local/lib/python3.10/dist-packages
- name: Make RelWithDebInfo Build
run: |
cmake -S velox/experimental/breeze -B _build-breeze/relwithdebinfo \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_GENERATE_TEST_FIXTURES=OFF \
-DBUILD_CUDA=ON \
-DCMAKE_NVCC_FLAGS="-arch=native"
cmake --build _build-breeze/relwithdebinfo -j 8
- name: Run Tests
run: |
cd _build-breeze/relwithdebinfo && ctest -j 8 --output-on-failure --no-tests=error
1 change: 1 addition & 0 deletions velox/experimental/breeze/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(BUILD_OPENCL "Build OpenCL tests." OFF)
option(BUILD_OPENMP "Build OpenMP tests." OFF)
option(BUILD_METAL "Build Metal tests." OFF)
option(BUILD_TRACING "Build tracing." ON)
option(BUILD_GENERATE_TEST_FIXTURES "Generate test fixtures at build time." ON)

if(NOT DEFINED PERFTEST_EXT_TYPES)
set(PERFTEST_EXT_TYPES
Expand Down
4 changes: 1 addition & 3 deletions velox/experimental/breeze/cmake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function(breeze_add_cuda_test target source)
OUTPUT ${target}
COMMAND
${NVCC_EXECUTABLE} -o ${target} ${target}.o ${arg_LIBS}
$<TARGET_FILE_DIR:gtest>/libgtest.a
$<TARGET_FILE_DIR:GTest::gtest>/libgtest.a
$<TARGET_FILE_DIR:test_main>/libtest_main.a
$<$<BOOL:${BUILD_TRACING}>:$<TARGET_FILE_DIR:perfetto>/libperfetto.a>
${ARCH_LINK_FLAGS}
Expand All @@ -107,8 +107,6 @@ function(breeze_add_cuda_test target source)
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${target})
gtest_discover_tests(${target}_TESTS TEST_PREFIX cuda: DISCOVERY_MODE
PRE_TEST)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${target}
DESTINATION ${CMAKE_INSTALL_BINDIR})
if(DEFINED CUDA_EXPECTED_RESOURCE_USAGE_DIR)
if(EXISTS "${CUDA_EXPECTED_RESOURCE_USAGE_DIR}/${target}-expected.txt")
set(GET_RESOURCE_USAGE_CMDLINE
Expand Down
4 changes: 1 addition & 3 deletions velox/experimental/breeze/cmake/hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(breeze_add_hip_test target source)
OUTPUT ${target}
COMMAND
${HIPCC_EXECUTABLE} -o ${target} ${target}.o
$<TARGET_FILE_DIR:gtest>/libgtest.a
$<TARGET_FILE_DIR:GTest::gtest>/libgtest.a
$<TARGET_FILE_DIR:test_main>/libtest_main.a
$<$<BOOL:${BUILD_TRACING}>:$<TARGET_FILE_DIR:perfetto>/libperfetto.a>
${ARCH_LINK_FLAGS}
Expand All @@ -49,6 +49,4 @@ function(breeze_add_hip_test target source)
set_property(TARGET ${target}_TESTS
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${target})
gtest_discover_tests(${target}_TESTS TEST_PREFIX hip: DISCOVERY_MODE PRE_TEST)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${target}
DESTINATION ${CMAKE_INSTALL_BINDIR})
endfunction()
4 changes: 1 addition & 3 deletions velox/experimental/breeze/cmake/sycl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function(breeze_add_sycl_test target source)
OUTPUT ${target}
COMMAND
${SYCLCC_EXECUTABLE} -o ${target} ${target}.o
$<TARGET_FILE_DIR:gtest>/libgtest.a
$<TARGET_FILE_DIR:GTest::gtest>/libgtest.a
$<TARGET_FILE_DIR:test_main>/libtest_main.a ${CMAKE_THREAD_LIBS_INIT}
${ARCH_LINK_FLAGS}
$<$<BOOL:${BUILD_TRACING}>:$<TARGET_FILE_DIR:perfetto>/libperfetto.a>
Expand All @@ -51,6 +51,4 @@ function(breeze_add_sycl_test target source)
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${target})
gtest_discover_tests(${target}_TESTS TEST_PREFIX sycl: DISCOVERY_MODE
PRE_TEST)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${target}
DESTINATION ${CMAKE_INSTALL_BINDIR})
endfunction()
194 changes: 98 additions & 96 deletions velox/experimental/breeze/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

include_directories(${CMAKE_SOURCE_DIR})

cxx_library(test_main "${cxx_strict}" test_main.cpp)
add_library(test_main test_main.cpp)
target_link_libraries(
test_main
PUBLIC gtest $<$<BOOL:${BUILD_TRACING}>:perfetto>)
Expand Down Expand Up @@ -160,101 +160,103 @@ function(
endfunction()

function(breeze_add_unittests dir type)
if(BUILD_OPENCL)
generate_kernel(
${type}_opencl_kernels_src
${dir}
${type}
"opencl"
"generated/${dir}/kernels-opencl.h")
generate_test_fixture(
${type}_opencl_test_fixture_src
${dir}
${type}
"opencl"
"generated/${dir}/${type}_test-opencl.h")
set(_opencl_kernels_src ${type}_opencl_kernels_src)
set(_opencl_test_fixture_src ${type}_opencl_test_fixture_src)
endif()
if(BUILD_METAL)
generate_kernel(
${type}_metal_kernels_src
${dir}
${type}
"metal"
"generated/${dir}/kernels-metal.h")
generate_test_fixture(
${type}_metal_test_fixture_src
${dir}
${type}
"metal"
"generated/${dir}/${type}_test-metal.h")
set(_metal_kernels_src ${type}_metal_kernels_src)
set(_metal_test_fixture_src ${type}_metal_test_fixture_src)
endif()
if(BUILD_CUDA)
generate_kernel(
${type}_cuda_kernels_src
${dir}
${type}
"cuda"
"generated/${dir}/kernels.cuh")
generate_test_fixture(
${type}_cuda_test_fixture_src
${dir}
${type}
"cuda"
"generated/${dir}/${type}_test-cuda.cuh")
set(_cuda_kernels_src ${type}_cuda_kernels_src)
set(_cuda_test_fixture_src ${type}_cuda_test_fixture_src)
endif()
if(BUILD_HIP)
generate_kernel(
${type}_hip_kernels_src
${dir}
${type}
"hip"
"generated/${dir}/kernels-hip.hpp")
generate_test_fixture(
${type}_hip_test_fixture_src
${dir}
${type}
"hip"
"generated/${dir}/${type}_test-hip.hpp")
set(_hip_kernels_src ${type}_hip_kernels_src)
set(_hip_test_fixture_src ${type}_hip_test_fixture_src)
endif()
if(BUILD_SYCL)
generate_kernel(
${type}_sycl_kernels_src
${dir}
${type}
"sycl"
"generated/${dir}/kernels-sycl.hpp")
generate_test_fixture(
${type}_sycl_test_fixture_src
${dir}
${type}
"sycl"
"generated/${dir}/${type}_test-sycl.hpp")
set(_sycl_kernels_src ${type}_sycl_kernels_src)
set(_sycl_test_fixture_src ${type}_sycl_test_fixture_src)
endif()
if(BUILD_OPENMP)
generate_kernel(
${type}_openmp_kernels_src
${dir}
${type}
"openmp"
"generated/${dir}/kernels-openmp.h")
generate_test_fixture(
${type}_openmp_test_fixture_src
${dir}
${type}
"openmp"
"generated/${dir}/${type}_test-openmp.h")
set(_openmp_kernels_src ${type}_openmp_kernels_src)
set(_openmp_test_fixture_src ${type}_openmp_test_fixture_src)
if(BUILD_GENERATE_TEST_FIXTURES)
if(BUILD_OPENCL)
generate_kernel(
${type}_opencl_kernels_src
${dir}
${type}
"opencl"
"generated/${dir}/kernels-opencl.h")
generate_test_fixture(
${type}_opencl_test_fixture_src
${dir}
${type}
"opencl"
"generated/${dir}/${type}_test-opencl.h")
set(_opencl_kernels_src ${type}_opencl_kernels_src)
set(_opencl_test_fixture_src ${type}_opencl_test_fixture_src)
endif()
if(BUILD_METAL)
generate_kernel(
${type}_metal_kernels_src
${dir}
${type}
"metal"
"generated/${dir}/kernels-metal.h")
generate_test_fixture(
${type}_metal_test_fixture_src
${dir}
${type}
"metal"
"generated/${dir}/${type}_test-metal.h")
set(_metal_kernels_src ${type}_metal_kernels_src)
set(_metal_test_fixture_src ${type}_metal_test_fixture_src)
endif()
if(BUILD_CUDA)
generate_kernel(
${type}_cuda_kernels_src
${dir}
${type}
"cuda"
"generated/${dir}/kernels-cuda.cuh")
generate_test_fixture(
${type}_cuda_test_fixture_src
${dir}
${type}
"cuda"
"generated/${dir}/${type}_test-cuda.cuh")
set(_cuda_kernels_src ${type}_cuda_kernels_src)
set(_cuda_test_fixture_src ${type}_cuda_test_fixture_src)
endif()
if(BUILD_HIP)
generate_kernel(
${type}_hip_kernels_src
${dir}
${type}
"hip"
"generated/${dir}/kernels-hip.hpp")
generate_test_fixture(
${type}_hip_test_fixture_src
${dir}
${type}
"hip"
"generated/${dir}/${type}_test-hip.hpp")
set(_hip_kernels_src ${type}_hip_kernels_src)
set(_hip_test_fixture_src ${type}_hip_test_fixture_src)
endif()
if(BUILD_SYCL)
generate_kernel(
${type}_sycl_kernels_src
${dir}
${type}
"sycl"
"generated/${dir}/kernels-sycl.hpp")
generate_test_fixture(
${type}_sycl_test_fixture_src
${dir}
${type}
"sycl"
"generated/${dir}/${type}_test-sycl.hpp")
set(_sycl_kernels_src ${type}_sycl_kernels_src)
set(_sycl_test_fixture_src ${type}_sycl_test_fixture_src)
endif()
if(BUILD_OPENMP)
generate_kernel(
${type}_openmp_kernels_src
${dir}
${type}
"openmp"
"generated/${dir}/kernels-openmp.h")
generate_test_fixture(
${type}_openmp_test_fixture_src
${dir}
${type}
"openmp"
"generated/${dir}/${type}_test-openmp.h")
set(_openmp_kernels_src ${type}_openmp_kernels_src)
set(_openmp_test_fixture_src ${type}_openmp_test_fixture_src)
endif()
endif()
breeze_add_tests(
${dir}
Expand Down
2 changes: 2 additions & 0 deletions velox/experimental/breeze/test/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ function generate {

generate openmp "algorithm" h
generate openmp "function" h
generate cuda "algorithm" cuh
generate cuda "function" cuh
Loading

0 comments on commit 6e08715

Please sign in to comment.