Skip to content

Commit cb10fb7

Browse files
authored
Merge pull request #210 from Sichao25/yus/ci
Switch from MPICH to OpenMPI in CI
2 parents 0711fbf + 861a29e commit cb10fb7

File tree

4 files changed

+250
-83
lines changed

4 files changed

+250
-83
lines changed

.github/workflows/clang-tidy.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Now it is separated to avoid affecting MPICH is not compatible with Ubuntu-latest and bear is not compatible with OPENMPI. This workflow should be merged after either compatibility issue is resolved.
2+
name: Clang-Tidy Check
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
13+
jobs:
14+
clang-tidy-check:
15+
runs-on: ubuntu-latest
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
strategy:
22+
matrix:
23+
build_type: [Release]
24+
memory_test: [ON, OFF]
25+
compiler: [g++]
26+
language: ['cpp']
27+
exclude:
28+
- build_type: Release
29+
memory_test: ON
30+
- build_type: RelWithDebInfo
31+
memory_test: OFF
32+
33+
steps:
34+
35+
- name: Update packages
36+
run: sudo apt-get update
37+
38+
- name: Install mpich
39+
run: sudo apt-get install -yq libmpich-dev mpich
40+
41+
- name: Install cmake
42+
run: sudo apt-get install -yq cmake
43+
44+
- uses: actions/checkout@v4
45+
46+
- name: build Catch2
47+
uses: ./.github/actions/install-repo
48+
with:
49+
repo-name: 'Catch2-openmpi'
50+
repo-path: 'catchorg/Catch2'
51+
repo-ref: ''
52+
cache: true
53+
54+
- name: build kokkos
55+
uses: ./.github/actions/install-repo
56+
with:
57+
repo-name: 'kokkos-openmpi'
58+
repo-path: 'kokkos/kokkos'
59+
repo-ref: '4.6.01'
60+
cache: true
61+
options: '-DCMAKE_CXX_STANDARD=17
62+
-DBUILD_SHARED_LIBS=OFF
63+
-DKokkos_ENABLE_SERIAL=ON
64+
-DKokkos_ENABLE_OPENMP=OFF
65+
-DKokkos_ENABLE_CUDA=OFF
66+
-DKokkos_ENABLE_CUDA_LAMBDA=OFF
67+
-DKokkos_ENABLE_CUDA_CONSTEXPR=OFF'
68+
69+
- name: build kokkos-kernels
70+
uses: ./.github/actions/install-repo
71+
with:
72+
repo-name: 'kokkos-kernels-openmpi'
73+
repo-path: 'kokkos/kokkos-kernels'
74+
repo-ref: '4.6.01'
75+
cache: true
76+
options: '-DCMAKE_CXX_STANDARD=17
77+
-DBUILD_SHARED_LIBS=OFF
78+
-DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
79+
80+
- name: build omega_h
81+
uses: ./.github/actions/install-repo
82+
with:
83+
repo-name: 'omega_h-openmpi'
84+
repo-path: 'SCOREC/omega_h'
85+
repo-ref: ''
86+
cache: true
87+
options: '-DCMAKE_CXX_COMPILER=`which mpicxx`
88+
-DCMAKE_C_COMPILER=`which mpicc`
89+
-DBUILD_SHARED_LIBS=OFF
90+
-DOmega_h_USE_MPI=ON
91+
-DOmega_h_USE_Kokkos=ON
92+
-DBUILD_TESTING=OFF
93+
-DMPIEXEC_EXECUTABLE=`which mpirun`
94+
-DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
95+
96+
- name: build meshFields
97+
uses: ./.github/actions/install-repo
98+
with:
99+
repo-name: 'meshFields-openmpi'
100+
repo-path: 'SCOREC/meshFields'
101+
repo-ref: ''
102+
cache: true
103+
options: '-DCMAKE_CXX_COMPILER=`which mpicxx`
104+
-DCMAKE_C_COMPILER=`which mpicc`
105+
-DMPIEXEC_EXECUTABLE=`which mpirun`
106+
-DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos
107+
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h-openmpi/install/lib/cmake/Omega_h'
108+
109+
- name: build perfstubs
110+
uses: ./.github/actions/install-repo
111+
with:
112+
repo-name: 'perfstubs-openmpi'
113+
repo-path: 'UO-OACISS/perfstubs'
114+
repo-ref: ''
115+
cache: true
116+
options: '-DCMAKE_CXX_COMPILER=mpicxx'
117+
118+
- name: build kokkos-fortran-interop
119+
uses: ./.github/actions/install-repo
120+
with:
121+
repo-name: 'kokkos-fortran-interop-openmpi'
122+
repo-path: 'kokkos/kokkos-fortran-interop'
123+
repo-ref: ''
124+
cache: true
125+
options: '-DCMAKE_BUILD_TYPE=Release
126+
-DCMAKE_CXX_COMPILER=`which mpicxx`
127+
-DCMAKE_C_COMPILER=`which mpicc`
128+
-DCMAKE_Fortran_COMPILER=`which mpifort`
129+
-DBUILD_TESTING=OFF
130+
-DFLCL_BUILD_TESTS=OFF
131+
-DFLCL_BUILD_EXAMPLE=OFF
132+
-DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
133+
134+
- name: build ADIOS2
135+
uses: ./.github/actions/install-repo
136+
with:
137+
repo-name: 'ADIOS2-openmpi'
138+
repo-path: 'ornladios/ADIOS2'
139+
repo-ref: ''
140+
cache: true
141+
options: '-DADIOS2_USE_CUDA=OFF'
142+
143+
- name: build redev
144+
uses: ./.github/actions/install-repo
145+
with:
146+
repo-name: 'redev-openmpi'
147+
repo-path: 'SCOREC/redev'
148+
repo-ref: ''
149+
cache: true
150+
options: '-DCMAKE_CXX_COMPILER=`which mpicxx`
151+
-DMPIEXEC_EXECUTABLE=`which mpirun`
152+
-DCMAKE_BUILD_TYPE=Release
153+
-DBUILD_SHARED_LIBS=OFF
154+
-DADIOS2_DIR=${{ runner.temp }}/build-ADIOS2-openmpi/install/lib/cmake/adios2
155+
-Dperfstubs_DIR=${{ runner.temp }}/build-perfstubs-openmpi/install/lib/cmake'
156+
157+
- name: checkout pcms_testcases
158+
uses: actions/checkout@v3
159+
with:
160+
repository: jacobmerson/pcms_testcases
161+
path: pcms_testcases
162+
163+
- name: Install fftw3
164+
run: sudo apt-get install -yq libfftw3-dev pkg-config
165+
166+
- name: Install Bear
167+
run: sudo apt-get install -yq bear
168+
169+
- name: configure pcms
170+
run : |
171+
mkdir ${{ runner.temp }}/build-pcms
172+
cmake -S . -B ${{ runner.temp }}/build-pcms -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
173+
-DCMAKE_C_COMPILER=mpicc \
174+
-DCMAKE_CXX_COMPILER=mpicxx \
175+
-DCMAKE_Fortran_COMPILER=mpifort \
176+
-DPCMS_TIMEOUT=10 \
177+
-DCatch2_DIR=${{ runner.temp }}/build-Catch2-openmpi/install/lib/cmake/Catch2 \
178+
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h-openmpi/install/lib/cmake/Omega_h \
179+
-Dmeshfields_DIR=${{ runner.temp }}/build-meshFields-openmpi/install/lib/cmake/meshfields \
180+
-Dredev_DIR=${{ runner.temp }}/build-redev-openmpi/install/lib/cmake/redev \
181+
-Dflcl_DIR=${{ runner.temp }}/build-kokkos-fortran-interop-openmpi/install/lib/cmake/flcl \
182+
-DMPIEXEC_EXECUTABLE=mpirun \
183+
-DADIOS2_DIR=${{ runner.temp }}/build-ADIOS2-openmpi/install/lib/cmake/adios2 \
184+
-Dperfstubs_DIR=${{ runner.temp }}/build-perfstubs-openmpi/install/lib/cmake \
185+
-DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos \
186+
-DKokkosKernels_DIR=${{ runner.temp }}/build-kokkos-kernels-openmpi/install/lib/cmake/KokkosKernels/ \
187+
-DPCMS_TEST_DATA_DIR=$PWD/pcms_testcases
188+
189+
- name: Configure pcms with Bear
190+
run: |
191+
cd ${{ runner.temp }}/build-pcms
192+
bear -- make
193+
194+
- name: Install clang-tidy
195+
run: |
196+
sudo apt-get update
197+
sudo apt-get install -yq clang-tidy-18
198+
199+
- name: Run clang-tidy
200+
run: |
201+
EXIT_CODE=0
202+
while read file; do
203+
if ! clang-tidy -p ${{ runner.temp }}/build-pcms "$file" --quiet; then
204+
echo "$file has clang-tidy issues"
205+
EXIT_CODE=1
206+
fi
207+
done < <(find src -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx" | grep -v 'src/pcms/capi/' | grep -v 'src/pcms/fortranapi/')
208+
if [ $EXIT_CODE -eq 1 ]; then
209+
echo "Some C/C++ files have clang-tidy issues. Please fix them with clang-tidy-18."
210+
exit 1
211+
fi
212+
echo "All C/C++ files pass clang-tidy checks"

.github/workflows/cmake-test.yml

Lines changed: 6 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
strategy:
2222
matrix:
2323
build_type: [Release]
24-
clang_tidy: [ON, OFF]
2524
memory_test: [ON, OFF]
2625
compiler: [g++]
2726
language: ['cpp']
@@ -36,8 +35,8 @@ jobs:
3635
- name: Update packages
3736
run: sudo apt-get update
3837

39-
- name: Install mpi
40-
run: sudo apt-get install -yq mpich
38+
- name: Install openmpi
39+
run: sudo apt-get install -yq libopenmpi-dev openmpi-bin
4140

4241
- name: Install cmake
4342
run: sudo apt-get install -yq cmake
@@ -165,7 +164,6 @@ jobs:
165164
run: sudo apt-get install -yq libfftw3-dev pkg-config
166165

167166
- name: build pcms
168-
if: matrix.clang_tidy == 'OFF'
169167
uses: ./.github/actions/install-repo
170168
with:
171169
repo-name: 'pcms'
@@ -176,7 +174,8 @@ jobs:
176174
-DCMAKE_C_COMPILER=`which mpicc`
177175
-DCMAKE_CXX_COMPILER=`which mpicxx`
178176
-DCMAKE_Fortran_COMPILER=`which mpifort`
179-
-DPCMS_TIMEOUT=5
177+
-DMPIEXEC_PREFLAGS="--oversubscribe"
178+
-DPCMS_TIMEOUT=10
180179
-DCatch2_DIR=${{ runner.temp }}/build-Catch2/install/lib/cmake/Catch2
181180
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h/install/lib/cmake/Omega_h
182181
-Dmeshfields_DIR=${{ runner.temp }}/build-meshFields/install/lib/cmake/meshfields
@@ -190,66 +189,10 @@ jobs:
190189
-DPCMS_TEST_DATA_DIR=$PWD/pcms_testcases'
191190

192191
# - name: Install Valgrind
193-
# if: matrix.clang_tidy == 'OFF'
194192
# run: sudo apt-get install -yq valgrind
195193

196-
# - name: Run CTest
197-
# if: matrix.clang_tidy == 'OFF'
198-
# run: ctest --test-dir ${{ runner.temp }}/build-pcms
194+
- name: Run CTest
195+
run: ctest --test-dir ${{ runner.temp }}/build-pcms
199196

200197
# - name: Print Test
201-
# if: matrix.clang_tidy == 'OFF'
202198
# run: cat ${{ runner.temp }}/build-pcms/Testing/Temporary/LastTest.log
203-
204-
- name: Install Bear
205-
if: matrix.clang_tidy == 'ON'
206-
run: sudo apt-get install -yq bear
207-
208-
- name: configure pcms
209-
if: matrix.clang_tidy == 'ON'
210-
run : |
211-
mkdir ${{ runner.temp }}/build-pcms
212-
cmake -S . -B ${{ runner.temp }}/build-pcms -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
213-
-DCMAKE_C_COMPILER=mpicc \
214-
-DCMAKE_CXX_COMPILER=mpicxx \
215-
-DCMAKE_Fortran_COMPILER=mpifort \
216-
-DPCMS_TIMEOUT=5 \
217-
-DCatch2_DIR=${{ runner.temp }}/build-Catch2/install/lib/cmake/Catch2 \
218-
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h/install/lib/cmake/Omega_h \
219-
-Dmeshfields_DIR=${{ runner.temp }}/build-meshFields/install/lib/cmake/meshfields \
220-
-Dredev_DIR=${{ runner.temp }}/build-redev/install/lib/cmake/redev \
221-
-Dflcl_DIR=${{ runner.temp }}/build-kokkos-fortran-interop/install/lib/cmake/flcl \
222-
-DMPIEXEC_EXECUTABLE=mpirun \
223-
-DADIOS2_DIR=${{ runner.temp }}/build-ADIOS2/install/lib/cmake/adios2 \
224-
-Dperfstubs_DIR=${{ runner.temp }}/build-perfstubs/install/lib/cmake \
225-
-DKokkos_DIR=${{ runner.temp }}/build-kokkos/install/lib/cmake/Kokkos \
226-
-DKokkosKernels_DIR=${{ runner.temp }}/build-kokkos-kernels/install/lib/cmake/KokkosKernels/ \
227-
-DPCMS_TEST_DATA_DIR=$PWD/pcms_testcases
228-
229-
- name: Configure pcms with Bear
230-
if: matrix.clang_tidy == 'ON'
231-
run: |
232-
cd ${{ runner.temp }}/build-pcms
233-
bear -- make -j 4
234-
235-
- name: Install clang-tidy
236-
if: matrix.clang_tidy == 'ON'
237-
run: |
238-
sudo apt-get update
239-
sudo apt-get install -yq clang-tidy-18
240-
241-
- name: Run clang-tidy
242-
if: matrix.clang_tidy == 'ON'
243-
run: |
244-
EXIT_CODE=0
245-
while read file; do
246-
if ! clang-tidy -p ${{ runner.temp }}/build-pcms "$file" --quiet; then
247-
echo "$file has clang-tidy issues"
248-
EXIT_CODE=1
249-
fi
250-
done < <(find src -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx" | grep -v 'src/pcms/capi/' | grep -v 'src/pcms/fortranapi/')
251-
if [ $EXIT_CODE -eq 1 ]; then
252-
echo "Some C/C++ files have clang-tidy issues. Please fix them with clang-tidy-18."
253-
exit 1
254-
fi
255-
echo "All C/C++ files pass clang-tidy checks"

ctest/runMultipleMpiJobs.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ if [[ ($# == 0) || ("${1}" == "-h" || ${1} == "--help") ]]; then
55
exit 1
66
fi
77
runCmd=${1}
8-
numProcsFlag=${2}
9-
valgrindCmd=${3}
10-
valgrindOptions=${4}
8+
preFlags=${2}
9+
numProcsFlag=${3}
10+
valgrindCmd=${4}
11+
valgrindOptions=${5}
1112
valgrindLogging="--log-file=%p"
13+
if [[ ${preFlags} == "none" ]]; then
14+
preFlags=""
15+
fi
1216
#clear the valgrind args if they are 'none'
1317
if [[ ${valgrindCmd} == "none" ]]; then
1418
valgrindCmd=""
@@ -18,7 +22,7 @@ fi
1822
if [[ (${valgrindOptions} == "none" && ${valgrindCmd} != "none") ]]; then
1923
valgrindOptions=""
2024
fi
21-
shift 4
25+
shift 5
2226

2327

2428
declare -a PIDS
@@ -33,7 +37,7 @@ run() {
3337
if [[ -z ${valgrindLogging} ]]; then
3438
vgLog=""
3539
fi
36-
${runCmd} ${numProcsFlag} ${procs} ${valgrindCmd} ${vgLog} ${valgrindOptions} ${exe} ${argsArray[@]} &> ${name}.log &
40+
${runCmd} ${preFlags} ${numProcsFlag} ${procs} ${valgrindCmd} ${vgLog} ${valgrindOptions} ${exe} ${argsArray[@]} &> ${name}.log &
3741
PIDS+=($!)
3842
LOGS+=(${name}.log)
3943
}

0 commit comments

Comments
 (0)