Skip to content

Commit 24bc35f

Browse files
committed
build: Optimize CI with test splitting and 32-core runners
Split 5 monolithic test targets into 139 individual test binaries for better ctest parallelism, and upgrade both ubuntu-debug and adapters jobs to 32-core runners with tuned build settings. Test target splits (CMakeLists.txt changes only): - velox_exec_test -> 76 individual tests - velox_exec_util_test -> 9 individual tests - velox_aggregates_test -> 43 individual tests - velox_cache_test -> 5 individual tests - velox_serializer_test -> 5 individual tests CI workflow changes (ubuntu-debug + adapters): - Runner: 16-core/8-core -> 32-core (128 GB RAM) - NUM_THREADS: 16/8 -> 32 - MAX_HIGH_MEM_JOBS: 4 -> 12 (128 GB / 6.8 GB per heavy TU) - MAX_LINK_JOBS: 2/4 -> 12 (shared links use ~1 GB each) - ctest: -j 8 -> -j 24 --timeout 900 - ulimit -n 65536 to prevent "Too many open files" - Adapters: add -DVELOX_BUILD_SHARED=ON for faster linking The test splits add ~135 new link targets. On the previous 8-core runner (32 GB RAM), these would OOM during concurrent compilation of heavy TUs (up to 6.8 GB each) + parallel linking. Validated on 48-core test machine (throttled to 32 threads): - Build: 26m 34s (cold, no ccache) - Test: 17m 45s (631 tests, 625 passed) - Total: 44m 28s vs estimated ~70 min current CI
1 parent 1f4d5ff commit 24bc35f

File tree

5 files changed

+137
-84
lines changed

5 files changed

+137
-84
lines changed

.github/workflows/linux-build-base.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
needs: get-changes
8181
# prevent errors when forks ff their main branch
8282
if: ${{ github.repository == 'facebookincubator/velox' }}
83-
runs-on: 8-core-ubuntu-22.04
83+
runs-on: 32-core-ubuntu
8484
container: ghcr.io/facebookincubator/velox-dev:adapters
8585
defaults:
8686
run:
@@ -138,7 +138,7 @@ jobs:
138138
139139
- name: Make Release Build
140140
env:
141-
MAKEFLAGS: NUM_THREADS=8 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=4
141+
MAKEFLAGS: NUM_THREADS=32 MAX_HIGH_MEM_JOBS=12 MAX_LINK_JOBS=12
142142
CUDA_ARCHITECTURES: 70
143143
CUDA_COMPILER: /usr/local/cuda-${CUDA_VERSION}/bin/nvcc
144144
# Set compiler to GCC 14
@@ -156,6 +156,7 @@ jobs:
156156
"-DVELOX_ENABLE_ABFS=ON"
157157
"-DVELOX_ENABLE_WAVE=ON"
158158
"-DVELOX_MONO_LIBRARY=ON"
159+
"-DVELOX_BUILD_SHARED=ON"
159160
)
160161
if [[ "${USE_CLANG}" = "true" ]]; then
161162
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";
@@ -195,7 +196,8 @@ jobs:
195196
wget https://repo1.maven.org/maven2/org/mockito/mockito-core/2.23.4/mockito-core-2.23.4.jar -O /usr/local/hadoop/share/hadoop/mapreduce/mockito-core-2.23.4.jar
196197
197198
export CLASSPATH=`/usr/local/hadoop/bin/hdfs classpath --glob`
198-
ctest -j 8 --label-exclude cuda_driver --output-on-failure --no-tests=error
199+
ulimit -n 65536
200+
ctest -j 24 --timeout 900 --label-exclude cuda_driver --output-on-failure --no-tests=error
199201
200202
# Clang-tidy needs a complete build because some files are only generated during the build
201203
# that clang tidy will not find and report errors otherwise.
@@ -222,7 +224,7 @@ jobs:
222224
python ./scripts/checks/run-clang-tidy.py -p $BUILD_PATH --commit $RANGE $FILES
223225
224226
ubuntu-debug:
225-
runs-on: 16-core-ubuntu
227+
runs-on: 32-core-ubuntu
226228
container: ghcr.io/facebookincubator/velox-dev:ubuntu-22.04
227229
# prevent errors when forks ff their main branch
228230
if: ${{ github.repository == 'facebookincubator/velox' }}
@@ -291,7 +293,8 @@ jobs:
291293
# version). Without this, BUNDLED gflags cascades to BUNDLED glog
292294
# which conflicts with system glog loaded transitively.
293295
glog_SOURCE: SYSTEM
294-
MAKEFLAGS: NUM_THREADS=16 MAX_HIGH_MEM_JOBS=4 MAX_LINK_JOBS=3
296+
VELOX_GFLAGS_URL: file:///velox/deps-sources/gflags-v2.2.2.tar.gz
297+
MAKEFLAGS: NUM_THREADS=32 MAX_HIGH_MEM_JOBS=12 MAX_LINK_JOBS=12
295298
run: |
296299
EXTRA_CMAKE_FLAGS=(
297300
"-DCMAKE_LINK_LIBRARIES_STRATEGY=REORDER_FREELY"
@@ -321,7 +324,8 @@ jobs:
321324

322325
- name: Run Tests
323326
run: |
324-
cd _build/debug && ctest -j 8 --output-on-failure --no-tests=error
327+
ulimit -n 65536
328+
cd _build/debug && ctest -j 24 --timeout 900 --output-on-failure --no-tests=error
325329
326330
fedora-debug:
327331
runs-on: 16-core-ubuntu

velox/common/caching/tests/CMakeLists.txt

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,38 @@ target_link_libraries(
1919
PRIVATE velox_common_base Folly::folly velox_time glog::glog GTest::gtest GTest::gtest_main
2020
)
2121

22-
add_executable(
23-
velox_cache_test
22+
# Split velox_cache_test into individual test binaries for parallel execution.
23+
set(
24+
VELOX_CACHE_TEST_SOURCES
2425
AsyncDataCacheTest.cpp
2526
CacheTTLControllerTest.cpp
2627
SsdFileTest.cpp
2728
SsdFileTrackerTest.cpp
2829
StringIdMapTest.cpp
2930
)
30-
add_test(velox_cache_test velox_cache_test)
31-
target_link_libraries(
32-
velox_cache_test
33-
PRIVATE
34-
velox_caching
35-
velox_file
36-
velox_file_test_utils
37-
velox_memory
38-
velox_test_util
39-
velox_flag_definitions
40-
Folly::folly
41-
glog::glog
42-
GTest::gtest
43-
GTest::gtest_main
31+
32+
set(
33+
VELOX_CACHE_TEST_DEPS
34+
velox_caching
35+
velox_file
36+
velox_file_test_utils
37+
velox_memory
38+
velox_test_util
39+
velox_flag_definitions
40+
Folly::folly
41+
glog::glog
42+
GTest::gtest
43+
GTest::gtest_main
4444
)
4545

46+
foreach(TEST_SOURCE IN LISTS VELOX_CACHE_TEST_SOURCES)
47+
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
48+
set(TEST_TARGET "velox_cache_${TEST_NAME}")
49+
add_executable(${TEST_TARGET} ${TEST_SOURCE})
50+
add_test(${TEST_TARGET} ${TEST_TARGET})
51+
target_link_libraries(${TEST_TARGET} PRIVATE ${VELOX_CACHE_TEST_DEPS})
52+
endforeach()
53+
4654
add_executable(cached_factory_test CachedFactoryTest.cpp)
4755
add_test(cached_factory_test cached_factory_test)
4856
target_link_libraries(

velox/exec/tests/CMakeLists.txt

Lines changed: 63 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ target_link_libraries(
3636
GTest::gtest_main
3737
)
3838

39-
add_executable(
40-
velox_exec_test
39+
# Split velox_exec_test into individual test binaries for parallel execution.
40+
set(
41+
VELOX_EXEC_TEST_SOURCES
4142
AddressableNonNullValueListTest.cpp
4243
AggregationTest.cpp
4344
AggregateFunctionRegistryTest.cpp
@@ -62,7 +63,6 @@ add_executable(
6263
IndexLookupJoinTest.cpp
6364
LimitTest.cpp
6465
LocalPartitionTest.cpp
65-
Main.cpp
6666
MarkDistinctTest.cpp
6767
EnforceDistinctTest.cpp
6868
MemoryReclaimerTest.cpp
@@ -117,39 +117,8 @@ add_executable(
117117
WriterFuzzerUtilTest.cpp
118118
)
119119

120-
if(VELOX_ENABLE_GEO)
121-
target_sources(velox_exec_test PRIVATE SpatialJoinTest.cpp)
122-
endif()
123-
124-
add_executable(
125-
velox_exec_infra_test
126-
AssertQueryBuilderTest.cpp
127-
DriverTest.cpp
128-
FunctionSignatureBuilderTest.cpp
129-
GroupedExecutionTest.cpp
130-
Main.cpp
131-
OperatorUtilsTest.cpp
132-
PlanBuilderTest.cpp
133-
PrestoQueryRunnerTest.cpp
134-
QueryAssertionsTest.cpp
135-
TaskTest.cpp
136-
TreeOfLosersTest.cpp
137-
)
138-
139-
add_test(NAME velox_exec_test COMMAND velox_exec_test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
140-
141-
# TODO: Revert back to 3000 once is fixed.
142-
# https://github.com/facebookincubator/velox/issues/13879
143-
set_tests_properties(velox_exec_test PROPERTIES TIMEOUT 6000)
144-
145-
add_test(
146-
NAME velox_exec_infra_test
147-
COMMAND velox_exec_infra_test
148-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
149-
)
150-
151-
target_link_libraries(
152-
velox_exec_test
120+
set(
121+
VELOX_EXEC_TEST_DEPS
153122
velox_aggregates
154123
velox_dwio_common
155124
velox_dwio_common_exception
@@ -191,6 +160,45 @@ target_link_libraries(
191160
fmt::fmt
192161
)
193162

163+
foreach(TEST_SOURCE IN LISTS VELOX_EXEC_TEST_SOURCES)
164+
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
165+
set(TEST_TARGET "velox_exec_${TEST_NAME}")
166+
add_executable(${TEST_TARGET} ${TEST_SOURCE} Main.cpp)
167+
add_test(NAME ${TEST_TARGET} COMMAND ${TEST_TARGET} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
168+
target_link_libraries(${TEST_TARGET} ${VELOX_EXEC_TEST_DEPS})
169+
endforeach()
170+
171+
if(VELOX_ENABLE_GEO)
172+
add_executable(velox_exec_SpatialJoinTest SpatialJoinTest.cpp Main.cpp)
173+
add_test(
174+
NAME velox_exec_SpatialJoinTest
175+
COMMAND velox_exec_SpatialJoinTest
176+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
177+
)
178+
target_link_libraries(velox_exec_SpatialJoinTest ${VELOX_EXEC_TEST_DEPS})
179+
endif()
180+
181+
add_executable(
182+
velox_exec_infra_test
183+
AssertQueryBuilderTest.cpp
184+
DriverTest.cpp
185+
FunctionSignatureBuilderTest.cpp
186+
GroupedExecutionTest.cpp
187+
Main.cpp
188+
OperatorUtilsTest.cpp
189+
PlanBuilderTest.cpp
190+
PrestoQueryRunnerTest.cpp
191+
QueryAssertionsTest.cpp
192+
TaskTest.cpp
193+
TreeOfLosersTest.cpp
194+
)
195+
196+
add_test(
197+
NAME velox_exec_infra_test
198+
COMMAND velox_exec_infra_test
199+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
200+
)
201+
194202
target_link_libraries(
195203
velox_exec_infra_test
196204
velox_dwio_common
@@ -228,11 +236,11 @@ target_link_libraries(
228236
fmt::fmt
229237
)
230238

231-
add_executable(
232-
velox_exec_util_test
233-
Main.cpp
239+
# Split velox_exec_util_test into individual test binaries for parallel execution.
240+
# Each test depends on the shared base class PrestoQueryRunnerIntermediateTypeTransformTestBase.cpp.
241+
set(
242+
VELOX_EXEC_UTIL_TEST_SOURCES
234243
PrestoQueryRunnerHyperLogLogTransformTest.cpp
235-
PrestoQueryRunnerIntermediateTypeTransformTestBase.cpp
236244
PrestoQueryRunnerTDigestTransformTest.cpp
237245
PrestoQueryRunnerQDigestTransformTest.cpp
238246
PrestoQueryRunnerKHyperLogLogTransformTest.cpp
@@ -243,10 +251,8 @@ add_executable(
243251
PrestoQueryRunnerTimestampWithTimeZoneTransformTest.cpp
244252
)
245253

246-
add_test(velox_exec_util_test velox_exec_util_test)
247-
248-
target_link_libraries(
249-
velox_exec_util_test
254+
set(
255+
VELOX_EXEC_UTIL_TEST_DEPS
250256
velox_fuzzer_util
251257
velox_exec_test_lib
252258
velox_functions_test_lib
@@ -256,6 +262,19 @@ target_link_libraries(
256262
GTest::gtest_main
257263
)
258264

265+
foreach(TEST_SOURCE IN LISTS VELOX_EXEC_UTIL_TEST_SOURCES)
266+
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
267+
set(TEST_TARGET "velox_exec_${TEST_NAME}")
268+
add_executable(
269+
${TEST_TARGET}
270+
${TEST_SOURCE}
271+
PrestoQueryRunnerIntermediateTypeTransformTestBase.cpp
272+
Main.cpp
273+
)
274+
add_test(NAME ${TEST_TARGET} COMMAND ${TEST_TARGET})
275+
target_link_libraries(${TEST_TARGET} ${VELOX_EXEC_UTIL_TEST_DEPS})
276+
endforeach()
277+
259278
add_executable(velox_in_10_min_demo VeloxIn10MinDemo.cpp)
260279

261280
target_link_libraries(

velox/functions/prestosql/aggregates/tests/CMakeLists.txt

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
add_executable(
16-
velox_aggregates_test
15+
# Split velox_aggregates_test into individual test binaries for parallel execution.
16+
set(
17+
VELOX_AGGREGATES_TEST_SOURCES
1718
AggregationFunctionRegTest.cpp
1819
ApproxDistinctTest.cpp
1920
ApproxMostFrequentTest.cpp
@@ -34,7 +35,6 @@ add_executable(
3435
GeometricMeanTest.cpp
3536
HistogramTest.cpp
3637
KHyperLogLogAggregateTest.cpp
37-
Main.cpp
3838
MapAccumulatorTest.cpp
3939
MapAggTest.cpp
4040
MapUnionAggregationTest.cpp
@@ -60,15 +60,8 @@ add_executable(
6060
VarianceAggregationTest.cpp
6161
)
6262

63-
if(${VELOX_ENABLE_GEO})
64-
target_sources(velox_aggregates_test PRIVATE GeometryAggregateTest.cpp)
65-
target_link_libraries(velox_aggregates_test velox_functions_geo)
66-
endif()
67-
68-
add_test(NAME velox_aggregates_test COMMAND velox_aggregates_test WORKING_DIRECTORY .)
69-
70-
target_link_libraries(
71-
velox_aggregates_test
63+
set(
64+
VELOX_AGGREGATES_TEST_DEPS
7265
velox_aggregates
7366
velox_core
7467
velox_dwio_common_test_utils
@@ -90,3 +83,25 @@ target_link_libraries(
9083
GTest::gtest
9184
GTest::gtest_main
9285
)
86+
87+
foreach(TEST_SOURCE IN LISTS VELOX_AGGREGATES_TEST_SOURCES)
88+
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
89+
set(TEST_TARGET "velox_aggregates_${TEST_NAME}")
90+
add_executable(${TEST_TARGET} ${TEST_SOURCE} Main.cpp)
91+
add_test(NAME ${TEST_TARGET} COMMAND ${TEST_TARGET} WORKING_DIRECTORY .)
92+
target_link_libraries(${TEST_TARGET} ${VELOX_AGGREGATES_TEST_DEPS})
93+
endforeach()
94+
95+
if(${VELOX_ENABLE_GEO})
96+
add_executable(velox_aggregates_GeometryAggregateTest GeometryAggregateTest.cpp Main.cpp)
97+
add_test(
98+
NAME velox_aggregates_GeometryAggregateTest
99+
COMMAND velox_aggregates_GeometryAggregateTest
100+
WORKING_DIRECTORY .
101+
)
102+
target_link_libraries(
103+
velox_aggregates_GeometryAggregateTest
104+
${VELOX_AGGREGATES_TEST_DEPS}
105+
velox_functions_geo
106+
)
107+
endif()

velox/serializers/tests/CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,18 @@ target_link_libraries(
3232
GTest::gmock
3333
)
3434

35-
add_executable(
36-
velox_serializer_test
35+
# Split velox_serializer_test into individual test binaries for parallel execution.
36+
set(
37+
VELOX_SERIALIZER_TEST_SOURCES
3738
CompactRowSerializerTest.cpp
3839
PrestoOutputStreamListenerTest.cpp
3940
PrestoSerializerTest.cpp
4041
SerializedPageFileTest.cpp
4142
UnsafeRowSerializerTest.cpp
4243
)
4344

44-
add_test(velox_serializer_test velox_serializer_test)
45-
46-
target_link_libraries(
47-
velox_serializer_test
45+
set(
46+
VELOX_SERIALIZER_TEST_DEPS
4847
velox_expression_test_utility
4948
velox_presto_serializer
5049
velox_vector_test_lib
@@ -55,6 +54,14 @@ target_link_libraries(
5554
glog::glog
5655
)
5756

57+
foreach(TEST_SOURCE IN LISTS VELOX_SERIALIZER_TEST_SOURCES)
58+
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
59+
set(TEST_TARGET "velox_serializer_${TEST_NAME}")
60+
add_executable(${TEST_TARGET} ${TEST_SOURCE})
61+
add_test(${TEST_TARGET} ${TEST_TARGET})
62+
target_link_libraries(${TEST_TARGET} ${VELOX_SERIALIZER_TEST_DEPS})
63+
endforeach()
64+
5865
if(VELOX_ENABLE_BENCHMARKS)
5966
add_executable(velox_serializer_benchmark SerializerBenchmark.cpp)
6067

0 commit comments

Comments
 (0)