Skip to content

Commit ff1c65e

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

File tree

6 files changed

+93
-45
lines changed

6 files changed

+93
-45
lines changed

.github/workflows/main.yml

Lines changed: 57 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,36 @@ jobs:
7676
env:
7777
CC: gcc-14
7878
CXX: g++-14
79+
- name: Upload installed package
80+
uses: actions/upload-artifact@v4.3.0
81+
with:
82+
name: ubuntu-gcc-install
83+
path: install
84+
ubuntu-gcc-test:
85+
needs:
86+
- ubuntu-gcc-build
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
with:
91+
submodules: recursive
92+
- name: Setup environment
93+
run: |
94+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
95+
sudo apt-get update
96+
sudo apt-get install gcc-14 g++-14
97+
sudo apt-get install ninja-build
98+
sudo apt-get install mpich
99+
sudo apt-get install libomp-dev
100+
sudo apt-get install valgrind
101+
python3 -m pip install -r requirements.txt
102+
- name: Download installed package
103+
uses: actions/download-artifact@v3
104+
with:
105+
name: ubuntu-gcc-install
106+
path: install
107+
- name: Add install/bin to PATH
108+
run: echo "$(pwd)/install/bin" >> $GITHUB_PATH
79109
- name: Run func tests (MPI, num_proc=1)
80110
run: |
81111
source scripts/run_mpi.sh
@@ -116,9 +146,9 @@ jobs:
116146
run: source scripts/run_threads.sh
117147
env:
118148
OMP_NUM_THREADS: 4
119-
ubuntu-gcc-build-extended:
149+
ubuntu-gcc-test-extended:
120150
needs:
121-
- ubuntu-gcc-build
151+
- ubuntu-gcc-test
122152
runs-on: ubuntu-latest
123153
steps:
124154
- uses: actions/checkout@v4
@@ -134,28 +164,14 @@ jobs:
134164
sudo apt-get install libomp-dev
135165
sudo apt-get install valgrind
136166
python3 -m pip install -r requirements.txt
137-
- name: ccache
138-
uses: hendrikmuhs/ccache-action@v1.2
167+
168+
- name: Download installed package
169+
uses: actions/download-artifact@v3
139170
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
171+
name: ubuntu-gcc-install
172+
path: install
173+
- name: Add install/bin to PATH
174+
run: echo "$(pwd)/install/bin" >> $GITHUB_PATH
159175
- name: Run func tests (threads, num_threads=5)
160176
run: source scripts/run_threads.sh
161177
env:
@@ -229,6 +245,8 @@ jobs:
229245
env:
230246
CC: clang-19
231247
CXX: clang++-19
248+
- name: Add build/bin to PATH
249+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
232250
- name: Run func tests (MPI, num_proc=1)
233251
run: |
234252
source scripts/run_mpi.sh
@@ -309,6 +327,8 @@ jobs:
309327
env:
310328
CC: clang-19
311329
CXX: clang++-19
330+
- name: Add build/bin to PATH
331+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
312332
- name: Run tests (threads, num_threads=5)
313333
run: source scripts/run_threads.sh
314334
env:
@@ -381,6 +401,8 @@ jobs:
381401
env:
382402
CC: clang-19
383403
CXX: clang++-19
404+
- name: Add build/bin to PATH
405+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
384406
- name: Run tests (MPI)
385407
run: |
386408
source scripts/run_mpi.sh "--oversubscribe"
@@ -458,6 +480,8 @@ jobs:
458480
env:
459481
CC: clang-19
460482
CXX: clang++-19
483+
- name: Add build/bin to PATH
484+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
461485
- name: Run tests (threads, num_threads=5)
462486
run: source scripts/run_threads.sh
463487
env:
@@ -531,6 +555,8 @@ jobs:
531555
- name: Build project
532556
run: |
533557
cmake --build build --parallel
558+
- name: Add build/bin to PATH
559+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
534560
- name: Run func tests (MPI, num_proc=1)
535561
run: |
536562
source scripts/run_mpi.sh
@@ -603,6 +629,8 @@ jobs:
603629
- name: Build project
604630
run: |
605631
cmake --build build --parallel
632+
- name: Add build/bin to PATH
633+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
606634
- name: Run tests (threads, num_threads=5)
607635
run: source scripts/run_threads.sh
608636
env:
@@ -899,7 +927,7 @@ jobs:
899927
CLANG_BUILD: 1
900928
ubuntu-gcc-build-codecov:
901929
needs:
902-
- ubuntu-gcc-build-extended
930+
- ubuntu-gcc-test-extended
903931
- ubuntu-clang-build-extended
904932
- macos-clang-build-extended
905933
runs-on: ubuntu-latest
@@ -934,6 +962,8 @@ jobs:
934962
- name: Build project
935963
run: |
936964
cmake --build build --parallel
965+
- name: Add build/bin to PATH
966+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
937967
- name: Run tests (MPI)
938968
run: |
939969
source scripts/run_mpi.sh
@@ -1025,6 +1055,8 @@ jobs:
10251055
env:
10261056
CC: gcc-14
10271057
CXX: g++-14
1058+
- name: Add build/bin to PATH
1059+
run: echo "$(pwd)/build/bin" >> $GITHUB_PATH
10281060
- name: Run perf count checker
10291061
run: |
10301062
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)