Skip to content

Commit 5ae8346

Browse files
Add option to use Sundials library instead of the embedded Kinsol (parflow#657)
The embedded Kinsol version is very old and has not been updated since the early versions of ParFlow. A compile time option has been added to use the Sundials library version of Kinsol. Some tests were modified to use EtaConst as this is the more stable option but possibly less performant. This provided consistency between the old and new Kinsol results. Some tests were setting EtaValue when using Walker1 and Walker2 EtaChoice options. The key is ignored for those options so removed for better clarity. A bug in Walker1 was backported to the embedded Kinsol version from the new Sundials. This provides better consistency between the old and new Kinsol and should provide better solver performance for Walker1. Walker2 results were the most inconsistent between the old and new kinsol. Setting EtaGammer to a tighter constraint improves consistency. --------- Co-authored-by: Daniel Osei-Kuffuor <oseikuffuor1@llnl.gov>
1 parent c2629ab commit 5ae8346

239 files changed

Lines changed: 1794 additions & 5205 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/linux.yml

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,21 @@ jobs:
121121
amps_layer: mpi1,
122122
netcdf: "true",
123123
memory_manager: "none",
124-
pdi: "false"
124+
pdi: "false",
125+
sundials: "embedded"
126+
}
127+
- {
128+
name: "Ubuntu 24.04 GCC Sundials",
129+
os: ubuntu-24.04,
130+
cudaos: 'ubuntu2404',
131+
cc: "gcc", cxx: "g++", fc: "gfortran",
132+
python: "false",
133+
backend: "none",
134+
amps_layer: mpi1,
135+
netcdf: "true",
136+
memory_manager: "none",
137+
pdi: "false",
138+
sundials: "external"
125139
}
126140
- {
127141
name: "Ubuntu 24.04 LLVM",
@@ -133,7 +147,8 @@ jobs:
133147
amps_layer: mpi1,
134148
netcdf: "true",
135149
memory_manager: "none",
136-
pdi: "false"
150+
pdi: "false",
151+
sundials: "embedded"
137152
}
138153
- {
139154
name: "Ubuntu 22.04 GCC Python",
@@ -145,7 +160,8 @@ jobs:
145160
amps_layer: mpi1,
146161
netcdf: "true",
147162
memory_manager: "none",
148-
pdi: "false"
163+
pdi: "false",
164+
sundials: "embedded"
149165
}
150166
- {
151167
name: "Ubuntu 24.04 GCC Python",
@@ -157,7 +173,8 @@ jobs:
157173
amps_layer: mpi1,
158174
netcdf: "false",
159175
memory_manager: "none",
160-
pdi: "false"
176+
pdi: "false",
177+
sundials: "embedded"
161178
}
162179
- {
163180
name: "Ubuntu 24.04 GCC OMP",
@@ -169,7 +186,8 @@ jobs:
169186
amps_layer: mpi1,
170187
netcdf: "false",
171188
memory_manager: "none",
172-
pdi: "false"
189+
pdi: "false",
190+
sundials: "embedded"
173191
}
174192
- {
175193
name: "Ubuntu 24.04 LLVM OASIS3-MCT Build",
@@ -181,7 +199,8 @@ jobs:
181199
amps_layer: oas3,
182200
netcdf: "true",
183201
memory_manager: "none",
184-
pdi: "false"
202+
pdi: "false",
203+
sundials: "embedded"
185204
}
186205
# - {
187206
# name: "Ubuntu 24.04 GCC CUDA/RMM Build",
@@ -204,7 +223,8 @@ jobs:
204223
amps_layer: mpi1,
205224
netcdf: "false",
206225
memory_manager: "umpire",
207-
pdi: "false"
226+
pdi: "false",
227+
sundials: "embedded"
208228
}
209229
# - {
210230
# name: "Ubuntu 24.04 GCC Kokkos/RMM Build",
@@ -227,7 +247,8 @@ jobs:
227247
amps_layer: mpi1,
228248
netcdf: "false",
229249
memory_manager: "umpire",
230-
pdi: "false"
250+
pdi: "false",
251+
sundials: "embedded"
231252
}
232253
- {
233254
name: "Ubuntu 24.04 GCC PDI Build",
@@ -239,7 +260,8 @@ jobs:
239260
amps_layer: mpi1,
240261
netcdf: "false",
241262
memory_manager: "none",
242-
pdi: "true"
263+
pdi: "true",
264+
sundials: "embedded"
243265
}
244266

245267
steps:
@@ -499,7 +521,7 @@ jobs:
499521
fi
500522
501523
# Install Hypre. See https://hypre.readthedocs.io/en/latest/ch-misc.html#build-system-options
502-
cmake -S src -B build \
524+
cmake -S src -B build \
503525
-DCMAKE_C_COMPILER=mpicc \
504526
-DCMAKE_CXX_COMPILER=mpicxx \
505527
-DCMAKE_INSTALL_PREFIX="${PARFLOW_DEP_DIR}" \
@@ -510,6 +532,25 @@ jobs:
510532
echo "" && echo "Successfully built Hypre ${BACKEND}"
511533
fi
512534
535+
- name: Sundials Install
536+
env:
537+
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
538+
if: matrix.config.sundials == 'external'
539+
run: |
540+
if [[ "$CACHE_HIT" != 'true' ]]; then
541+
# Download
542+
wget https://github.com/llnl/sundials/archive/v7.4.0.tar.gz
543+
tar xf v7.4.0.tar.gz
544+
cd sundials-7.4.0
545+
cmake -S . -B build \
546+
-DCMAKE_C_COMPILER=mpicc \
547+
-DCMAKE_CXX_COMPILER=mpicxx \
548+
-DCMAKE_INSTALL_PREFIX="${PARFLOW_DEP_DIR}"
549+
cmake --build build --parallel 4
550+
cmake --install build
551+
echo "SUNDIALS_FLAGS=-DSUNDIALS_ROOT=${PARFLOW_DEP_DIR}" >> $GITHUB_ENV
552+
fi
553+
513554
- name: PDI Install
514555
env:
515556
CACHE_HIT: ${{steps.cache-parflow-dependencies.outputs.cache-hit}}
@@ -559,7 +600,7 @@ jobs:
559600
-DSILO_ROOT=$PARFLOW_DEP_DIR \
560601
-DPARFLOW_ENABLE_PYTHON=${{ matrix.config.python }} \
561602
-DCMAKE_INSTALL_PREFIX=$PARFLOW_DIR \
562-
$NETCDF_FLAGS $KOKKOS_FLAGS $RMM_FLAGS $UMPIRE_FLAGS $PDI_FLAGS
603+
$NETCDF_FLAGS $KOKKOS_FLAGS $RMM_FLAGS $UMPIRE_FLAGS $PDI_FLAGS $SUNDIALS_FLAGS
563604
564605
- name: ParFlow CMake Build
565606
run: (cd build; make -j 2 install)

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,13 @@ endif (${PARFLOW_ENABLE_SZLIB} OR DEFINED SZLIB_ROOT)
373373
#-----------------------------------------------------------------------------
374374
option(PARFLOW_ENABLE_SUNDIALS "Build with SUNDIALS" "OFF")
375375
if (${PARFLOW_ENABLE_SUNDIALS} OR DEFINED SUNDIALS_ROOT)
376-
find_package(SUNDIALS COMPONENTS sundials_cvode sundials_kinsol)
376+
find_package(SUNDIALS COMPONENTS sundials_cvode sundials_kinsol sundials_core sundials_sunlinsolspgmr)
377377
if (${SUNDIALS_FOUND})
378378
set(PARFLOW_HAVE_SUNDIALS "yes")
379379
set(HAVE_SUNDIALS ${PARFLOW_HAVE_SUNDIALS})
380380
endif (${SUNDIALS_FOUND})
381+
else ()
382+
message (STATUS "Found KINSOL: embedded")
381383
endif (${PARFLOW_ENABLE_SUNDIALS} OR DEFINED SUNDIALS_ROOT)
382384

383385
#-----------------------------------------------------------------------------

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,21 @@ Here are some common packages:
350350
- __SZLIB__: builds ParFlow with SZlib compression library
351351
- __ZLIB__: builds ParFlow with Zlib compression library
352352

353+
### KINSOL Solver
354+
355+
There are two compile options for the KINSOL solver used by ParFlow.
356+
The current default is to use an old version of KINSOL that is
357+
embedded in ParFlow. The newer option is to use KINSOL from the
358+
SUNDIALS package. To use the SUNDIALS package you will need to have a
359+
SUNDIALS install that includes KINSOL and specify during the CMake configuration:
360+
361+
```shell
362+
-DSUNDIALS_ROOT=<directory of the location of sundials install>
363+
```
364+
365+
The GitHub repository for [SUNDIALS](https://github.com/LLNL/sundials)
366+
has downloads and build instructions.
367+
353368
### How to specify the launcher command used to run MPI applications
354369

355370
There are multiple ways to run MPI applications such as mpiexec,

bin/valgrind.sup

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@
199199
...
200200
}
201201

202+
{
203+
<insert_a_suppression_name_here>
204+
Memcheck:Cond
205+
fun:__intel_sse2_strncmp
206+
...
207+
fun:MPIDI_CH3I_set_affinity
208+
}
209+
202210
{
203211
Clone
204212
Memcheck:Leak
@@ -253,6 +261,37 @@
253261
fun:PMPI_Init
254262
}
255263

264+
{
265+
<insert_a_suppression_name_here>
266+
Memcheck:Leak
267+
match-leak-kinds: possible
268+
fun:calloc
269+
obj:/usr/lib64/libibverbs.so.1.14.48.0
270+
fun:nl_recvmsgs_report
271+
fun:nl_recvmsgs
272+
obj:/usr/lib64/libibverbs.so.1.14.48.0
273+
obj:/usr/lib64/libibverbs.so.1.14.48.0
274+
obj:/usr/lib64/libibverbs.so.1.14.48.0
275+
fun:ibv_get_device_list
276+
...
277+
fun:rdma_cm_get_hca_type
278+
}
279+
280+
{
281+
<insert_a_suppression_name_here>
282+
Memcheck:Leak
283+
match-leak-kinds: possible
284+
fun:calloc
285+
obj:/usr/lib64/libmlx4.so.1.0.48.0
286+
obj:/usr/lib64/libibverbs.so.1.14.48.0
287+
obj:/usr/lib64/libibverbs.so.1.14.48.0
288+
obj:/usr/lib64/libibverbs.so.1.14.48.0
289+
fun:ibv_get_device_list
290+
...
291+
fun:MPID_Init
292+
}
293+
294+
256295
{
257296
<insert_a_suppression_name_here>
258297
Memcheck:Cond
@@ -269,7 +308,6 @@
269308
...
270309
}
271310

272-
273311
{
274312
<insert_a_suppression_name_here>
275313
Memcheck:Cond
@@ -732,3 +770,4 @@
732770
fun:cudaMemPrefetchAsync
733771
...
734772
}
773+

pfsimulator/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ string(APPEND CMAKE_C_FLAGS " ${PARFLOW_ETRACE_COMPILE_FLAGS}")
88
string(APPEND CMAKE_CXX_FLAGS " ${PARFLOW_ETRACE_COMPILE_FLAGS}")
99

1010
add_subdirectory (amps)
11-
add_subdirectory (kinsol)
11+
12+
if (NOT PARFLOW_HAVE_SUNDIALS)
13+
add_subdirectory (kinsol)
14+
endif ()
15+
1216
add_subdirectory (parflow_lib)
1317
add_subdirectory (parflow_exe)
1418
add_subdirectory (third_party)

pfsimulator/amps/common/Makefile.depend

Lines changed: 0 additions & 17 deletions
This file was deleted.

pfsimulator/amps/cuda/Makefile.depend

Lines changed: 0 additions & 17 deletions
This file was deleted.

pfsimulator/amps/mpi1/Makefile.depend

Lines changed: 0 additions & 17 deletions
This file was deleted.

pfsimulator/amps/oas3/Makefile.depend

Lines changed: 0 additions & 20 deletions
This file was deleted.

pfsimulator/amps/smpi/Makefile.depend

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)