Skip to content

Commit 7cf340a

Browse files
committed
Add Clang Linux build to CI pipeline
1 parent 65f7b5a commit 7cf340a

File tree

5 files changed

+210
-152
lines changed

5 files changed

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

.github/workflows/linux-build.yml

Lines changed: 12 additions & 146 deletions
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 and Clang
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-gcc.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-gcc.yml"
4143

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

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ if(${VELOX_FORCE_COLORED_OUTPUT})
229229
endif()
230230
endif()
231231

232-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
233-
AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL 15)
234-
set(CMAKE_EXE_LINKER_FLAGS "-latomic")
235-
endif()
236-
237232
# At the moment we prefer static linking but by default cmake looks for shared
238233
# libs first. This will still fallback to shared libs when static ones are not
239234
# found
@@ -383,6 +378,13 @@ if(${VELOX_ENABLE_GPU})
383378
include_directories("${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
384379
endif()
385380

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

388390
set(BOOST_INCLUDE_LIBRARIES

scripts/setup-ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function install_clang15 {
4949
fi
5050
CLANG_PACKAGE_LIST=clang-15
5151
if [[ ${VERSION} =~ "22.04" ]]; then
52-
CLANG_PACKAGE_LIST=${CLANG_PACKAGE_LIST} gcc-12 g++-12 libc++-12-dev
52+
CLANG_PACKAGE_LIST="${CLANG_PACKAGE_LIST} gcc-12 g++-12 libc++-12-dev"
5353
fi
5454
${SUDO} apt install ${CLANG_PACKAGE_LIST} -y
5555
}

0 commit comments

Comments
 (0)