Skip to content

Commit 777fd86

Browse files
committed
Implement PoC of build step cache for Ubuntu gcc
1 parent b57c5ac commit 777fd86

File tree

6 files changed

+96
-45
lines changed

6 files changed

+96
-45
lines changed

.github/workflows/main.yml

Lines changed: 60 additions & 25 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,39 @@ 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: Upload installed package
83+
uses: actions/[email protected]
84+
with:
85+
name: ubuntu-gcc-install
86+
path: install
87+
ubuntu-gcc-test:
88+
needs:
89+
- ubuntu-gcc-build
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
with:
94+
submodules: recursive
95+
- name: Setup environment
96+
run: |
97+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
98+
sudo apt-get update
99+
sudo apt-get install gcc-14 g++-14
100+
sudo apt-get install ninja-build
101+
sudo apt-get install mpich
102+
sudo apt-get install libomp-dev
103+
sudo apt-get install valgrind
104+
python3 -m pip install -r requirements.txt
105+
- name: Download installed package
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: ubuntu-gcc-install
109+
path: install
110+
- name: Add install/bin to PATH
111+
run: echo "$(pwd)/install/bin" >> $GITHUB_PATH
79112
- name: Run func tests (MPI, num_proc=1)
80113
run: |
81114
source scripts/run_mpi.sh
@@ -116,9 +149,9 @@ jobs:
116149
run: source scripts/run_threads.sh
117150
env:
118151
OMP_NUM_THREADS: 4
119-
ubuntu-gcc-build-extended:
152+
ubuntu-gcc-test-extended:
120153
needs:
121-
- ubuntu-gcc-build
154+
- ubuntu-gcc-test
122155
runs-on: ubuntu-latest
123156
steps:
124157
- uses: actions/checkout@v4
@@ -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/[email protected]
170+
171+
- name: Download installed package
172+
uses: actions/download-artifact@v4
139173
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
154-
run: |
155-
cmake --build build --parallel
156-
env:
157-
CC: gcc-14
158-
CXX: g++-14
174+
name: ubuntu-gcc-install
175+
path: install
176+
- name: Add install/bin to PATH
177+
run: echo "$(pwd)/install/bin" >> $GITHUB_PATH
159178
- name: Run func tests (threads, num_threads=5)
160179
run: source scripts/run_threads.sh
161180
env:
@@ -229,6 +248,8 @@ jobs:
229248
env:
230249
CC: clang-19
231250
CXX: clang++-19
251+
- name: Add build/bin to PATH
252+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
232253
- name: Run func tests (MPI, num_proc=1)
233254
run: |
234255
source scripts/run_mpi.sh
@@ -309,6 +330,8 @@ jobs:
309330
env:
310331
CC: clang-19
311332
CXX: clang++-19
333+
- name: Add build/bin to PATH
334+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
312335
- name: Run tests (threads, num_threads=5)
313336
run: source scripts/run_threads.sh
314337
env:
@@ -381,6 +404,8 @@ jobs:
381404
env:
382405
CC: clang-19
383406
CXX: clang++-19
407+
- name: Add build/bin to PATH
408+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
384409
- name: Run tests (MPI)
385410
run: |
386411
source scripts/run_mpi.sh "--oversubscribe"
@@ -458,6 +483,8 @@ jobs:
458483
env:
459484
CC: clang-19
460485
CXX: clang++-19
486+
- name: Add build/bin to PATH
487+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
461488
- name: Run tests (threads, num_threads=5)
462489
run: source scripts/run_threads.sh
463490
env:
@@ -531,6 +558,8 @@ jobs:
531558
- name: Build project
532559
run: |
533560
cmake --build build --parallel
561+
- name: Add build/bin to PATH
562+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
534563
- name: Run func tests (MPI, num_proc=1)
535564
run: |
536565
source scripts/run_mpi.sh
@@ -603,6 +632,8 @@ jobs:
603632
- name: Build project
604633
run: |
605634
cmake --build build --parallel
635+
- name: Add build/bin to PATH
636+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
606637
- name: Run tests (threads, num_threads=5)
607638
run: source scripts/run_threads.sh
608639
env:
@@ -899,7 +930,7 @@ jobs:
899930
CLANG_BUILD: 1
900931
ubuntu-gcc-build-codecov:
901932
needs:
902-
- ubuntu-gcc-build-extended
933+
- ubuntu-gcc-test-extended
903934
- ubuntu-clang-build-extended
904935
- macos-clang-build-extended
905936
runs-on: ubuntu-latest
@@ -934,6 +965,8 @@ jobs:
934965
- name: Build project
935966
run: |
936967
cmake --build build --parallel
968+
- name: Add build/bin to PATH
969+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
937970
- name: Run tests (MPI)
938971
run: |
939972
source scripts/run_mpi.sh
@@ -1025,6 +1058,8 @@ jobs:
10251058
env:
10261059
CC: gcc-14
10271060
CXX: g++-14
1061+
- name: Add build/bin to PATH
1062+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
10281063
- name: Run perf count checker
10291064
run: |
10301065
source scripts/run_perf_count_checker.sh

.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

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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
33

44
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
5+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all core_func_tests
6+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ref_func_tests
77

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
8+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all all_func_tests
9+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all mpi_func_tests
1010
fi
1111

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
12+
core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
13+
ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1414

1515
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
16+
mpirun $1 -np $PROC_COUNT all_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
17+
mpirun $1 -np $PROC_COUNT mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1818
fi

scripts/run_threads.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
source build/ppc_opencv/install/bin/setup_vars_opencv4.sh
33

44
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
5+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all core_func_tests
6+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ref_func_tests
77

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
8+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all omp_func_tests
9+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all seq_func_tests
10+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all stl_func_tests
11+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all tbb_func_tests
1212
fi
1313

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
14+
core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
15+
ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
1616

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
17+
omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
18+
seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
19+
stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=3 --gtest_recreate_environments_when_repeating
20+
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)