Skip to content

Commit e0283fc

Browse files
authored
Prototype build step cache for Ubuntu gcc tests (#253)
1 parent 7872904 commit e0283fc

File tree

9 files changed

+108
-48
lines changed

9 files changed

+108
-48
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
6262
-G Ninja -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON
6363
-D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON
64-
-D CMAKE_BUILD_TYPE=RELEASE
64+
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=install
6565
env:
6666
CC: gcc-14
6767
CXX: g++-14
@@ -76,6 +76,41 @@ jobs:
7676
env:
7777
CC: gcc-14
7878
CXX: g++-14
79+
- name: Install project
80+
run: |
81+
cmake --build build --target install
82+
- name: Archive installed package
83+
run: |
84+
tar -czvf ubuntu-gcc-install.tar.gz -C install .
85+
- name: Upload installed package
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: ubuntu-gcc-install
89+
path: ubuntu-gcc-install.tar.gz
90+
ubuntu-gcc-test:
91+
needs:
92+
- ubuntu-gcc-build
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
- name: Setup environment
97+
run: |
98+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
99+
sudo apt-get update
100+
sudo apt-get install gcc-14 g++-14
101+
sudo apt-get install ninja-build
102+
sudo apt-get install mpich
103+
sudo apt-get install libomp-dev
104+
sudo apt-get install valgrind
105+
python3 -m pip install -r requirements.txt
106+
- name: Download installed package
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: ubuntu-gcc-install
110+
- name: Extract installed package
111+
run: |
112+
mkdir -p install
113+
tar -xzvf ubuntu-gcc-install.tar.gz -C install
79114
- name: Run func tests (MPI, num_proc=1)
80115
run: |
81116
source scripts/run_mpi.sh
@@ -116,14 +151,12 @@ jobs:
116151
run: source scripts/run_threads.sh
117152
env:
118153
OMP_NUM_THREADS: 4
119-
ubuntu-gcc-build-extended:
154+
ubuntu-gcc-test-extended:
120155
needs:
121-
- ubuntu-gcc-build
156+
- ubuntu-gcc-test
122157
runs-on: ubuntu-latest
123158
steps:
124159
- uses: actions/checkout@v4
125-
with:
126-
submodules: recursive
127160
- name: Setup environment
128161
run: |
129162
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
@@ -134,28 +167,14 @@ jobs:
134167
sudo apt-get install libomp-dev
135168
sudo apt-get install valgrind
136169
python3 -m pip install -r requirements.txt
137-
- name: ccache
138-
uses: hendrikmuhs/ccache-action@v1.2
170+
- name: Download installed package
171+
uses: actions/download-artifact@v4
139172
with:
140-
key: ${{ github.job }}
141-
create-symlink: true
142-
max-size: 1G
143-
- name: CMake configure
144-
run: >
145-
cmake -S . -B build
146-
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
147-
-G Ninja -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON
148-
-D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON
149-
-D CMAKE_BUILD_TYPE=RELEASE
150-
env:
151-
CC: gcc-14
152-
CXX: g++-14
153-
- name: Build project
173+
name: ubuntu-gcc-install
174+
- name: Extract installed package
154175
run: |
155-
cmake --build build --parallel
156-
env:
157-
CC: gcc-14
158-
CXX: g++-14
176+
mkdir -p install
177+
tar -xzvf ubuntu-gcc-install.tar.gz -C install
159178
- name: Run func tests (threads, num_threads=5)
160179
run: source scripts/run_threads.sh
161180
env:
@@ -899,7 +918,7 @@ jobs:
899918
CLANG_BUILD: 1
900919
ubuntu-gcc-build-codecov:
901920
needs:
902-
- ubuntu-gcc-build-extended
921+
- ubuntu-gcc-test-extended
903922
- ubuntu-clang-build-extended
904923
- macos-clang-build-extended
905924
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ sln/
1212
CMakeSettings.json
1313
.DS_Store
1414
.cache
15+
install

cmake/onetbb.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ if( USE_TBB )
2828
BUILD_COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/build" --config ${CMAKE_BUILD_TYPE} --parallel
2929
INSTALL_COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/build" --prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install")
3030
endif()
31+
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install/"
32+
DESTINATION "${CMAKE_INSTALL_PREFIX}")
3133
endif( USE_TBB )

cmake/opencv.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ else()
2828
BUILD_COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/build" --config ${CMAKE_BUILD_TYPE} --parallel
2929
INSTALL_COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/build" --prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/install")
3030
endif()
31+
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_opencv/install/"
32+
DESTINATION "${CMAKE_INSTALL_PREFIX}")

modules/core/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib})
3232

3333
enable_testing()
3434
add_test(NAME ${exec_func_tests} COMMAND ${exec_func_tests})
35+
36+
# Installation rules
37+
install(TARGETS ${exec_func_lib}
38+
ARCHIVE DESTINATION lib
39+
LIBRARY DESTINATION lib
40+
RUNTIME DESTINATION bin)
41+
42+
install(TARGETS ${exec_func_tests}
43+
RUNTIME DESTINATION bin)

modules/ref/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,12 @@ target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib})
4242

4343
enable_testing()
4444
add_test(NAME ${exec_func_tests} COMMAND ${exec_func_tests})
45+
46+
# Installation rules
47+
install(TARGETS ${exec_func_lib}
48+
ARCHIVE DESTINATION lib
49+
LIBRARY DESTINATION lib
50+
RUNTIME DESTINATION bin)
51+
52+
install(TARGETS ${exec_func_tests}
53+
RUNTIME DESTINATION bin)

scripts/run_mpi.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
#!/bin/bash
2-
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
2+
if [[ -f build/ppc_opencv/install/bin/setup_vars_opencv4.sh ]]; then
3+
INSTALL_BIN_DIR="build/bin"
4+
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
5+
else
6+
INSTALL_BIN_DIR="install/bin"
7+
source $INSTALL_BIN_DIR/setup_vars_opencv4.sh
8+
fi
39

410
if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then
5-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests
6-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests
11+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/core_func_tests
12+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/ref_func_tests
713

8-
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/all_func_tests
9-
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/mpi_func_tests
14+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/all_func_tests
15+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/mpi_func_tests
1016
fi
1117

12-
./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
13-
./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
18+
$INSTALL_BIN_DIR/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
19+
$INSTALL_BIN_DIR/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1420

1521
if [[ -z "$ASAN_RUN" ]]; then
16-
mpirun $1 -np $PROC_COUNT ./build/bin/all_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
17-
mpirun $1 -np $PROC_COUNT ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
22+
mpirun $1 -np $PROC_COUNT $INSTALL_BIN_DIR/all_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
23+
mpirun $1 -np $PROC_COUNT $INSTALL_BIN_DIR/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1824
fi

scripts/run_threads.sh

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
#!/bin/bash
2-
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
2+
if [[ -f build/ppc_opencv/install/bin/setup_vars_opencv4.sh ]]; then
3+
INSTALL_BIN_DIR="build/bin"
4+
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
5+
else
6+
INSTALL_BIN_DIR="install/bin"
7+
source $INSTALL_BIN_DIR/setup_vars_opencv4.sh
8+
fi
39

410
if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then
5-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests
6-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests
11+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/core_func_tests
12+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/ref_func_tests
713

8-
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/omp_func_tests
9-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/seq_func_tests
10-
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/stl_func_tests
11-
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/tbb_func_tests
14+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/omp_func_tests
15+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/seq_func_tests
16+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/stl_func_tests
17+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all $INSTALL_BIN_DIR/tbb_func_tests
1218
fi
1319

14-
./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
15-
./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
20+
$INSTALL_BIN_DIR/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
21+
$INSTALL_BIN_DIR/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
1622

17-
./build/bin/omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
18-
./build/bin/seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
19-
./build/bin/stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
20-
./build/bin/tbb_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
23+
$INSTALL_BIN_DIR/omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
24+
$INSTALL_BIN_DIR/seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
25+
$INSTALL_BIN_DIR/stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
26+
$INSTALL_BIN_DIR/tbb_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating

tasks/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,14 @@ foreach(TASK_TYPE ${LIST_OF_TASKS})
169169
target_link_libraries(${EXEC_FUNC} PUBLIC gtest gtest_main)
170170
enable_testing()
171171
add_test(NAME ${EXEC_FUNC} COMMAND ${EXEC_FUNC})
172+
173+
# Install the executable
174+
install(TARGETS ${EXEC_FUNC} RUNTIME DESTINATION bin)
172175
endforeach ()
173176

177+
# Install the library
178+
install(TARGETS ${exec_func_lib} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
179+
174180
set(LIST_OF_EXEC_TESTS "")
175181
set(LIB_SOURCE_FILES "")
176182
set(SRC_RES "")

0 commit comments

Comments
 (0)