Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/cpp20-aggregate' into bug…
Browse files Browse the repository at this point in the history
…fix/cpp20-aggregate
  • Loading branch information
balos1 committed Feb 7, 2024
2 parents c2f3a14 + 3e6bcba commit 87713da
Show file tree
Hide file tree
Showing 253 changed files with 8,357 additions and 11,889 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ SUNDIALS CMake target. The library `sundials_generic` has been superseded by
`sundials_core` and is no longer available. This fixes some duplicate symbol
errors on Windows when linking to multiple SUNDIALS libraries.

#### Fortran Interface Modules Streamlined

We have streamlined the Fortran modules that need to be included by users by combining
the SUNDIALS core into one Fortran module, `fsundials_core_mod`. Modules for
implementations of the core APIs still exist (e.g., for the Dense linear solver there
is `fsunlinsol_dense_mod`) as do the modules for the SUNDIALS packages (e.g., `fcvode_mod`).
The following modules are the ones that have been consolidated into `fsundials_core_mod`:

```
fsundials_adaptcontroller_mod
fsundials_context_mod
fsundials_futils_mod
fsundials_linearsolver_mod
fsundials_logger_mod
fsundials_matrix_mod
fsundials_nonlinearsolver_mod
fsundials_nvector_mod
fsundials_profiler_mod
fsundials_types_mod
```


### Deprecation notice

The functions in `sundials_math.h` will be deprecated in the next release.
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ foreach(test_tuple ${tests})
# if("${backend}" STREQUAL "USE_CUDA")
# sundials_add_benchmark(${target} ${target} diffusion_2D
# ENABLE_GPU
# NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS}
# NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS}
# )
#endif()

Expand Down
11 changes: 6 additions & 5 deletions cmake/SundialsBuildOptionsPre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ sundials_option(SUNDIALS_BUILD_WITH_MONITORING BOOL "${DOCSTR}" OFF)
set(DOCSTR "Build with simulation profiling capabilities enabled")
sundials_option(SUNDIALS_BUILD_WITH_PROFILING BOOL "${DOCSTR}" OFF)

if(SUNDIALS_BUILD_WITH_PROFILING)
message(WARNING "SUNDIALS built with profiling turned on, performance may be affected.")
endif()

# ---------------------------------------------------------------
# Option to enable/disable error checking
# ---------------------------------------------------------------
Expand Down Expand Up @@ -102,12 +106,9 @@ if(SUNDIALS_LOGGING_LEVEL GREATER_EQUAL 3)
endif()

# ---------------------------------------------------------------
# Option to use the generic math libraries
# Option to set the math library
# ---------------------------------------------------------------

# We still provide USE_GENERIC_MATH for backwards compatibility
# We also provide it for non-unix systems, but with different defaults,
# in order to present a uniform CMake interface.
if(UNIX)
sundials_option(SUNDIALS_MATH_LIBRARY PATH "Which math library (e.g., libm) to link to" "-lm" ADVANCED)
else()
Expand Down Expand Up @@ -333,4 +334,4 @@ sundials_option(SUNDIALS_CALIPER_OUTPUT_DIR PATH "Location to write caliper outp

sundials_option(SUNDIALS_BENCHMARK_NUM_CPUS STRING "Number of CPU cores to run benchmarks with" "40" ADVANCED)

sundials_option(SUNDIALS_BENCHMARK_NUM_GPUS STRING "Number of GPUs to run benchmarks with" "4" ADVANCED)
sundials_option(SUNDIALS_BENCHMARK_NUM_GPUS STRING "Number of GPUs to run benchmarks with" "4" ADVANCED)
19 changes: 0 additions & 19 deletions cmake/SundialsDeprecated.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,3 @@ if(DEFINED CUDA_ARCH)
set(CMAKE_CUDA_ARCHITECTURES ${arch_name} CACHE STRING "CUDA Architectures" FORCE)
unset(CUDA_ARCH)
endif()

#
# Deprecated USE_GENERIC_MATH option
#

if(DEFINED USE_GENERIC_MATH)
print_warning("The CMake option USE_GENERIC_MATH is deprecated" "Use SUNDIALS_MATH_LIBRARY instead"
MODE DEPRECATION)
if(USE_GENERIC_MATH)
if(UNIX)
set(SUNDIALS_MATH_LIBRARY "-lm" CACHE PATH "Which math library (e.g., libm) to link to" FORCE)
else()
set(SUNDIALS_MATH_LIBRARY "" CACHE PATH "Which math library (e.g., libm) to link to" FORCE)
endif()
else()
set(SUNDIALS_MATH_LIBRARY "" CACHE PATH "Which math library (e.g., libm) to link to" FORCE)
endif()
unset(USE_GENERIC_MATH CACHE)
endif()
85 changes: 0 additions & 85 deletions cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,91 +120,6 @@ set(DOCSTR "Enable C compiler specific extensions")
sundials_option(CMAKE_C_EXTENSIONS BOOL "${DOCSTR}" ON)
message(STATUS "C extensions set to ${CMAKE_C_EXTENSIONS}")

# ---------------------------------------------------------------
# Check for snprintf and va_copy
#
# 199901L is the minimum ISO C standard for snprintf but some
# C89 compilers provide extensions that define it.
# ---------------------------------------------------------------

check_c_source_compiles("
#include <stdio.h>
#include <stdarg.h>
int main(void) {
int size = snprintf(NULL, 0, \"%s\", \"snprintf works\");
va_list args;
va_list tmp;
va_copy(tmp, args);
printf(\"%d\", size);
return 0;
}
" SUNDIALS_C_COMPILER_HAS_SNPRINTF_AND_VA_COPY)
if(NOT SUNDIALS_C_COMPILER_HAS_SNPRINTF_AND_VA_COPY)
sundials_option(SUNDIALS_MAX_SPRINTF_SIZE STRING
"Max size of buffer for sprintf" "5120" ADVANCED)
endif()

# ---------------------------------------------------------------
# Check for float and long double math functions
# ---------------------------------------------------------------

set(CMAKE_REQUIRED_LIBRARIES ${SUNDIALS_MATH_LIBRARY})
check_c_source_compiles("
#include <math.h>
#include <stdio.h>
int main(void) {
float a, a_result;
long double b, b_result;
a = 1.0F;
b = 1.0L;
a_result = sqrtf(a);
a_result = fabsf(a);
a_result = expf(a);
a_result = ceilf(a);
a_result = powf(a, 1.0F);
printf(\"a_result=%g\", a_result);
b_result = sqrtl(b);
b_result = fabsl(b);
b_result = expl(b);
b_result = ceill(b);
b_result = powl(b, 1.0L);
printf(\"b_result=%Lg\", b_result);
return 0;
}
" SUNDIALS_C_COMPILER_HAS_MATH_PRECISIONS)

# ---------------------------------------------------------------
# Check for isinf and isnan
# ---------------------------------------------------------------

check_c_source_compiles("
#include <math.h>
int main(void) {
double a = 0.0;
int result = isinf(a);
result = isnan(a);
return result;
}
" SUNDIALS_C_COMPILER_HAS_ISINF_ISNAN)

# ---------------------------------------------------------------
# Check for inline
# ---------------------------------------------------------------

check_c_source_compiles("
static inline double add1(double a) {
return a + 1.0;
}
int main(void) {
double a = 0.0;
return add1(a) < a;
}
" SUNDIALS_C_COMPILER_HAS_INLINE)

# ---------------------------------------------------------------
# Check for __builtin_expect
# ---------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions cmake/SundialsSetupConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ else()
set(SUNDIALS_DEPRECATED_MSG_MACRO "SUNDIALS_DEPRECATED")
endif()

# prepare substitution variable SUNDIALS_USE_GENERIC_MATH for sundials_config.h
if(SUNDIALS_C_COMPILER_HAS_MATH_PRECISIONS)
set(SUNDIALS_USE_GENERIC_MATH FALSE)
else()
set(SUNDIALS_USE_GENERIC_MATH TRUE)
endif()

if($ENV{CI_JOB_ID})
set(JOB_ID $ENV{CI_JOB_ID})
else()
Expand Down
4 changes: 2 additions & 2 deletions cmake/SundialsSetupFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ if(NEED_FORTRAN_NAME_MANGLING)
# Generate C source which calls the "mysub" function using the current scheme
file(WRITE ${FortranTest_DIR}/ctest1.c
"extern void ${opt}();\n"
"int main(){${opt}();return(0);}\n")
"int main(void){${opt}();return(0);}\n")
# Use TRY_COMPILE to make the "ctest1" executable from the current C source
# and linking to the previously created "flib" library.
try_compile(CTEST_OK ${FortranTest_DIR} ${FortranTest_DIR}
Expand Down Expand Up @@ -253,7 +253,7 @@ if(NEED_FORTRAN_NAME_MANGLING)
list(GET options ${iopt} opt)
file(WRITE ${FortranTest_DIR}/ctest2.c
"extern void ${opt}();\n"
"int main(){${opt}();return(0);}\n")
"int main(void){${opt}();return(0);}\n")
try_compile(CTEST_OK ${FortranTest_DIR} ${FortranTest_DIR}
ctest2 OUTPUT_VARIABLE MY_OUTPUT)
file(WRITE ${FortranTest_DIR}/ctest2_${opt}.out "${MY_OUTPUT}")
Expand Down
12 changes: 6 additions & 6 deletions cmake/SundialsSetupTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ if(SUNDIALS_TEST_DEVTESTS)
if(SUNDIALS_TEST_INTEGER_PRECISION GREATER_EQUAL "0")
message(STATUS "Using non-default integer precision: ${SUNDIALS_TEST_INTEGER_PRECISION}")
endif()

#
# Target to run tests in CI containers
#
#
if(NOT SUNDIALS_TEST_CONTAINER_EXE)
find_program(container_exe docker)
if(NOT container_exe)
Expand All @@ -89,7 +89,7 @@ if(SUNDIALS_TEST_DEVTESTS)
endif()

if(SUNDIALS_TEST_CONTAINER_EXE)
add_custom_target(setup_local_ci
add_custom_target(setup_local_ci
${CMAKE_COMMAND} -E cmake_echo_color --cyan
"Pulled SUNDIALS CI containers.")

Expand All @@ -100,7 +100,7 @@ if(SUNDIALS_TEST_DEVTESTS)
macro(add_local_ci_target index_size precision tag)
string(TOLOWER "${precision}" precision_)
set(container sundials-ci-int${index_size}-${precision_})
set(container_exe_args run ${SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS} -t -d --name ${container} --cap-add SYS_PTRACE
set(container_exe_args run ${SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS} -t -d --name ${container} --cap-add SYS_PTRACE
-v ${CMAKE_SOURCE_DIR}:${SUNDIALS_TEST_CONTAINER_MNT} ghcr.io/llnl/${container}:${tag})
add_custom_target(setup_local_ci_${index_size}_${precision_}
COMMENT "Pulling SUNDIALS CI container ghcr.io/llnl/${container}:${tag}"
Expand Down Expand Up @@ -136,7 +136,7 @@ if(SUNDIALS_TEST_UNITTESTS AND SUNDIALS_TEST_ENABLE_GTEST)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
GIT_TAG v1.14.0
GIT_TAG v1.14.0
)
if(WIN32)
# For Windows: Prevent overriding the parent project's compiler/linker settings
Expand Down Expand Up @@ -178,7 +178,7 @@ endif()
if(BUILD_BENCHMARKS)

message("SUNDIALS Benchmarking")

# Create benchmark targets
add_custom_target(benchmark
${CMAKE_COMMAND} -E cmake_echo_color --cyan
Expand Down
2 changes: 1 addition & 1 deletion cmake/macros/SundialsAddBenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME)
"--outputdir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/output"
"--calidir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${TARGET_NAME}"
"--nodiff")

# incorporate scheduler arguments into test_runner
if(SUNDIALS_SCHEDULER_COMMAND STREQUAL "flux run")
set(SCHEDULER_STRING " -n${sundials_add_benchmark_NUM_CORES}")
Expand Down
6 changes: 3 additions & 3 deletions cmake/tpl/FindMAGMA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR)
if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA")
if (NOT TARGET CUDA::cudart)
find_package(CUDAToolkit REQUIRED)
endif()
endif()
endif()

foreach(lib ${_libraries_list})
if(NOT (lib STREQUAL "-lmagma" OR lib STREQUAL "-lmagma_sparse"
OR lib STREQUAL "-L\${libdir}" OR lib STREQUAL "") )

# Check if we need to find cusparse or cublas
if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA")
# Replace cublas, cusparse with the CMake targets because the library path in
Expand All @@ -100,7 +100,7 @@ if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR)
set(lib CUDA::cusparse)
endif()
endif()

list(APPEND _interface_libraires ${lib})
endif()
endforeach()
Expand Down
4 changes: 2 additions & 2 deletions cmake/tpl/SundialsAdiak.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ if(adiak_FOUND AND (NOT adiak_WORKS))
# Create a C source file
file(WRITE ${adiak_TEST_DIR}/ltest.c
"\#include <adiak.h>\n"
"int main()\n"
"int main(void)\n"
"{\n"
" adiak_init(NULL);\n"
" adiak_fini();\n"
" adiak_fini();\n"
" return 0;\n"
"}\n")

Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsCaliper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if(CALIPER_FOUND AND (NOT CALIPER_WORKS))
# Create a C source file
file(WRITE ${CALIPER_TEST_DIR}/ltest.c
"\#include <caliper/cali.h>\n"
"int main()\n"
"int main(void)\n"
"{\n"
" CALI_MARK_FUNCTION_BEGIN;\n"
" CALI_MARK_FUNCTION_END;\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsHypre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if(HYPRE_FOUND AND (NOT HYPRE_WORKS))

file(WRITE ${HYPRE_TEST_DIR}/ltest.c
"\#include \"HYPRE_parcsr_ls.h\"\n"
"int main(){\n"
"int main(void) {\n"
"HYPRE_ParVector par_b;\n"
"HYPRE_IJVector b;\n"
"par_b = 0;\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsKLU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if(KLU_FOUND AND (NOT KLU_WORKS))
# Create a C source file which calls a KLU function
file(WRITE ${KLU_TEST_DIR}/ltest.c
"\#include \"klu.h\"\n"
"int main(){\n"
"int main(void) {\n"
"klu_common Common;\n"
"klu_defaults (&Common);\n"
"return(0);\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsLapack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS))
"#define dgetrf_f77 SUNDIALS_F77_FUNC(dgetrf, DGETRF)\n"
"extern void dcopy_f77(int *n, const double *x, const int *inc_x, double *y, const int *inc_y);\n"
"extern void dgetrf_f77(const int *m, const int *n, double *a, int *lda, int *ipiv, int *info);\n"
"int main(){\n"
"int main(void) {\n"
"int n=1;\n"
"double x, y;\n"
"dcopy_f77(&n, &x, &n, &y, &n);\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsMAGMA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if(MAGMA_FOUND AND (NOT MAGMA_WORKS))
if(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP" AND NOT ENABLE_HIP)
print_error("SUNDIALS_MAGMA_BACKENDS includes HIP but HIP is not enabled. Set ENABLE_HIP=ON or change the backend.")
endif()

set(MAGMA_WORKS TRUE CACHE BOOL "MAGMA works with SUNDIALS as configured" FORCE)
elseif(MAGMA_FOUND AND MAGMA_WORKS)
message(STATUS "Skipped MAGMA tests, assuming MAGMA works with SUNDIALS.")
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsPOSIXTimers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ macro(posix_timers_test)
file(WRITE ${POSIX_TIMER_TEST_DIR}/ltest.c
"#include <time.h>\n"
"#include <unistd.h>\n"
"int main(){\n"
"int main(void) {\n"
"struct timespec spec;\n"
"clock_gettime(CLOCK_MONOTONIC, &spec);\n"
"clock_getres(CLOCK_MONOTONIC, &spec);\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsSuperLUMT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if(SUPERLUMT_FOUND AND (NOT SUPERLUMT_WORKS))
# Create a C source file which calls a SUPERLUMT function
file(WRITE ${SUPERLUMT_TEST_DIR}/ltest.c
"\#include \"slu_mt_ddefs.h\"\n"
"int main(){\n"
"int main(void) {\n"
"SuperMatrix *A;\n"
"NCformat *Astore;\n"
"A = NULL;\n"
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsTrilinos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if(Trilinos_FOUND AND (NOT Trilinos_WORKS))
# Create a C++ source file which calls a Trilinos function
file(WRITE ${Trilinos_TEST_DIR}/ltest.cpp
"#include <Tpetra_Version.hpp>\n"
"int main(){\n"
"int main(void) {\n"
"std::cout << Tpetra::version() << std::endl;\n"
"return(0);\n"
"}\n")
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/SundialsXBRAID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if(XBRAID_FOUND AND (NOT XBRAID_WORKS))
file(WRITE ${XBRAID_TEST_DIR}/ltest.c
"\#include <stdlib.h>\n"
"\#include \"braid.h\"\n"
"int main(){\n"
"int main(void) {\n"
"braid_Int rand;\n"
"rand = braid_Rand();\n"
"if (rand < 0) return 1;\n"
Expand Down
Loading

0 comments on commit 87713da

Please sign in to comment.