forked from parflow/parflow
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (141 loc) · 6.5 KB
/
macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: ParFlow MacOS CI Test
#
# Notes
# Currently using GCC for the build rather than Clang
# Python 3.12 used rather than more current available versions since Numba library does not work with later versions
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
# fail-fast: true
matrix:
config:
- {
name: "MacOS 14",
os: macos-14,
cudaos: '',
python: "true",
backend: "none",
amps_layer: mpi1,
netcdf: "true"
}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
- uses: mpi4py/setup-mpi@v1
with:
mpi: openmpi
- name: HDF5 Install
run: |
brew install hdf5-mpi
# Cache dependencies so don't have to rebuild on each test.
# Can flush caches by resetting the CACHE_VERSION secret on GitHub
# settings for the project (using date-timestamp for secret).
- name: Cache dependencies
uses: actions/cache@v4
id: cache-parflow-dependencies
env:
cache-name: cache-parflow-dependencies
cache-parflow-hit: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
with:
path: "~/depend"
key: cache-${{ matrix.config.os }}-${{ matrix.config.backend }}-${{ secrets.CACHE_VERSION }}
- name: Directory Setup
run: |
mkdir -p $HOME/install
echo "PARFLOW_DIR=$HOME/install" >> $GITHUB_ENV
echo "Setting PARFLOW_DIR=$HOME/install"
mkdir -p $HOME/depend/{include,lib}
echo "PARFLOW_DEP_DIR=$HOME/depend" >> $GITHUB_ENV
echo "Setting PARFLOW_DEP_DIR=$HOME/depend"
echo "PARFLOW_DEP_DIR=$HOME/depend" >> $GITHUB_ENV
echo "$HOME/depend/bin" >> $GITHUB_PATH
export LD_LIBRARY_PATH=${PARFLOW_DEP_DIR}/lib64:${PARFLOW_DEP_DIR}/lib:${LD_LIBRARY_PATH}
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
export PARFLOW_PYTHON3=/opt/homebrew/bin/python3.12
echo "PARFLOW_PYTHON3=${PARFLOW_PYTHON3}" >> $GITHUB_ENV
- name: CMake Install
if: matrix.config.os != 'macos-14'
env:
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
echo "Installing"
cd ~/depend
echo "cache-${{ matrix.config.os }}-${{ matrix.config.backend }}-${{ secrets.CACHE_VERSION }}" > ~/depend/cache-key
wget -nv --no-check-certificate https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.tar.gz
tar -xf cmake-3.25.1-linux-x86_64.tar.gz
$HOME/depend/cmake-3.25.1-linux-x86_64/bin/cmake --version
fi
echo "$HOME/depend/cmake-3.25.1-linux-x86_64/bin" >> $GITHUB_PATH
# Package netcdf is missing features needed by the ParFlow writers, build from source
# netcdf is True when we want to build the PF NetCDF writer.
- name: NetCDF Install
env:
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
if: matrix.config.netcdf == 'true'
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
URL=https://github.com/Unidata/netcdf-c/archive/v4.9.0.tar.gz
mkdir netcdf-c
cd netcdf-c
curl -L $URL | tar --strip-components=1 -xz
CC=mpicc CPPFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/lib/ ./configure --prefix=$PARFLOW_DEP_DIR
make
make install
cd ..
URL=https://github.com/Unidata/netcdf-fortran/archive/v4.5.4.tar.gz
mkdir netcdf-fortran
cd netcdf-fortran
curl -L $URL | tar --strip-components=1 -xz
CC=mpicc FC=mpifort CPPFLAGS=-I${PARFLOW_DEP_DIR}/include LDFLAGS=-L${PARFLOW_DEP_DIR}/lib ./configure --prefix=${PARFLOW_DEP_DIR}
make
make install
fi
echo "NETCDF_FLAGS=-DNETCDF_DIR=$PARFLOW_DEP_DIR -DPARFLOW_ENABLE_HDF5=TRUE" >> $GITHUB_ENV
- name: SILO Install
env:
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
URL=https://github.com/LLNL/Silo/archive/refs/tags/4.11.tar.gz
mkdir silo
cd silo
curl -L $URL | tar --strip-components=1 -xz
./configure --disable-silex --disable-hzip --disable-fpzip --prefix=$PARFLOW_DEP_DIR --disable-fortran --with-readline=no
make -j 2 install
fi
- name: HYPRE Install
env:
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
run: |
if [[ "$CACHE_HIT" != 'true' ]]; then
URL=https://github.com/hypre-space/hypre/archive/v2.26.0.tar.gz
mkdir hypre
cd hypre
curl -L $URL | tar --strip-components=1 -xz
cd src
CC=mpicc CXX=mpic++ FC=mpif77 F77=mpif90 ./configure --prefix=$PARFLOW_DEP_DIR
make -j 2 install
fi
- name: ParFlow CMake Configure
run: |
mpicc -v
if [[ "${{ matrix.config.amps_layer }}" == "oas3" ]]; then HAVE_CLM="OFF"; else HAVE_CLM="ON"; fi
# SGS 2024-11-22 Had to hack in homebrew file paths for TCL. Why are links not in /opt/homebrew/bin and lib anymore?
# Why can't we get TCL paths from pkgconf?
CC=mpicc CXX=mpicxx F77=mpif77 FC=mpif90 cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Wall -Werror -Wno-unused-result -Wno-unused-function" -DPARFLOW_ENABLE_TIMING=TRUE -DPARFLOW_AMPS_LAYER=${{ matrix.config.amps_layer }} -DPARFLOW_ACCELERATOR_BACKEND=${{ matrix.config.backend }} -DPARFLOW_AMPS_SEQUENTIAL_IO=true -DPARFLOW_HAVE_CLM=${HAVE_CLM} -DHYPRE_ROOT=$PARFLOW_DEP_DIR -DOAS3_ROOT=$PARFLOW_DEP_DIR -DSILO_ROOT=$PARFLOW_DEP_DIR -DPARFLOW_ENABLE_PYTHON=${{ matrix.config.python }} $NETCDF_FLAGS $KOKKOS_FLAGS $RMM_FLAGS -DCMAKE_INSTALL_PREFIX=$PARFLOW_DIR -DTCL_INCLUDE_PATH=/opt/homebrew/bin/usr/include -DTCL_LIBRARY=/opt/homebrew/Cellar/tcl-tk@8/8.6.15/lib/libtcl8.6.dylib -DTCL_TCLSH=/opt/homebrew/Cellar/tcl-tk@8/8.6.15/bin/tclsh8.6 -DPython3_EXECUTABLE=$PARFLOW_PYTHON3
- name: ParFlow CMake Build
run: (cd build; make -j 2 VERBOSE=1 install)
# Can't test with GPU since have no GPU hardware on testing nodes, GPU test is build only
- name: ParFlow CTest
if: matrix.config.backend != 'cuda' && matrix.config.backend != 'kokkos'
run: |
(cd build; ctest --output-on-failure)