Skip to content

Commit 3f9234c

Browse files
authored
Split run.sh into separate MPI and threads scripts (learning-process#134)
1 parent 5eb65d5 commit 3f9234c

File tree

3 files changed

+49
-38
lines changed

3 files changed

+49
-38
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ jobs:
4444
env:
4545
CC: gcc-13
4646
CXX: g++-13
47-
- name: Run func tests
47+
- name: Run func tests (MPI)
48+
run: |
49+
source scripts/run_mpi.sh
50+
- name: Run func tests (threads)
4851
run: |
4952
export OMP_NUM_THREADS=4
50-
source scripts/run.sh
53+
source scripts/run_threads.sh
5154
ubuntu-clang-build:
5255
runs-on: ubuntu-latest
5356
steps:
@@ -85,10 +88,13 @@ jobs:
8588
env:
8689
CC: clang-18
8790
CXX: clang++-18
88-
- name: Run tests
91+
- name: Run tests (MPI)
92+
run: |
93+
source scripts/run_mpi.sh
94+
- name: Run tests (threads)
8995
run: |
9096
export OMP_NUM_THREADS=4
91-
source scripts/run.sh
97+
source scripts/run_threads.sh
9298
ubuntu-clang-sanitizer-build:
9399
runs-on: ubuntu-latest
94100
steps:
@@ -126,11 +132,15 @@ jobs:
126132
env:
127133
CC: clang-18
128134
CXX: clang++-18
129-
- name: Run tests
135+
- name: Run tests (MPI)
136+
run: |
137+
export ASAN_RUN=1
138+
source scripts/run_mpi.sh
139+
- name: Run tests (threads)
130140
run: |
131141
export OMP_NUM_THREADS=4
132142
export ASAN_RUN=1
133-
source scripts/run.sh
143+
source scripts/run_threads.sh
134144
macos-clang-build:
135145
runs-on: macOS-latest
136146
steps:
@@ -160,10 +170,13 @@ jobs:
160170
- name: Ninja build
161171
run: |
162172
cmake --build build
163-
- name: Run tests
173+
- name: Run tests (MPI)
174+
run: |
175+
source scripts/run_mpi.sh
176+
- name: Run tests (threads)
164177
run: |
165178
export OMP_NUM_THREADS=4
166-
source scripts/run.sh
179+
source scripts/run_threads.sh
167180
windows-msvc-build:
168181
runs-on: windows-latest
169182
defaults:
@@ -261,10 +274,13 @@ jobs:
261274
- name: Ninja build
262275
run: |
263276
cmake --build build --parallel
264-
- name: Run tests
277+
- name: Run tests (MPI)
278+
run: |
279+
source scripts/run_mpi.sh
280+
- name: Run tests (threads)
265281
run: |
266282
export OMP_NUM_THREADS=4
267-
source scripts/run.sh
283+
source scripts/run_threads.sh
268284
- name: Generate gcovr Coverage Data
269285
run: |
270286
cd build

scripts/run_mpi.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then
4+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests
5+
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests
6+
7+
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/mpi_func_tests
8+
fi
9+
10+
./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
11+
./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
12+
13+
if [[ -z "$ASAN_RUN" ]]; then
14+
if [[ $OSTYPE == "linux-gnu" ]]; then
15+
mpirun --oversubscribe -np 4 ./build/bin/sample_mpi
16+
mpirun --oversubscribe -np 4 ./build/bin/sample_mpi_boost
17+
mpirun --oversubscribe -np 4 ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
18+
elif [[ $OSTYPE == "darwin"* ]]; then
19+
mpirun -np 2 ./build/bin/sample_mpi
20+
mpirun -np 2 ./build/bin/sample_mpi_boost
21+
mpirun -np 2 ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
22+
fi
23+
fi

scripts/run.sh renamed to scripts/run_threads.sh

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ if [[ $OSTYPE == "linux-gnu" && -z "$ASAN_RUN" ]]; then
44
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/core_func_tests
55
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/ref_func_tests
66

7-
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/mpi_func_tests
87
# valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/omp_func_tests
98
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/seq_func_tests
109
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./build/bin/stl_func_tests
@@ -14,37 +13,10 @@ fi
1413
./build/bin/core_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1514
./build/bin/ref_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
1615

17-
if [[ -z "$ASAN_RUN" ]]; then
18-
if [[ $OSTYPE == "linux-gnu" ]]; then
19-
mpirun --oversubscribe -np 4 ./build/bin/sample_mpi
20-
mpirun --oversubscribe -np 4 ./build/bin/sample_mpi_boost
21-
elif [[ $OSTYPE == "darwin"* ]]; then
22-
mpirun -np 2 ./build/bin/sample_mpi
23-
mpirun -np 2 ./build/bin/sample_mpi_boost
24-
fi
25-
fi
2616
./build/bin/sample_omp
2717
./build/bin/sample_stl
2818
./build/bin/sample_tbb
2919

30-
#if [[ $OSTYPE == "linux-gnu" ]]; then
31-
# NUM_PROC=$(cat /proc/cpuinfo|grep processor|wc -l)
32-
#elif [[ $OSTYPE == "darwin"* ]]; then
33-
# NUM_PROC=$(sysctl -a | grep machdep.cpu | grep thread_count | cut -d ' ' -f 2)
34-
#else
35-
# echo "Unknown OS"
36-
# NUM_PROC="1"
37-
#fi
38-
#echo "NUM_PROC: " $NUM_PROC
39-
40-
if [[ -z "$ASAN_RUN" ]]; then
41-
if [[ $OSTYPE == "linux-gnu" ]]; then
42-
mpirun --oversubscribe -np 4 ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
43-
elif [[ $OSTYPE == "darwin"* ]]; then
44-
mpirun -np 2 ./build/bin/mpi_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
45-
fi
46-
fi
47-
4820
./build/bin/omp_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
4921
./build/bin/seq_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating
5022
./build/bin/stl_func_tests --gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating

0 commit comments

Comments
 (0)