Skip to content

Commit 8374802

Browse files
czentgrfacebook-github-bot
authored andcommitted
Add Clang Linux build to CI pipeline (facebookincubator#10767)
Summary: The linux build is refactored to be able to switch between clang and gcc based builds of Velox. The gcc based linux build is run on pull and push. The clang based linux build is added to the scheduled jobs and executed on schedule only. Pull Request resolved: facebookincubator#10767 Reviewed By: xiaoxmeng Differential Revision: D65420303 Pulled By: mbasmanova fbshipit-source-id: 6c14e9240bb74f13f9fca9dd8a86d87a84e47f44
1 parent 427ac31 commit 8374802

File tree

6 files changed

+214
-155
lines changed

6 files changed

+214
-155
lines changed
+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Linux Build
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
use-clang:
21+
description: 'Use Clang to compile the project.'
22+
default: false
23+
required: false
24+
type: boolean
25+
26+
jobs:
27+
adapters:
28+
name: Linux release with adapters
29+
# prevent errors when forks ff their main branch
30+
if: ${{ github.repository == 'facebookincubator/velox' }}
31+
runs-on: 8-core-ubuntu
32+
container: ghcr.io/facebookincubator/velox-dev:adapters
33+
defaults:
34+
run:
35+
shell: bash
36+
env:
37+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
38+
VELOX_DEPENDENCY_SOURCE: SYSTEM
39+
GTest_SOURCE: BUNDLED
40+
simdjson_SOURCE: BUNDLED
41+
xsimd_SOURCE: BUNDLED
42+
CUDA_VERSION: "12.4"
43+
USE_CLANG: "${{ inputs.use-clang && 'true' || 'false' }}"
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Fix git permissions
48+
# Usually actions/checkout does this but as we run in a container
49+
# it doesn't work
50+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
51+
52+
- name: Install Dependencies
53+
run: |
54+
# Allows to install arbitrary cuda-version whithout needing to update
55+
# docker container before. It simplifies testing new/different versions
56+
if ! yum list installed cuda-nvcc-$(echo ${CUDA_VERSION} | tr '.' '-') 1>/dev/null; then
57+
source scripts/setup-centos9.sh
58+
install_cuda ${CUDA_VERSION}
59+
fi
60+
61+
- name: Install Minio
62+
run: |
63+
MINIO_BINARY="minio-2022-05-26"
64+
if [ ! -f /usr/local/bin/${MINIO_BINARY} ]; then
65+
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -O ${MINIO_BINARY}
66+
chmod +x ./${MINIO_BINARY}
67+
mv ./${MINIO_BINARY} /usr/local/bin/
68+
fi
69+
70+
- uses: assignUser/stash/restore@v1
71+
with:
72+
path: '${{ env.CCACHE_DIR }}'
73+
key: ccache-linux-adapters-${{ inputs.use-clang && 'clang' || 'gcc' }}
74+
75+
- name: "Zero Ccache Statistics"
76+
run: |
77+
ccache -sz
78+
79+
- name: Make Release Build
80+
env:
81+
MAKEFLAGS: 'NUM_THREADS=8 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=4'
82+
CUDA_ARCHITECTURES: 70
83+
CUDA_COMPILER: /usr/local/cuda-${CUDA_VERSION}/bin/nvcc
84+
# Set compiler to GCC 12
85+
CUDA_FLAGS: "-ccbin /opt/rh/gcc-toolset-12/root/usr/bin"
86+
run: |
87+
EXTRA_CMAKE_FLAGS=(
88+
"-DVELOX_ENABLE_BENCHMARKS=ON"
89+
"-DVELOX_ENABLE_ARROW=ON"
90+
"-DVELOX_ENABLE_PARQUET=ON"
91+
"-DVELOX_ENABLE_HDFS=ON"
92+
"-DVELOX_ENABLE_S3=ON"
93+
"-DVELOX_ENABLE_GCS=ON"
94+
"-DVELOX_ENABLE_ABFS=ON"
95+
"-DVELOX_ENABLE_REMOTE_FUNCTIONS=ON"
96+
"-DVELOX_ENABLE_GPU=ON"
97+
"-DVELOX_MONO_LIBRARY=ON"
98+
)
99+
if [[ "${USE_CLANG}" = "true" ]]; then scripts/setup-centos9.sh install_clang15; export CC=/usr/bin/clang-15; export CXX=/usr/bin/clang++-15; CUDA_FLAGS="-ccbin /usr/lib64/llvm15/bin/clang++-15"; fi
100+
make release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS[*]}"
101+
102+
- name: Ccache after
103+
run: ccache -s
104+
105+
- uses: assignUser/stash/save@v1
106+
with:
107+
path: '${{ env.CCACHE_DIR }}'
108+
key: ccache-linux-adapters-${{ inputs.use-clang && 'clang' || 'gcc' }}
109+
110+
- name: Run Tests
111+
# Some of the adapters dependencies are in the 'adapters' conda env
112+
shell: mamba run --no-capture-output -n adapters /usr/bin/bash -e {0}
113+
env:
114+
LIBHDFS3_CONF: "${{ github.workspace }}/scripts/hdfs-client.xml"
115+
working-directory: _build/release
116+
run: |
117+
export CLASSPATH=`/usr/local/hadoop/bin/hdfs classpath --glob`
118+
ctest -j 8 --label-exclude cuda_driver --output-on-failure --no-tests=error
119+
120+
ubuntu-debug:
121+
runs-on: 8-core-ubuntu
122+
# prevent errors when forks ff their main branch
123+
if: ${{ github.repository == 'facebookincubator/velox' }}
124+
name: "Ubuntu debug with resolve_dependency"
125+
env:
126+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
127+
USE_CLANG: "${{ inputs.use-clang && 'true' || 'false' }}"
128+
defaults:
129+
run:
130+
shell: bash
131+
working-directory: velox
132+
steps:
133+
134+
- name: Get Ccache Stash
135+
uses: assignUser/stash/restore@v1
136+
with:
137+
path: '${{ env.CCACHE_DIR }}'
138+
key: ccache-ubuntu-debug-default-${{ inputs.use-clang && 'clang' || 'gcc' }}
139+
140+
- name: Ensure Stash Dirs Exists
141+
working-directory: ${{ github.workspace }}
142+
run: |
143+
mkdir -p '${{ env.CCACHE_DIR }}'
144+
145+
- uses: actions/checkout@v4
146+
with:
147+
path: velox
148+
149+
- name: Install Dependencies
150+
run: |
151+
source scripts/setup-ubuntu.sh && install_apt_deps
152+
153+
- name: Clear CCache Statistics
154+
run: |
155+
ccache -sz
156+
157+
- name: Make Debug Build
158+
env:
159+
VELOX_DEPENDENCY_SOURCE: BUNDLED
160+
ICU_SOURCE: SYSTEM
161+
MAKEFLAGS: "NUM_THREADS=8 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=3"
162+
EXTRA_CMAKE_FLAGS: "-DVELOX_ENABLE_ARROW=ON -DVELOX_ENABLE_PARQUET=ON"
163+
run: |
164+
if [[ "${USE_CLANG}" = "true" ]]; then export CC=/usr/bin/clang-15; export CXX=/usr/bin/clang++-15; fi
165+
make debug
166+
167+
- name: CCache after
168+
run: |
169+
ccache -vs
170+
171+
- uses: assignUser/stash/save@v1
172+
with:
173+
path: '${{ env.CCACHE_DIR }}'
174+
key: ccache-ubuntu-debug-default-${{ inputs.use-clang && 'clang' || 'gcc' }}
175+
176+
- name: Run Tests
177+
run: |
178+
cd _build/debug && ctest -j 8 --output-on-failure --no-tests=error

.github/workflows/linux-build.yml

+6-149
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Linux Build
15+
name: Linux Build using GCC
1616

1717
on:
1818
push:
@@ -27,6 +27,7 @@ on:
2727
- "scripts/setup-ubuntu.sh"
2828
- "scripts/setup-helper-functions.sh"
2929
- ".github/workflows/linux-build.yml"
30+
- ".github/workflows/linux-build-base.yml"
3031

3132
pull_request:
3233
paths:
@@ -38,6 +39,7 @@ on:
3839
- "scripts/setup-ubuntu.sh"
3940
- "scripts/setup-helper-functions.sh"
4041
- ".github/workflows/linux-build.yml"
42+
- ".github/workflows/linux-build-base.yml"
4143

4244
permissions:
4345
contents: read
@@ -47,151 +49,6 @@ concurrency:
4749
cancel-in-progress: true
4850

4951
jobs:
50-
adapters:
51-
name: Linux release with adapters
52-
# prevent errors when forks ff their main branch
53-
if: ${{ github.repository == 'facebookincubator/velox' }}
54-
runs-on: 8-core-ubuntu
55-
container: ghcr.io/facebookincubator/velox-dev:adapters
56-
defaults:
57-
run:
58-
shell: bash
59-
env:
60-
CCACHE_DIR: "${{ github.workspace }}/.ccache"
61-
VELOX_DEPENDENCY_SOURCE: SYSTEM
62-
GTest_SOURCE: BUNDLED
63-
simdjson_SOURCE: BUNDLED
64-
xsimd_SOURCE: BUNDLED
65-
CUDA_VERSION: "12.4"
66-
steps:
67-
- uses: actions/checkout@v4
68-
69-
- name: Fix git permissions
70-
# Usually actions/checkout does this but as we run in a container
71-
# it doesn't work
72-
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
73-
74-
- name: Install Dependencies
75-
run: |
76-
# Allows to install arbitrary cuda-version whithout needing to update
77-
# docker container before. It simplifies testing new/different versions
78-
if ! yum list installed cuda-nvcc-$(echo ${CUDA_VERSION} | tr '.' '-') 1>/dev/null; then
79-
source scripts/setup-centos9.sh
80-
install_cuda ${CUDA_VERSION}
81-
fi
82-
83-
- name: Install Minio
84-
run: |
85-
MINIO_BINARY="minio-2022-05-26"
86-
if [ ! -f /usr/local/bin/${MINIO_BINARY} ]; then
87-
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -O ${MINIO_BINARY}
88-
chmod +x ./${MINIO_BINARY}
89-
mv ./${MINIO_BINARY} /usr/local/bin/
90-
fi
91-
92-
- uses: assignUser/stash/restore@v1
93-
with:
94-
path: '${{ env.CCACHE_DIR }}'
95-
key: ccache-linux-adapters
96-
97-
- name: "Zero Ccache Statistics"
98-
run: |
99-
ccache -sz
100-
101-
- name: Make Release Build
102-
env:
103-
MAKEFLAGS: 'NUM_THREADS=8 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=4'
104-
CUDA_ARCHITECTURES: 70
105-
CUDA_COMPILER: /usr/local/cuda-${CUDA_VERSION}/bin/nvcc
106-
# Set compiler to GCC 12
107-
CUDA_FLAGS: "-ccbin /opt/rh/gcc-toolset-12/root/usr/bin"
108-
run: |
109-
EXTRA_CMAKE_FLAGS=(
110-
"-DVELOX_ENABLE_BENCHMARKS=ON"
111-
"-DVELOX_ENABLE_ARROW=ON"
112-
"-DVELOX_ENABLE_PARQUET=ON"
113-
"-DVELOX_ENABLE_HDFS=ON"
114-
"-DVELOX_ENABLE_S3=ON"
115-
"-DVELOX_ENABLE_GCS=ON"
116-
"-DVELOX_ENABLE_ABFS=ON"
117-
"-DVELOX_ENABLE_REMOTE_FUNCTIONS=ON"
118-
"-DVELOX_ENABLE_GPU=ON"
119-
"-DVELOX_MONO_LIBRARY=ON"
120-
)
121-
make release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS[*]}"
122-
123-
- name: Ccache after
124-
run: ccache -s
125-
126-
- uses: assignUser/stash/save@v1
127-
with:
128-
path: '${{ env.CCACHE_DIR }}'
129-
key: ccache-linux-adapters
130-
131-
- name: Run Tests
132-
# Some of the adapters dependencies are in the 'adapters' conda env
133-
shell: mamba run --no-capture-output -n adapters /usr/bin/bash -e {0}
134-
env:
135-
LIBHDFS3_CONF: "${{ github.workspace }}/scripts/hdfs-client.xml"
136-
working-directory: _build/release
137-
run: |
138-
export CLASSPATH=`/usr/local/hadoop/bin/hdfs classpath --glob`
139-
ctest -j 8 --label-exclude cuda_driver --output-on-failure --no-tests=error
140-
141-
ubuntu-debug:
142-
runs-on: 8-core-ubuntu
143-
# prevent errors when forks ff their main branch
144-
if: ${{ github.repository == 'facebookincubator/velox' }}
145-
name: "Ubuntu debug with resolve_dependency"
146-
env:
147-
CCACHE_DIR: "${{ github.workspace }}/.ccache"
148-
defaults:
149-
run:
150-
shell: bash
151-
working-directory: velox
152-
steps:
153-
154-
- name: Get Ccache Stash
155-
uses: assignUser/stash/restore@v1
156-
with:
157-
path: '${{ env.CCACHE_DIR }}'
158-
key: ccache-ubuntu-debug-default
159-
160-
- name: Ensure Stash Dirs Exists
161-
working-directory: ${{ github.workspace }}
162-
run: |
163-
mkdir -p '${{ env.CCACHE_DIR }}'
164-
165-
- uses: actions/checkout@v4
166-
with:
167-
path: velox
168-
169-
- name: Install Dependencies
170-
run: |
171-
source scripts/setup-ubuntu.sh && install_apt_deps
172-
173-
- name: Clear CCache Statistics
174-
run: |
175-
ccache -sz
176-
177-
- name: Make Debug Build
178-
env:
179-
VELOX_DEPENDENCY_SOURCE: BUNDLED
180-
ICU_SOURCE: SYSTEM
181-
MAKEFLAGS: "NUM_THREADS=8 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=3"
182-
EXTRA_CMAKE_FLAGS: "-DVELOX_ENABLE_ARROW=ON -DVELOX_ENABLE_PARQUET=ON"
183-
run: |
184-
make debug
185-
186-
- name: CCache after
187-
run: |
188-
ccache -vs
189-
190-
- uses: assignUser/stash/save@v1
191-
with:
192-
path: '${{ env.CCACHE_DIR }}'
193-
key: ccache-ubuntu-debug-default
194-
195-
- name: Run Tests
196-
run: |
197-
cd _build/debug && ctest -j 8 --output-on-failure --no-tests=error
52+
linux-gcc:
53+
name: Build with GCC
54+
uses: ./.github/workflows/linux-build-base.yml

.github/workflows/scheduled.yml

+7
Original file line numberDiff line numberDiff line change
@@ -992,3 +992,10 @@ jobs:
992992
/tmp/writer_fuzzer_repro
993993
/tmp/server.log
994994
/var/log
995+
996+
linux-clang:
997+
if: ${{ github.event_name == 'schedule' }}
998+
name: Build with Clang
999+
uses: ./.github/workflows/linux-build-base.yml
1000+
with:
1001+
use-clang: true

CMakeLists.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,6 @@ if(${VELOX_FORCE_COLORED_OUTPUT})
231231
endif()
232232
endif()
233233

234-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
235-
AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL 15)
236-
set(CMAKE_EXE_LINKER_FLAGS "-latomic")
237-
endif()
238-
239234
# At the moment we prefer static linking but by default cmake looks for shared
240235
# libs first. This will still fallback to shared libs when static ones are not
241236
# found
@@ -384,6 +379,13 @@ if(${VELOX_ENABLE_GPU})
384379
find_package(CUDAToolkit REQUIRED)
385380
endif()
386381

382+
# Set after the test of the CUDA compiler. Otherwise, the test fails with
383+
# -latomic not found because it is added right after the compiler exe.
384+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
385+
AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL 15)
386+
set(CMAKE_EXE_LINKER_FLAGS "-latomic")
387+
endif()
388+
387389
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
388390

389391
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")

0 commit comments

Comments
 (0)