Skip to content

Commit e5bc376

Browse files
authored
Merge pull request #13968 from JakeOShannessy/cmakev6
build: add cmake build for FDS
2 parents 76b73e6 + d99f087 commit e5bc376

File tree

2 files changed

+512
-0
lines changed

2 files changed

+512
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
name: cmake
2+
env:
3+
# update urls for oneapi packages according to
4+
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml
5+
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe
6+
WINDOWS_BASEKIT_COMPONENTS: intel.oneapi.win.mkl.devel
7+
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/f07e32fa-b505-4b90-8a79-e328ce9ad9d6/intel-oneapi-hpc-toolkit-2025.0.0.822_offline.exe
8+
WINDOWS_HPCKIT_COMPONENTS: intel.oneapi.win.ifort-compiler:intel.oneapi.win.mpi.devel
9+
10+
on:
11+
push:
12+
paths:
13+
- .github/**
14+
- Build/**
15+
- Source/**
16+
- CMakeLists.txt
17+
pull_request:
18+
paths:
19+
- .github/**
20+
- Build/**
21+
- Source/**
22+
- CMakeLists.txt
23+
24+
25+
concurrency:
26+
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
28+
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
cmake-linux:
35+
name: ${{ matrix.container }} ${{ matrix.compiler_mpi }} openmp=${{ matrix.openmp }} ${{ matrix.build_type }}
36+
runs-on: [ubuntu-latest]
37+
container: ${{ matrix.container }}
38+
strategy:
39+
matrix:
40+
container:
41+
# - "fedora:40"
42+
- "rockylinux:9"
43+
- "ubuntu:24.04"
44+
compiler_mpi:
45+
- "intel_intelmpi"
46+
# - "intel_openmpi"
47+
- "gnu_openmpi"
48+
openmp:
49+
- "ON"
50+
- "OFF"
51+
build_type:
52+
- "Debug"
53+
- "Release"
54+
defaults:
55+
run:
56+
shell: bash
57+
steps:
58+
- name: Install prerequisites (dnf)
59+
if: matrix.container != 'ubuntu:24.04'
60+
run: dnf install -y git gcc make cmake sudo environment-modules
61+
- name: Install prerequisites (apt)
62+
if: matrix.container == 'ubuntu:24.04'
63+
run: |
64+
apt-get -y update
65+
apt-get -y install -y git gcc make cmake sudo environment-modules
66+
67+
# # Setup OneAPI, icx is necessary for third-party libs
68+
# - uses: rscohn2/setup-oneapi@v0
69+
# if: endsWith(matrix.compiler_mpi, '_intelmpi') != true
70+
# with:
71+
# components: |
72+
# ifx
73+
# icx
74+
# mkl
75+
76+
# Setup OneAPI, icx is necessary for third-party libs
77+
- uses: rscohn2/setup-oneapi@v0
78+
# if: endsWith(matrix.compiler_mpi, '_intelmpi')
79+
with:
80+
components: |
81+
ifx
82+
icx
83+
impi
84+
mkl
85+
86+
- name: install openmpi
87+
if: endsWith(matrix.compiler_mpi, '_openmpi') && (startsWith(matrix.container, 'rockylinux') || startsWith(matrix.container, 'fedora'))
88+
run: dnf install -y openmpi-devel
89+
90+
- name: install openmpi
91+
if: endsWith(matrix.compiler_mpi, '_openmpi') && startsWith(matrix.container, 'ubuntu')
92+
run: |
93+
sudo apt-get -y update
94+
sudo apt-get -y install libopenmpi-dev openmpi-bin
95+
96+
- uses: actions/checkout@v4
97+
- run: git config --global --add safe.directory /__w/fds/fds
98+
99+
- name: set linux-gnu compiler
100+
if: startsWith(matrix.compiler_mpi, 'gnu_')
101+
shell: bash
102+
run: |
103+
echo "CC=gcc" >> $GITHUB_ENV
104+
echo "CXX=g++" >> $GITHUB_ENV
105+
echo "FC=gfortran" >> $GITHUB_ENV
106+
107+
- name: set linux-gnu compiler
108+
if: startsWith(matrix.compiler_mpi, 'intel_')
109+
shell: bash
110+
run: |
111+
echo "CC=mpiicx" >> $GITHUB_ENV
112+
echo "CXX=mpiicx" >> $GITHUB_ENV
113+
echo "FC=mpiifx" >> $GITHUB_ENV
114+
115+
- name: build fds
116+
if: endsWith(matrix.compiler_mpi, '_intelmpi')
117+
run: |
118+
source /opt/intel/oneapi/setvars.sh
119+
cmake -B builddir -S . -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DMKL_LINK=dynamic -DUSE_OPENMP=${{matrix.openmp}}
120+
cmake --build builddir -j --target fds
121+
122+
- name: build fds
123+
if: endsWith(matrix.compiler_mpi, '_openmpi')
124+
run: |
125+
# source /opt/intel/oneapi/setvars.sh
126+
if [ "${{matrix.container}}" = "rockylinux:9" ]; then
127+
source /etc/profile.d/modules.sh
128+
module load mpi/openmpi-x86_64
129+
fi
130+
cmake -B builddir -S . -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DMKL_LINK=dynamic -DUSE_OPENMP=${{matrix.openmp}}
131+
cmake --build builddir -j --target fds
132+
133+
- name: Test
134+
if: endsWith(matrix.compiler_mpi, '_intelmpi')
135+
run: |
136+
source /opt/intel/oneapi/setvars.sh
137+
ctest --test-dir builddir -j --output-on-failure -V
138+
139+
- name: Test
140+
if: endsWith(matrix.compiler_mpi, '_openmpi')
141+
run: |
142+
source /opt/intel/oneapi/setvars.sh
143+
if [ "${{matrix.container}}" = "rockylinux:9" ]; then
144+
source /etc/profile.d/modules.sh
145+
module load mpi/openmpi-x86_64
146+
fi
147+
ctest --test-dir builddir -j --output-on-failure -V
148+
149+
cmake-osx:
150+
# Set the name of this build, variable depending on the OS
151+
name: ${{ matrix.os }} ${{ matrix.compiler_mpi }} openmp=${{ matrix.openmp }} ${{ matrix.build_type }}
152+
strategy:
153+
fail-fast: false
154+
# The matrix sets all the different combinations of builds, e.g. platforms
155+
# and build configurations
156+
matrix:
157+
os:
158+
- macos-latest
159+
compiler_mpi:
160+
- "gnu_openmpi"
161+
openmp:
162+
- "ON"
163+
- "OFF"
164+
build_type:
165+
- "Debug"
166+
- "Release"
167+
runs-on: ${{ matrix.os }}
168+
steps:
169+
- name: Checkout code
170+
uses: actions/checkout@v3
171+
172+
- name: install openmpi
173+
run: brew install open-mpi
174+
175+
- name: set macos gcc
176+
if: startsWith(matrix.compiler_mpi, 'gnu_')
177+
shell: bash
178+
run: |
179+
echo "CC=gcc-14" >> $GITHUB_ENV
180+
echo "CXX=g++-14" >> $GITHUB_ENV
181+
echo "FC=gfortran-14" >> $GITHUB_ENV
182+
echo "OMPI_FC=gfortran-14" >> $GITHUB_ENV
183+
brew install glew gd zlib json-c
184+
185+
- name: set macos intel
186+
if: startsWith(matrix.compiler_mpi, 'intel_')
187+
shell: bash
188+
run: |
189+
echo "CC=icx" >> $GITHUB_ENV
190+
echo "CXX=icx" >> $GITHUB_ENV
191+
echo "FC=mpiifx" >> $GITHUB_ENV
192+
echo "OMPI_FC=mpiifx" >> $GITHUB_ENV
193+
194+
- name: Build
195+
if: startsWith(matrix.compiler_mpi, 'gnu_')
196+
shell: bash
197+
run: |
198+
cmake -B builddir -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DUSE_OPENMP=${{matrix.openmp}}
199+
cmake --build builddir -j1 --target fds
200+
201+
- name: Build
202+
if: startsWith(matrix.compiler_mpi, 'intel_')
203+
shell: bash
204+
run: |
205+
source /opt/intel/oneapi/setvars.sh
206+
cmake -B builddir -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DUSE_OPENMP=${{matrix.openmp}}
207+
cmake --build builddir -j1 --target fds
208+
209+
- name: Test
210+
if: startsWith(matrix.compiler_mpi, 'gnu_')
211+
run: ctest --test-dir builddir -j --output-on-failure -V
212+
213+
- name: Test
214+
if: startsWith(matrix.compiler_mpi, 'intel_')
215+
run: |
216+
source /opt/intel/oneapi/setvars.sh
217+
ctest --test-dir builddir -j --output-on-failure -V
218+
219+
cmake-windows:
220+
# build on windows using ifort with intelmpi and mkl based on
221+
# https://github.com/oneapi-src/oneapi-ci
222+
223+
name: windows ${{matrix.compiler}} intelmpi openmp=${{ matrix.openmp }} ${{ matrix.build_type }}
224+
runs-on: [windows-latest]
225+
strategy:
226+
fail-fast: false
227+
# The matrix sets all the different combinations of builds, e.g. platforms
228+
# and build configurations
229+
matrix:
230+
build_type:
231+
- "Debug"
232+
- "Release"
233+
openmp:
234+
- "ON"
235+
- "OFF"
236+
compiler:
237+
- "mpiifort"
238+
- "mpiifx"
239+
defaults:
240+
run:
241+
shell: cmd
242+
243+
steps:
244+
- uses: actions/checkout@v4
245+
246+
# install oneapi components from web installer based on
247+
# oneapi-ci/scripts/install_windows.bat
248+
- name: cache install oneapi
249+
id: cache-install
250+
uses: actions/cache@v4
251+
with:
252+
path: C:\Program Files (x86)\Intel\oneAPI\
253+
key: install-${{ env.WINDOWS_BASEKIT_URL }}-${{ env.WINDOWS_BASEKIT_COMPONENTS }}-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_HPCKIT_COMPONENTS }}
254+
- name: install oneapi mkl
255+
if: steps.cache-install.outputs.cache-hit != 'true'
256+
run: |
257+
curl.exe --output %TEMP%\webimage_base.exe --url %WINDOWS_BASEKIT_URL% --retry 5 --retry-delay 5
258+
start /b /wait %TEMP%\webimage_base.exe -s -x -f webimage_base_extracted --log extract_base.log
259+
del %TEMP%\webimage_base.exe
260+
webimage_base_extracted\bootstrapper.exe -s --action install --components=%WINDOWS_BASEKIT_COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=.
261+
rd /s/q "webimage_base_extracted"
262+
- name: install oneapi compiler, mpi
263+
if: steps.cache-install.outputs.cache-hit != 'true'
264+
run: |
265+
curl.exe --output %TEMP%\webimage_hpc.exe --url %WINDOWS_HPCKIT_URL% --retry 5 --retry-delay 5
266+
start /b /wait %TEMP%\webimage_hpc.exe -s -x -f webimage_hpc_extracted --log extract_hpc.log
267+
del %TEMP%\webimage_hpc.exe
268+
webimage_hpc_extracted\bootstrapper.exe -s --action install --components=%WINDOWS_HPCKIT_COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=.
269+
rd /s/q "webimage_hpc_extracted"
270+
271+
- name: build fds
272+
run: |
273+
call Build\Scripts\setup_intel_compilers.bat
274+
cmake -B builddir -S . -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DUSE_SUNDIALS=OFF -DUSE_HYPRE=ON -DHYPRE_FMANGLE=4 -DUSE_OPENMP=${{matrix.openmp}}
275+
cmake --build builddir -j --target fds
276+
277+
- name: Test
278+
run: |
279+
call Build\Scripts\setup_intel_compilers.bat
280+
ctest --test-dir builddir -j --output-on-failure -V

0 commit comments

Comments
 (0)