diff --git a/.gitlab/spack_packages/sundials/package.py b/.gitlab/spack_packages/sundials/package.py index caaf24e494..ce7f4ece91 100644 --- a/.gitlab/spack_packages/sundials/package.py +++ b/.gitlab/spack_packages/sundials/package.py @@ -751,7 +751,6 @@ def initconfig_package_entries(self): self.cache_option_from_variant("USE_GENERIC_MATH", "generic-math"), # Logging self.cache_string_from_variant("SUNDIALS_LOGGING_LEVEL", "logging-level"), - self.cache_option_from_variant("SUNDIALS_LOGGING_ENABLE_MPI", "logging-mpi"), # Monitoring self.cache_option_from_variant("SUNDIALS_BUILD_WITH_MONITORING", "monitoring"), # Profiling diff --git a/CHANGELOG.md b/CHANGELOG.md index a2071813da..f75ae4d776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,43 @@ ## Changes to SUNDIALS in release X.X.X +**Breaking change** +We have replaced the use of a type-erased (i.e., `void*`) pointer to a +communicator in place of `MPI_Comm` throughout the SUNDIALS API with a +`SUNComm`, which is just a typedef to an `int` in builds without MPI +and a typedef to a `MPI_Comm` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + `SUNContext_Create` now takes a `SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass `SUN_COMM_NULL` to the `comm` argument instead of + `NULL`. For MPI codes, pass the `MPI_Comm` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + `SUNLogger_Create` or `SUNProfiler_Create`. + +- Some users will need to update their calls to `N_VGetCommunicator`, and + update any custom `N_Vector` implementations tht provide + `N_VGetCommunicator`, since it now returns a `SUNComm`. + +The change away from type-erased pointers for `SUNComm` fixes problems like the +one described in [GitHub Issue #275](https://github.com/LLNL/sundials/issues/275). + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +`SUNDIALS_LOGGING_ENABLE_MPI` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been -removed. +removed. + +**Breaking change** +Users now need to link to `sundials_core` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. +The library `sundials_generic` has been superceded by `sundials_core` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. The previously deprecated types `realtype` and `booleantype` were removed from `sundials_types.h` and replaced with `sunrealtype` and `sunbooleantype`. The deprecated names for these types diff --git a/CMakeLists.txt b/CMakeLists.txt index 57a00a263d..dfacf2853f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ # Initial setup. # =============================================================== -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.18) # Project SUNDIALS (initially only C supported) # sets PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR variables. diff --git a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp index 188cfd716b..97d639816e 100644 --- a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); /* Create SUNDIALS context */ - SUNContext_Create((void*) &comm, &ctx); + SUNContext_Create(comm, &ctx); /* Initialize Kokkos */ Kokkos::initialize(argc, argv); diff --git a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp index 0b1aa0b583..b12c8368f4 100644 --- a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp +++ b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); /* Create SUNDIALS context */ - SUNContext_Create((void*) &comm, &ctx); + SUNContext_Create(comm, &ctx); /* Create SUNDIALS memory helper */ #if defined(USE_CUDA) diff --git a/benchmarks/diffusion_2D/main_arkode.cpp b/benchmarks/diffusion_2D/main_arkode.cpp index a1251c64f4..45c3e68068 100644 --- a/benchmarks/diffusion_2D/main_arkode.cpp +++ b/benchmarks/diffusion_2D/main_arkode.cpp @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) SUNContext ctx = NULL; SUNProfiler prof = NULL; - flag = SUNContext_Create((void*) &comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContextCreate", 1)) return 1; flag = SUNContext_GetProfiler(ctx, &prof); diff --git a/benchmarks/diffusion_2D/main_cvode.cpp b/benchmarks/diffusion_2D/main_cvode.cpp index 282a104ab1..3ab714bec7 100644 --- a/benchmarks/diffusion_2D/main_cvode.cpp +++ b/benchmarks/diffusion_2D/main_cvode.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) SUNContext ctx = NULL; SUNProfiler prof = NULL; - flag = SUNContext_Create((void*) &comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContextCreate", 1)) return 1; flag = SUNContext_GetProfiler(ctx, &prof); diff --git a/benchmarks/diffusion_2D/main_ida.cpp b/benchmarks/diffusion_2D/main_ida.cpp index e0ce26d913..4976fca217 100644 --- a/benchmarks/diffusion_2D/main_ida.cpp +++ b/benchmarks/diffusion_2D/main_ida.cpp @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) SUNContext ctx = NULL; SUNProfiler prof = NULL; - flag = SUNContext_Create((void*) &comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContextCreate", 1)) return 1; flag = SUNContext_GetProfiler(ctx, &prof); diff --git a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu index b4be26d8d6..0b3bf1a9cc 100644 --- a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu +++ b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp index bb8b3fe350..a2d0899b05 100644 --- a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp +++ b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/kokkos/CMakeLists.txt b/benchmarks/nvector/kokkos/CMakeLists.txt index 5c48b04011..773f143c66 100644 --- a/benchmarks/nvector/kokkos/CMakeLists.txt +++ b/benchmarks/nvector/kokkos/CMakeLists.txt @@ -16,7 +16,7 @@ foreach(backend ${KOKKOS_EXAMPLES_BACKENDS}) sundials_add_nvector_benchmark(test_nvector_performance_kokkos.${backend} SOURCES test_nvector_performance_kokkos.cpp - SUNDIALS_TARGETS sundials_generic sundials_nveckokkos + SUNDIALS_TARGETS sundials_core sundials_nveckokkos INSTALL_SUBDIR nvector/kokkos ) diff --git a/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c b/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c index eab5de07e5..61f2a338ff 100644 --- a/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c +++ b/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) printf(" number of MPI procs %d \n", nprocs); } - flag = SUNContext_Create(&comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c index 56d88738b5..de7279467f 100644 --- a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c +++ b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) printf(" timing on/off %d \n", print_timing); printf(" number of threads %d \n", nthreads); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/parallel/test_nvector_performance_parallel.c b/benchmarks/nvector/parallel/test_nvector_performance_parallel.c index 343a0cfb54..1504749063 100644 --- a/benchmarks/nvector/parallel/test_nvector_performance_parallel.c +++ b/benchmarks/nvector/parallel/test_nvector_performance_parallel.c @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) printf(" number of MPI procs %d \n", nprocs); } - flag = SUNContext_Create(&comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c b/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c index 1c0bf6591e..1104682956 100644 --- a/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c +++ b/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) printf(" number of MPI procs %d \n", nprocs); } - flag = SUNContext_Create(&comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (flag) return flag; /* set partitioning */ diff --git a/benchmarks/nvector/petsc/test_nvector_performance_petsc.c b/benchmarks/nvector/petsc/test_nvector_performance_petsc.c index 07a35ef5d4..af4ccb5dde 100644 --- a/benchmarks/nvector/petsc/test_nvector_performance_petsc.c +++ b/benchmarks/nvector/petsc/test_nvector_performance_petsc.c @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) ierr = PetscInitializeNoArguments(); CHKERRQ(ierr); - if (SUNContext_Create(&comm, &sunctx)) { + if (SUNContext_Create(comm, &sunctx)) { printf("ERROR: SUNContext_Create returned nonzero\n"); return(-1); } diff --git a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c index 18d7c286d3..1144b3af08 100644 --- a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c +++ b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) printf(" timing on/off %d \n", print_timing); printf(" number of threads %d \n", nthreads); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/serial/test_nvector_performance_serial.c b/benchmarks/nvector/serial/test_nvector_performance_serial.c index 5259de8d18..4da5469929 100644 --- a/benchmarks/nvector/serial/test_nvector_performance_serial.c +++ b/benchmarks/nvector/serial/test_nvector_performance_serial.c @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/cmake/SUNDIALSConfig.cmake.in b/cmake/SUNDIALSConfig.cmake.in index 02108d7b95..ff7dbcf23e 100644 --- a/cmake/SUNDIALSConfig.cmake.in +++ b/cmake/SUNDIALSConfig.cmake.in @@ -55,6 +55,11 @@ endforeach() ### ------- Create TPL imported targets +if("@ENABLE_MPI@" AND NOT TARGET MPI::MPI_C) + set(MPI_C_COMPILER "@MPI_C_COMPILER@") + find_dependency(MPI) +endif() + if("@ENABLE_OPENMP@" AND NOT TARGET OpenMP::OpenMP_C) find_dependency(OpenMP) endif() diff --git a/cmake/SundialsBuildOptionsPre.cmake b/cmake/SundialsBuildOptionsPre.cmake index cc4e7202ea..8560f9e0a0 100644 --- a/cmake/SundialsBuildOptionsPre.cmake +++ b/cmake/SundialsBuildOptionsPre.cmake @@ -84,10 +84,6 @@ if(SUNDIALS_LOGGING_LEVEL GREATER_EQUAL 3) message(WARNING "SUNDIALS built with additional logging turned on, performance may be affected.") endif() -set(DOCSTR "Build SUNDIALS logging with MPI support") -sundials_option(SUNDIALS_LOGGING_ENABLE_MPI BOOL "${DOCSTR}" "OFF" - DEPENDS_ON ENABLE_MPI) - # --------------------------------------------------------------- # Option to use the generic math libraries # --------------------------------------------------------------- diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index b993ec85f5..3e5420f63d 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -414,7 +414,7 @@ endforeach() # =============================================================== foreach(lang ${_SUNDIALS_ENABLED_LANGS}) - if((SUNDIALS_BUILD_WITH_PROFILING OR SUNDIALS_LOGGING_ENABLE_MPI) AND ENABLE_MPI) + if(ENABLE_MPI) if(DEFINED MPI_${lang}_COMPILER) set(_EXAMPLES_${lang}_COMPILER "${MPI_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") endif() diff --git a/cmake/SundialsSetupCuda.cmake b/cmake/SundialsSetupCuda.cmake index d5076aeabb..aa41f5a117 100644 --- a/cmake/SundialsSetupCuda.cmake +++ b/cmake/SundialsSetupCuda.cmake @@ -99,7 +99,7 @@ message(STATUS "CUDA Separable Compilation: ${CMAKE_CUDA_SEPARABLE_COMPILATION}" # Configure compiler for installed examples # =============================================================== -if((SUNDIALS_BUILD_WITH_PROFILING OR SUNDIALS_LOGGING_ENABLE_MPI) AND ENABLE_MPI) +if(ENABLE_MPI) set(_EXAMPLES_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") else() set(_EXAMPLES_CUDA_HOST_COMPILER "${CMAKE_CUDA_HOST_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake index 2717e66bf8..77849e1c08 100644 --- a/cmake/macros/SundialsAddLibrary.cmake +++ b/cmake/macros/SundialsAddLibrary.cmake @@ -201,7 +201,7 @@ macro(sundials_add_library target) if(${_libtype} MATCHES "STATIC") target_compile_definitions(${obj_target} PRIVATE SUNDIALS_STATIC_DEFINE) else() - target_compile_definitions(${obj_target} PRIVATE sundials_generic_EXPORTS) + target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS) endif() # add all other compile definitions to object library @@ -268,16 +268,6 @@ macro(sundials_add_library target) target_link_libraries(${_actual_target_name} ${sundials_add_library_LINK_LIBRARIES}) endif() - if(SUNDIALS_BUILD_WITH_PROFILING OR SUNDIALS_LOGGING_ENABLE_MPI) - if(ENABLE_MPI AND MPI_C_FOUND) - # Workaround issues with sundials_generic object library dependency on - # MPI not getting propagated when building examples. - # Workaround bug in CMake < 3.17.3 when using MPI::MPI_C and CUDA - target_include_directories(${_actual_target_name} PUBLIC ${MPI_C_INCLUDE_DIRS}) - target_link_libraries(${_actual_target_name} PUBLIC ${MPI_C_LIBRARIES}) - endif() - endif() - if(SUNDIALS_BUILD_WITH_PROFILING) if(ENABLE_CALIPER) target_link_libraries(${_actual_target_name} PUBLIC caliper) @@ -306,7 +296,7 @@ macro(sundials_add_library target) if(${_libtype} MATCHES "STATIC") target_compile_definitions(${_actual_target_name} PRIVATE SUNDIALS_STATIC_DEFINE) else() - target_compile_definitions(${obj_target} PRIVATE sundials_generic_EXPORTS) + target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS) endif() # add all other compile definitions diff --git a/doc/arkode/guide/source/Introduction.rst b/doc/arkode/guide/source/Introduction.rst index d3c360604a..714e058c15 100644 --- a/doc/arkode/guide/source/Introduction.rst +++ b/doc/arkode/guide/source/Introduction.rst @@ -133,10 +133,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including diff --git a/doc/arkode/guide/source/Usage/General.rst b/doc/arkode/guide/source/Usage/General.rst index 5d6a421db8..be9a7adf43 100644 --- a/doc/arkode/guide/source/Usage/General.rst +++ b/doc/arkode/guide/source/Usage/General.rst @@ -207,4 +207,3 @@ linear solver were performed using the ARKBBDPRE module, the header initialization routines. -.. include:: ../../../../shared/Types.rst diff --git a/doc/arkode/guide/source/index.rst b/doc/arkode/guide/source/index.rst index 4d4828f787..e4931cd988 100644 --- a/doc/arkode/guide/source/index.rst +++ b/doc/arkode/guide/source/index.rst @@ -66,7 +66,7 @@ with support by the `US Department of Energy `_, sunnonlinsol/index.rst sunadaptcontroller/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants Butcher History_link.rst diff --git a/doc/arkode/guide/source/sundials/Install_link.rst b/doc/arkode/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/arkode/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/cvodes/guide/source/Install_link.rst b/doc/arkode/guide/source/sundials/Types_link.rst similarity index 89% rename from doc/cvodes/guide/source/Install_link.rst rename to doc/arkode/guide/source/sundials/Types_link.rst index d4b7e443e4..e7ba90159d 100644 --- a/doc/cvodes/guide/source/Install_link.rst +++ b/doc/arkode/guide/source/sundials/Types_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../../shared/Install.rst +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/arkode/guide/source/sundials/index.rst b/doc/arkode/guide/source/sundials/index.rst index 2957bb9751..bdd0dd42a4 100644 --- a/doc/arkode/guide/source/sundials/index.rst +++ b/doc/arkode/guide/source/sundials/index.rst @@ -23,6 +23,7 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + Types_link SUNContext_link Logging_link Profiling_link diff --git a/doc/cvode/guide/source/Introduction.rst b/doc/cvode/guide/source/Introduction.rst index 0317eb050d..5060e825fe 100644 --- a/doc/cvode/guide/source/Introduction.rst +++ b/doc/cvode/guide/source/Introduction.rst @@ -114,10 +114,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including diff --git a/doc/cvode/guide/source/Usage/index.rst b/doc/cvode/guide/source/Usage/index.rst index 2ea0337a4b..aeeb9bba8e 100644 --- a/doc/cvode/guide/source/Usage/index.rst +++ b/doc/cvode/guide/source/Usage/index.rst @@ -88,7 +88,6 @@ include directories, respectively. For a default installation, these are the directory where SUNDIALS was installed (:numref:`Installation`). -.. include:: ../../../../shared/Types.rst .. _CVODE.Usage.CC.header_sim: diff --git a/doc/cvode/guide/source/index.rst b/doc/cvode/guide/source/index.rst index c13c02825c..a7aa7ebfbf 100644 --- a/doc/cvode/guide/source/index.rst +++ b/doc/cvode/guide/source/index.rst @@ -34,7 +34,7 @@ CVODE Documentation sunlinsol/index.rst sunnonlinsol/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants History_link.rst References diff --git a/doc/cvode/guide/source/sundials/Install_link.rst b/doc/cvode/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/cvode/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/ida/guide/source/Install_link.rst b/doc/cvode/guide/source/sundials/Types_link.rst similarity index 89% rename from doc/ida/guide/source/Install_link.rst rename to doc/cvode/guide/source/sundials/Types_link.rst index d4b7e443e4..e7ba90159d 100644 --- a/doc/ida/guide/source/Install_link.rst +++ b/doc/cvode/guide/source/sundials/Types_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../../shared/Install.rst +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/cvode/guide/source/sundials/index.rst b/doc/cvode/guide/source/sundials/index.rst index f63bd5bdc5..ce4c431116 100644 --- a/doc/cvode/guide/source/sundials/index.rst +++ b/doc/cvode/guide/source/sundials/index.rst @@ -23,6 +23,7 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + Types_link SUNContext_link Logging_link Profiling_link diff --git a/doc/cvodes/guide/source/Introduction.rst b/doc/cvodes/guide/source/Introduction.rst index 812dccbf2c..57d2cfd3c3 100644 --- a/doc/cvodes/guide/source/Introduction.rst +++ b/doc/cvodes/guide/source/Introduction.rst @@ -114,10 +114,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including diff --git a/doc/cvodes/guide/source/Usage/SIM.rst b/doc/cvodes/guide/source/Usage/SIM.rst index 2a14eb3635..3a6ae26c96 100644 --- a/doc/cvodes/guide/source/Usage/SIM.rst +++ b/doc/cvodes/guide/source/Usage/SIM.rst @@ -96,7 +96,6 @@ the directory where SUNDIALS was installed (:numref:`Installation`). .. _CVODES.Usage.SIM.data_types: -.. include:: ../../../../shared/Types.rst .. _CVODES.Usage.SIM.header_sim: diff --git a/doc/cvodes/guide/source/index.rst b/doc/cvodes/guide/source/index.rst index e57d173d8f..3e1757466c 100644 --- a/doc/cvodes/guide/source/index.rst +++ b/doc/cvodes/guide/source/index.rst @@ -35,7 +35,7 @@ CVODES Documentation sunlinsol/index.rst sunnonlinsol/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants History_link.rst References diff --git a/doc/cvodes/guide/source/sundials/Install_link.rst b/doc/cvodes/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/cvodes/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/cvodes/guide/source/sundials/Types_link.rst b/doc/cvodes/guide/source/sundials/Types_link.rst new file mode 100644 index 0000000000..e7ba90159d --- /dev/null +++ b/doc/cvodes/guide/source/sundials/Types_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/cvodes/guide/source/sundials/index.rst b/doc/cvodes/guide/source/sundials/index.rst index 086e679a30..6ade5454c9 100644 --- a/doc/cvodes/guide/source/sundials/index.rst +++ b/doc/cvodes/guide/source/sundials/index.rst @@ -23,6 +23,7 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + Types_link SUNContext_link Logging_link Profiling_link diff --git a/doc/ida/guide/source/Introduction.rst b/doc/ida/guide/source/Introduction.rst index 156155a3c6..f445c88c8e 100644 --- a/doc/ida/guide/source/Introduction.rst +++ b/doc/ida/guide/source/Introduction.rst @@ -75,10 +75,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including diff --git a/doc/ida/guide/source/Usage/index.rst b/doc/ida/guide/source/Usage/index.rst index 2b38d456ab..0e5f4e14d3 100644 --- a/doc/ida/guide/source/Usage/index.rst +++ b/doc/ida/guide/source/Usage/index.rst @@ -81,7 +81,6 @@ respectively, where ``instdir`` is the directory where SUNDIALS was installed (see :numref:`Installation`). -.. include:: ../../../../shared/Types.rst .. _IDA.Usage.CC.header_sim: diff --git a/doc/ida/guide/source/index.rst b/doc/ida/guide/source/index.rst index 45084ae134..0610802d46 100644 --- a/doc/ida/guide/source/index.rst +++ b/doc/ida/guide/source/index.rst @@ -35,7 +35,7 @@ IDA Documentation sunlinsol/index.rst sunnonlinsol/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants History_link.rst References diff --git a/doc/ida/guide/source/sundials/Install_link.rst b/doc/ida/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/ida/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/ida/guide/source/sundials/Types_link.rst b/doc/ida/guide/source/sundials/Types_link.rst new file mode 100644 index 0000000000..e7ba90159d --- /dev/null +++ b/doc/ida/guide/source/sundials/Types_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/ida/guide/source/sundials/index.rst b/doc/ida/guide/source/sundials/index.rst index a2444b5579..45322eced1 100644 --- a/doc/ida/guide/source/sundials/index.rst +++ b/doc/ida/guide/source/sundials/index.rst @@ -23,6 +23,7 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + Types_link SUNContext_link Logging_link Profiling_link diff --git a/doc/idas/guide/source/Install_link.rst b/doc/idas/guide/source/Install_link.rst deleted file mode 100644 index d4b7e443e4..0000000000 --- a/doc/idas/guide/source/Install_link.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. ---------------------------------------------------------------- - SUNDIALS Copyright Start - Copyright (c) 2002-2023, Lawrence Livermore National Security - and Southern Methodist University. - All rights reserved. - - See the top-level LICENSE and NOTICE files for details. - - SPDX-License-Identifier: BSD-3-Clause - SUNDIALS Copyright End - ---------------------------------------------------------------- - -.. include:: ../../../shared/Install.rst diff --git a/doc/idas/guide/source/Introduction.rst b/doc/idas/guide/source/Introduction.rst index d66845b2c7..a03511c959 100644 --- a/doc/idas/guide/source/Introduction.rst +++ b/doc/idas/guide/source/Introduction.rst @@ -89,10 +89,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including @@ -1719,7 +1752,7 @@ The structure of this document is as follows: (:numref:`IDAS.Mathematics.rootfinding`). * The following chapter describes the structure of the SUNDIALS suite of solvers - (:numref:`Organization`) and the software organization of the IDAS solver + (:numref:`IDAS.Organization`) and the software organization of the IDAS solver (:numref:`IDAS.Organization.IDAS`). * Chapter :numref:`IDAS.Usage.SIM` is the main usage document for IDAS diff --git a/doc/idas/guide/source/Organization.rst b/doc/idas/guide/source/Organization.rst index 8e029a2077..acc94ac191 100644 --- a/doc/idas/guide/source/Organization.rst +++ b/doc/idas/guide/source/Organization.rst @@ -10,7 +10,7 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. _Organization: +.. _IDAS.Organization: ***************** Code Organization diff --git a/doc/idas/guide/source/index.rst b/doc/idas/guide/source/index.rst index cfeeb519a8..0589b94e5a 100644 --- a/doc/idas/guide/source/index.rst +++ b/doc/idas/guide/source/index.rst @@ -35,7 +35,7 @@ IDAS Documentation sunlinsol/index.rst sunnonlinsol/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants History_link.rst References diff --git a/doc/idas/guide/source/sundials/Install_link.rst b/doc/idas/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/idas/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/idas/guide/source/sundials/Types_link.rst b/doc/idas/guide/source/sundials/Types_link.rst index 85f0ca82e8..e7ba90159d 100644 --- a/doc/idas/guide/source/sundials/Types_link.rst +++ b/doc/idas/guide/source/sundials/Types_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../../../shared/Types.rst +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/idas/guide/source/sundials/index.rst b/doc/idas/guide/source/sundials/index.rst index 11c6919b0a..136010f1da 100644 --- a/doc/idas/guide/source/sundials/index.rst +++ b/doc/idas/guide/source/sundials/index.rst @@ -16,7 +16,7 @@ Using SUNDIALS ************** -As discussed in :numref:`Organization`, the all SUNDIALS packages are built upon +As discussed in :numref:`IDAS.Organization`, the all SUNDIALS packages are built upon a common set of interfaces for vectors, matrices, and algebraic solvers. In addition, the packages all leverage some other common infrastructure discussed in this section. diff --git a/doc/install_guide/source/Install_link.rst b/doc/install_guide/source/Install_link.rst index d4b435d454..eaa35c5f95 100644 --- a/doc/install_guide/source/Install_link.rst +++ b/doc/install_guide/source/Install_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../shared/Install.rst +.. include:: ../../shared/sundials/Install.rst diff --git a/doc/kinsol/guide/source/Install_link.rst b/doc/kinsol/guide/source/Install_link.rst deleted file mode 100644 index d4b7e443e4..0000000000 --- a/doc/kinsol/guide/source/Install_link.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. ---------------------------------------------------------------- - SUNDIALS Copyright Start - Copyright (c) 2002-2023, Lawrence Livermore National Security - and Southern Methodist University. - All rights reserved. - - See the top-level LICENSE and NOTICE files for details. - - SPDX-License-Identifier: BSD-3-Clause - SUNDIALS Copyright End - ---------------------------------------------------------------- - -.. include:: ../../../shared/Install.rst diff --git a/doc/kinsol/guide/source/Introduction.rst b/doc/kinsol/guide/source/Introduction.rst index f5e42fc180..ecf66a4a0d 100644 --- a/doc/kinsol/guide/source/Introduction.rst +++ b/doc/kinsol/guide/source/Introduction.rst @@ -91,10 +91,43 @@ Changes from previous versions Changes in vX.X.X ----------------- +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to an ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 _`. + +**Breaking change** +The SUNLogger is now always MPI-aware if MPI is enabled in SUNDIALS and the +``SUNDIALS_LOGGING_ENABLE_MPI`` CMake option and macro definition were removed +accordingly. + **Breaking change** Functions, types and header files that were previously deprecated have been removed. +**Breaking change** +Users now need to link to ``sundials_core`` in addition to the libraries already linked to. +This will be picked up automatically in projects that use the SUNDIALS CMake target. The library ``sundials_generic`` has been superceded by ``sundials_core`` and is no longer available. +This fixes some duplicate symbol errors on Windows when linking to multiple SUNDIALS libraries. + The previously deprecated types ``realtype`` and ``booleantype`` were removed from ``sundials_types.h`` and replaced with ``sunrealtype`` and ``sunbooleantype``. The deprecated names for these types can be used by including diff --git a/doc/kinsol/guide/source/Usage/index.rst b/doc/kinsol/guide/source/Usage/index.rst index e0f384b7c7..4e09a661bc 100644 --- a/doc/kinsol/guide/source/Usage/index.rst +++ b/doc/kinsol/guide/source/Usage/index.rst @@ -82,7 +82,6 @@ respectively, where ``instdir`` is the directory where SUNDIALS was installed (see :numref:`Installation`). -.. include:: ../../../../shared/Types.rst .. _KINSOL.Usage.CC.header_sim: diff --git a/doc/kinsol/guide/source/index.rst b/doc/kinsol/guide/source/index.rst index 0c9ba8908f..7fa6bdc52c 100644 --- a/doc/kinsol/guide/source/index.rst +++ b/doc/kinsol/guide/source/index.rst @@ -34,7 +34,7 @@ KINSOL Documentation sunmatrix/index.rst sunlinsol/index.rst sunmemory/index.rst - Install_link.rst + sundials/Install_link.rst Constants History_link.rst References diff --git a/doc/kinsol/guide/source/sundials/Install_link.rst b/doc/kinsol/guide/source/sundials/Install_link.rst new file mode 100644 index 0000000000..ce1563551f --- /dev/null +++ b/doc/kinsol/guide/source/sundials/Install_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Install.rst diff --git a/doc/kinsol/guide/source/sundials/Types_link.rst b/doc/kinsol/guide/source/sundials/Types_link.rst new file mode 100644 index 0000000000..e7ba90159d --- /dev/null +++ b/doc/kinsol/guide/source/sundials/Types_link.rst @@ -0,0 +1,13 @@ +.. ---------------------------------------------------------------- + SUNDIALS Copyright Start + Copyright (c) 2002-2023, Lawrence Livermore National Security + and Southern Methodist University. + All rights reserved. + + See the top-level LICENSE and NOTICE files for details. + + SPDX-License-Identifier: BSD-3-Clause + SUNDIALS Copyright End + ---------------------------------------------------------------- + +.. include:: ../../../../shared/sundials/Types.rst diff --git a/doc/kinsol/guide/source/sundials/index.rst b/doc/kinsol/guide/source/sundials/index.rst index 3401e5a732..bcfd6630eb 100644 --- a/doc/kinsol/guide/source/sundials/index.rst +++ b/doc/kinsol/guide/source/sundials/index.rst @@ -23,6 +23,7 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + Types_link SUNContext_link Logging_link Profiling_link diff --git a/doc/kinsol/guide/source/sunmatrix/SUNMatrix_links.rst b/doc/kinsol/guide/source/sunmatrix/SUNMatrix_links.rst index 9b9b1add97..85332ee21c 100644 --- a/doc/kinsol/guide/source/sunmatrix/SUNMatrix_links.rst +++ b/doc/kinsol/guide/source/sunmatrix/SUNMatrix_links.rst @@ -19,6 +19,6 @@ .. include:: ../../../../shared/sunmatrix/SUNMatrix_cuSparse.rst .. include:: ../../../../shared/sunmatrix/SUNMatrix_Sparse.rst .. include:: ../../../../shared/sunmatrix/SUNMatrix_SLUNRloc.rst -.. include:: ../../../../shared/sunlinsol/SUNMatrix_Ginkgo.rst +.. include:: ../../../../shared/sunmatrix/SUNMatrix_Ginkgo.rst .. include:: ../../../../shared/sunmatrix/SUNMatrix_KokkosDense.rst .. include:: ../../../../shared/sunmatrix/SUNMatrix_Examples.rst diff --git a/doc/shared/nvectors/NVector_Description.rst b/doc/shared/nvectors/NVector_Description.rst index 67a0435065..a3b666ef92 100644 --- a/doc/shared/nvectors/NVector_Description.rst +++ b/doc/shared/nvectors/NVector_Description.rst @@ -54,10 +54,10 @@ defined as N_Vector (*nvcloneempty)(N_Vector); void (*nvdestroy)(N_Vector); void (*nvspace)(N_Vector, sunindextype *, sunindextype *); - sunrealtype* (*nvgetarraypointer)(N_Vector); - sunrealtype* (*nvgetdevicearraypointer)(N_Vector); + sunrealtype* (*nvgetarraypointer)(N_Vector); + sunrealtype* (*nvgetdevicearraypointer)(N_Vector); void (*nvsetarraypointer)(sunrealtype *, N_Vector); - void* (*nvgetcommunicator)(N_Vector); + SUNComm (*nvgetcommunicator)(N_Vector); sunindextype (*nvgetlength)(N_Vector); sunindextype (*nvgetlocallength)(N_Vector); void (*nvlinearsum)(sunrealtype, N_Vector, sunrealtype, N_Vector, N_Vector); diff --git a/doc/shared/nvectors/NVector_Operations.rst b/doc/shared/nvectors/NVector_Operations.rst index eb5c287131..06cf87f4b8 100644 --- a/doc/shared/nvectors/NVector_Operations.rst +++ b/doc/shared/nvectors/NVector_Operations.rst @@ -152,17 +152,20 @@ operations below. N_VSetArrayPointer(vdata,v); -.. c:function:: void* N_VGetCommunicator(N_Vector v) +.. c:function:: SUNComm N_VGetCommunicator(N_Vector v) - Returns a pointer to the ``MPI_Comm`` object associated with the - vector (if applicable). For MPI-unaware vector implementations, this - should return ``NULL``. + Returns the :c:type:`SUNComm` (which is just an ``MPI_Comm`` when SUNDIALS is built + with MPI, otherwise it is an ``int``) associated with the vector (if + applicable). For MPI-unaware vector implementations, this should return + ``SUN_COMM_NULL``. Usage: .. code-block:: c - commptr = N_VGetCommunicator(v); + MPI_Comm comm = N_VGetCommunicator(v); // Works if MPI is enabled + int comm = N_VGetCommunicator(v); // Works if MPI is disabled + SUNComm comm = N_VGetCommunicator(v); // Works with or without MPI .. c:function:: sunindextype N_VGetLength(N_Vector v) diff --git a/doc/shared/Install.rst b/doc/shared/sundials/Install.rst similarity index 96% rename from doc/shared/Install.rst rename to doc/shared/sundials/Install.rst index 0c44d10d87..bac92bd11a 100644 --- a/doc/shared/Install.rst +++ b/doc/shared/sundials/Install.rst @@ -14,22 +14,30 @@ .. _Installation: -====================== -Installation Procedure -====================== +Acquiring SUNDIALS +================== -The installation of any SUNDIALS package is accomplished by installing the -SUNDIALS suite as a whole, according to the instructions that follow. The same -procedure applies whether or not the downloaded file contains one or all solvers -in SUNDIALS. +There are two supported ways for building and installing SUNDIALS from +source. One option is to use the `Spack HPC package manager `_: -The SUNDIALS suite (or individual solvers) are distributed as compressed -archives (``.tar.gz``). The name of the distribution archive is of the form +.. code-block:: bash + + spack install sundials + +The second supported option for building and installing SUNDIALS is with CMake. +Before proceeding with CMake, the source code must be downloaded. This can be done +by cloning the `SUNDIALS GitHub repository `_ +(run ``git clone https://github.com/LLNL/sundials``), or by downloading the +SUNDIALS release compressed archives (``.tar.gz``) from the SUNDIALS +`website `_. + +The compressed archives allow for downloading of indvidual SUNDIALS packages. +The name of the distribution archive is of the form ``SOLVER-X.Y.Z.tar.gz``, where ``SOLVER`` is one of: ``sundials``, ``cvode``, ``cvodes``, ``arkode``, ``ida``, ``idas``, or ``kinsol``, and ``X.Y.Z`` represents the version number (of the SUNDIALS suite or of the individual -solver). To begin the installation, first uncompress and expand the sources, by -issuing +solver). After downloading the relevant archives, uncompress and expand the sources, +by running .. code-block:: bash @@ -84,8 +92,8 @@ and :numref:`Installation.Results`. .. _Installation.CMake: -CMake-based installation -====================================== +Building and Installing with CMake +================================== CMake-based installation provides a platform-independent build system. CMake can generate Unix and Linux Makefiles, as well as KDevelop, Visual Studio, and @@ -994,19 +1002,6 @@ illustration only. Default: 0 -.. cmakeoption:: SUNDIALS_LOGGING_ENABLE_MPI - - Enables MPI support in the SUNLogger runtime API. I.e., makes the logger MPI - aware and capable of outputting only on specific ranks. - - Default: ``OFF`` - - .. note:: - - The logger may be used in an MPI application without MPI support turned on, - but it will output on all ranks. - - .. cmakeoption:: SUNDIALS_BUILD_WITH_MONITORING Build SUNDIALS with capabilties for fine-grained monitoring of solver progress @@ -1647,11 +1642,10 @@ dependencies for your project. - .. _Installation.Results: Installed libraries and exported header files -==================================================== +--------------------------------------------- Using the CMake SUNDIALS build system, the command @@ -1672,12 +1666,41 @@ the table below. The file extension ``.LIB`` is typically table names are relative to ``LIBDIR`` for libraries and to ``INCLUDEDIR`` for header files. -A typical user program need not explicitly include any of the shared SUNDIALS -header files from under the ``INCLUDEDIR/include/sundials`` directory since they -are explicitly included by the appropriate solver header files (e.g., -``sunlinsol_dense.h`` includes ``sundials_dense.h``). However, it is both legal and -safe to do so, and would be useful, for example, if the functions declared in -``sundials_dense.h`` are to be used in building a preconditioner. + +Using SUNDIALS in your prpject +------------------------------ + +After building and installing SUNDIALS, using SUNDIALS in your application involves +two steps: including the right header files and linking to the right libraries. + +Depending on what features of SUNDIALS that your application uses, the header +files needed will vary. For example, if you want to use CVODE for serial computations +you need the following includes: + +.. code-block:: c + + #include + #include + +If you wanted to use CVODE with the GMRES linear solver and our CUDA +enabled vector: + +.. code-block:: c + + #include + #include + #include + +The story is similar for linking to SUNDIALS. Starting in v7.0.0, all +applications will need to link to ``libsundials_core``. Furthermore, depending +on the packages and modules of SUNDIALS of interest an application will need to +link to a few more libraries. Using the same examples as for the includes, we +would need to also link to ``libsundials_cvode``, ``libsundials_nvecserial`` for +the first example and ``libsundials_cvode``, ``libsundials_nveccuda``, +``libsundials_sunlinsolspgmr`` for the second. + +Refer to the documentations sections for the individual packages and modules of +SUNDIALS that interest you for the proper includes and libraries to link to. Using SUNDIALS as a Third Party Library in other CMake Projects @@ -1716,14 +1739,20 @@ configuration file to build against SUNDIALS in their own CMake project. target_link_libraries(myexec PUBLIC SUNDIALS::cvode SUNDIALS::nvecpetsc) +Table of SUNDIALS libraries and header files +-------------------------------------------- + .. _Installation.Table: .. tabularcolumns:: |\Y{0.3}|\Y{0.2}|\Y{0.5}| .. table:: SUNDIALS shared libraries and header files + :align: center +------------------------------+--------------+----------------------------------------------+ - | Shared | Headers | ``sundials/sundials_band.h`` | + | Core | Libraries | ``libsundials_core.LIB`` | + | +--------------+----------------------------------------------+ + | | Headers | ``sundials/sundials_band.h`` | | | +----------------------------------------------+ | | | ``sundials/sundials_config.h`` | | | +----------------------------------------------+ diff --git a/doc/shared/sundials/Logging.rst b/doc/shared/sundials/Logging.rst index fbb427800f..5cef9ee2f8 100644 --- a/doc/shared/sundials/Logging.rst +++ b/doc/shared/sundials/Logging.rst @@ -32,11 +32,15 @@ set to a value greater than ``0`` when configuring SUNDIALS. This option specifies the maximum desired output level. See the documentation entry for :cmakeop:`SUNDIALS_LOGGING_LEVEL` for the numeric values correspond to errors, warnings, info output, and debug output where errors < warnings < info -output < debug output < extra debug output. If it is desired that the logger is -MPI-aware, then the option :cmakeop:`SUNDIALS_LOGGING_ENABLE_MPI` is set to -``TRUE``. More details in regards to configuring SUNDIALS with CMake can be +output < debug output < extra debug output. +More details in regards to configuring SUNDIALS with CMake can be found in :numref:`Installation`. +.. note:: + + As of version 7.0.0, enabling MPI in SUNDIALS enables MPI-aware logging. + + When SUNDIALS is built with logging enabled, then the default logger (stored in the :c:type:`SUNContext` object) may be configured through environment variables without any changes to user code. The available environment variables are: @@ -119,13 +123,12 @@ functions to identify the output level or file. The :c:type:`SUNLogger` class provides the following methods. -.. c:function:: int SUNLogger_Create(void* comm, int output_rank, SUNLogger* logger) +.. c:function:: int SUNLogger_Create(SUNComm comm, int output_rank, SUNLogger* logger) Creates a new :c:type:`SUNLogger` object. **Arguments:** - * ``comm`` -- a pointer to the MPI communicator if MPI is enabled, - otherwise can be ``NULL``. + * ``comm`` -- the MPI communicator to use, if MPI is enabled, otherwise can be ``SUN_COMM_NULL``. * ``output_rank`` -- the MPI rank used for output (can be ``-1`` to print to all ranks). * ``logger`` -- [in,out] On input this is a pointer to a @@ -136,7 +139,7 @@ The :c:type:`SUNLogger` class provides the following methods. * Returns zero if successful, or non-zero if an error occurred. -.. c:function:: int SUNLogger_CreateFromEnv(void* comm, SUNLogger* logger) +.. c:function:: int SUNLogger_CreateFromEnv(SUNComm comm, SUNLogger* logger) Creates a new :c:type:`SUNLogger` object and opens the output streams/files from the environment variables: @@ -149,8 +152,7 @@ The :c:type:`SUNLogger` class provides the following methods. SUNLOGGER_DEBUG_FILENAME **Arguments:** - * ``comm`` -- a pointer to the MPI communicator if MPI is enabled, - otherwise can be ``NULL``. + * ``comm`` -- the MPI communicator to use, if MPI is enabled, otherwise can be ``SUN_COMM_NULL``. * ``logger`` -- [in,out] On input this is a pointer to a :c:type:`SUNLogger`, on output it will point to a new :c:type:`SUNLogger` instance. diff --git a/doc/shared/sundials/Profiling.rst b/doc/shared/sundials/Profiling.rst index 4695643f29..32404a28ed 100644 --- a/doc/shared/sundials/Profiling.rst +++ b/doc/shared/sundials/Profiling.rst @@ -106,12 +106,12 @@ In addition to the macros, the following methods of the ``SUNProfiler`` class are available. -.. c:function:: int SUNProfiler_Create(void* comm, const char* title, SUNProfiler* p) +.. c:function:: int SUNProfiler_Create(SUNComm comm, const char* title, SUNProfiler* p) Creates a new ``SUNProfiler`` object. **Arguments:** - * ``comm`` -- a pointer to the MPI communicator if MPI is enabled, otherwise can be ``NULL`` + * ``comm`` -- the MPI communicator to use, if MPI is enabled, otherwise can be ``SUN_COMM_NULL``. * ``title`` -- a title or description of the profiler * ``p`` -- [in,out] On input this is a pointer to a ``SUNProfiler``, on output it will point to a new ``SUNProfiler`` instance @@ -218,7 +218,7 @@ It is applicable to any of the SUNDIALS solver packages. SUNProfiler profobj; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); /* Get a reference to the profiler */ retval = SUNContext_GetProfiler(ctx, &profobj); diff --git a/doc/shared/sundials/SUNContext.rst b/doc/shared/sundials/SUNContext.rst index 1cdcd8b097..27e18af93f 100644 --- a/doc/shared/sundials/SUNContext.rst +++ b/doc/shared/sundials/SUNContext.rst @@ -29,13 +29,13 @@ The :c:type:`SUNContext` class/type is defined in the header file Users should create a :c:type:`SUNContext` object prior to any other calls to SUNDIALS library functions by calling: -.. c:function:: int SUNContext_Create(void* comm, SUNContext* ctx) +.. c:function:: int SUNContext_Create(SUNComm comm, SUNContext* ctx) Creates a :c:type:`SUNContext` object associated with the thread of execution. The data of the :c:type:`SUNContext` class is private. **Arguments**: - * ``comm`` -- a pointer to the MPI communicator or NULL if not using MPI. + * ``comm`` -- the MPI communicator or ``SUN_COMM_NULL`` if not using MPI. * ``ctx`` -- [in,out] upon successful exit, a pointer to the newly created :c:type:`SUNContext` object. @@ -51,7 +51,7 @@ routines for different SUNDIALS classes/modules e.g., void* package_mem; N_Vector x; - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); package_mem = CVodeCreate(..., sunctx); package_mem = IDACreate(..., sunctx); @@ -250,7 +250,7 @@ For C++ users a RAII safe class, ``sundials::Context``, is provided: class Context : public sundials::ConvertibleTo { public: - explicit Context(void* comm = nullptr) + explicit Context(SUNComm comm = SUN_COMM_NULL) { sunctx_ = std::make_unique(); SUNContext_Create(comm, sunctx_.get()); diff --git a/doc/shared/Types.rst b/doc/shared/sundials/Types.rst similarity index 88% rename from doc/shared/Types.rst rename to doc/shared/sundials/Types.rst index 59c24d4931..30f6b997e2 100644 --- a/doc/shared/Types.rst +++ b/doc/shared/sundials/Types.rst @@ -10,12 +10,16 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. _Usage.CC.DataTypes: +.. _SUNDIALS.DataTypes: Data Types ----------- +========== -The header file ``sundials_types.h`` contains the definition of the types: +SUNDIALS defines several data types in the header file ``sundials_types.h``. +These types are used in the SUNDIALS API and internally in SUNDIALS. It is +not necessary to use these types in your application, but the type must +be compatible with the SUNDIALS types in the API when calling SUNDIALS functions. +The types that are defined are: * :c:type:`sunrealtype` -- the floating-point type used by the SUNDIALS packages @@ -25,8 +29,11 @@ The header file ``sundials_types.h`` contains the definition of the types: * :c:type:`SUNOutputFormat` -- an enumerated type for SUNDIALS output formats +* :c:type:`SUNComm` -- a simple typedef to an `int` when SUNDIALS is built without MPI, or a ``MPI_Comm`` when built with MPI. + + Floating point types -~~~~~~~~~~~~~~~~~~~~ +-------------------- .. c:type:: sunrealtype @@ -80,7 +87,7 @@ code can use SUNDIALS without modifying the code to use ``sunrealtype``, to use the corresponding precision (see :numref:`Installation.CMake.Options`). Integer types used for indexing -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------------- .. c:type:: sunindextype @@ -108,7 +115,7 @@ SUNDIALS libraries use the appropriate index storage type (for details see :numref:`Installation.CMake.Options`). Boolean type -~~~~~~~~~~~~ +------------ .. c:type:: sunbooleantype @@ -121,7 +128,7 @@ int and boolean data. Variables of type ``sunbooleantype`` are intended to have only the two values ``SUNFALSE`` (``0``) and ``SUNTRUE`` (``1``). Output formatting type -~~~~~~~~~~~~~~~~~~~~~~ +---------------------- .. c:enum:: SUNOutputFormat @@ -142,3 +149,13 @@ Output formatting type The file ``scripts/sundials_csv.py`` provides python utility functions to read and output the data from a SUNDIALS CSV output file using the key and value pair format. + +MPI types +--------- + +.. c:type:: SUNComm + + A simple typedef to an `int` when SUNDIALS is built without MPI, or a + ``MPI_Comm`` when built with MPI. This type exists solely to ensure SUNDIALS + can support MPI and non-MPI builds. + \ No newline at end of file diff --git a/doc/shared/sundials/index.rst b/doc/shared/sundials/index.rst index e05e57e016..27469652be 100644 --- a/doc/shared/sundials/index.rst +++ b/doc/shared/sundials/index.rst @@ -23,6 +23,9 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + + Install + Types SUNContext Logging Profiling diff --git a/doc/shared/sunlinsol/SUNLinSol_KLU.rst b/doc/shared/sunlinsol/SUNLinSol_KLU.rst index 4c505492e9..5fa33140c7 100644 --- a/doc/shared/sunlinsol/SUNLinSol_KLU.rst +++ b/doc/shared/sunlinsol/SUNLinSol_KLU.rst @@ -234,7 +234,7 @@ that SUNDIALS has been configured appropriately to link with KLU Additionally, this wrapper only supports double-precision calculations, and therefore cannot be compiled if SUNDIALS is configured to have :c:type:`sunrealtype` set to either ``extended`` or -``single`` (see :ref:`Usage.CC.DataTypes` for +``single`` (see :numref:`SUNDIALS.DataTypes` for details). Since the KLU library supports both 32-bit and 64-bit integers, this interface will be compiled for either of the available :c:type:`sunindextype` options. diff --git a/doc/shared/sunlinsol/SUNLinSol_LapackBand.rst b/doc/shared/sunlinsol/SUNLinSol_LapackBand.rst index a253b3b669..51cfd17dc8 100644 --- a/doc/shared/sunlinsol/SUNLinSol_LapackBand.rst +++ b/doc/shared/sunlinsol/SUNLinSol_LapackBand.rst @@ -110,7 +110,7 @@ the LAPACK band matrix factorization and solve routines, ``*GBTRF`` and ``*GBTRS``, where ``*`` is either ``D`` or ``S``, depending on whether SUNDIALS was configured to have :c:type:`sunrealtype` set to ``double`` or ``single``, respectively (see -:numref:`Usage.CC.DataTypes` for details). +:numref:`SUNDIALS.DataTypes` for details). In order to use the SUNLinSol_LapackBand module it is assumed that LAPACK has been installed on the system prior to installation of SUNDIALS, and that SUNDIALS has been configured appropriately to diff --git a/doc/shared/sunlinsol/SUNLinSol_LapackDense.rst b/doc/shared/sunlinsol/SUNLinSol_LapackDense.rst index ef152f6350..57c3f1dca5 100644 --- a/doc/shared/sunlinsol/SUNLinSol_LapackDense.rst +++ b/doc/shared/sunlinsol/SUNLinSol_LapackDense.rst @@ -106,7 +106,7 @@ the LAPACK dense matrix factorization and solve routines, ``*GETRF`` and ``*GETRS``, where ``*`` is either ``D`` or ``S``, depending on whether SUNDIALS was configured to have :c:type:`sunrealtype` set to ``double`` or ``single``, respectively (see -:numref:`Usage.CC.DataTypes` for details). In order to use the +:numref:`SUNDIALS.DataTypes` for details). In order to use the SUNLinSol_LapackDense module it is assumed that LAPACK has been installed on the system prior to installation of SUNDIALS, and that SUNDIALS has been configured appropriately to diff --git a/doc/shared/sunlinsol/SUNLinSol_SuperLUMT.rst b/doc/shared/sunlinsol/SUNLinSol_SuperLUMT.rst index 2bafac815b..371159d84f 100644 --- a/doc/shared/sunlinsol/SUNLinSol_SuperLUMT.rst +++ b/doc/shared/sunlinsol/SUNLinSol_SuperLUMT.rst @@ -178,7 +178,7 @@ appropriately to link with SuperLU_MT (see Additionally, this wrapper only supports single- and double-precision calculations, and therefore cannot be compiled if SUNDIALS is configured to have :c:type:`sunrealtype` set to ``extended`` -(see :numref:`Usage.CC.DataTypes` for details). Moreover, +(see :numref:`SUNDIALS.DataTypes` for details). Moreover, since the SuperLU_MT library may be installed to support either 32-bit or 64-bit integers, it is assumed that the SuperLU_MT library is installed using the same integer precision as the SUNDIALS diff --git a/doc/superbuild/source/Install_link.rst b/doc/superbuild/source/Install_link.rst deleted file mode 100644 index d4b435d454..0000000000 --- a/doc/superbuild/source/Install_link.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. ---------------------------------------------------------------- - SUNDIALS Copyright Start - Copyright (c) 2002-2023, Lawrence Livermore National Security - and Southern Methodist University. - All rights reserved. - - See the top-level LICENSE and NOTICE files for details. - - SPDX-License-Identifier: BSD-3-Clause - SUNDIALS Copyright End - ---------------------------------------------------------------- - -.. include:: ../../shared/Install.rst diff --git a/doc/superbuild/source/index.rst b/doc/superbuild/source/index.rst index 62298bc824..e10497e729 100644 --- a/doc/superbuild/source/index.rst +++ b/doc/superbuild/source/index.rst @@ -41,7 +41,6 @@ SUNDIALS is developed on `GitHub `_. sunnonlinsol/index.rst sunadaptcontroller/index.rst sunmemory/index.rst - Install_link.rst History_link.rst developers/index.rst References diff --git a/doc/cvode/guide/source/Install_link.rst b/doc/superbuild/source/sundials/Install_link.rst similarity index 89% rename from doc/cvode/guide/source/Install_link.rst rename to doc/superbuild/source/sundials/Install_link.rst index d4b7e443e4..14b189b43d 100644 --- a/doc/cvode/guide/source/Install_link.rst +++ b/doc/superbuild/source/sundials/Install_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../../shared/Install.rst +.. include:: ../../../shared/sundials/Install.rst diff --git a/doc/arkode/guide/source/Install_link.rst b/doc/superbuild/source/sundials/Types_link.rst similarity index 89% rename from doc/arkode/guide/source/Install_link.rst rename to doc/superbuild/source/sundials/Types_link.rst index d4b7e443e4..050ce0cbc1 100644 --- a/doc/arkode/guide/source/Install_link.rst +++ b/doc/superbuild/source/sundials/Types_link.rst @@ -10,4 +10,4 @@ SUNDIALS Copyright End ---------------------------------------------------------------- -.. include:: ../../../shared/Install.rst +.. include:: ../../../shared/sundials/Types.rst diff --git a/doc/superbuild/source/sundials/index.rst b/doc/superbuild/source/sundials/index.rst index 0b6799bff3..8e651b2ecd 100644 --- a/doc/superbuild/source/sundials/index.rst +++ b/doc/superbuild/source/sundials/index.rst @@ -23,6 +23,10 @@ six packages all leverage some other common infrastructure, which we discuss in this section. .. toctree:: + :maxdepth: 1 + + Install_link + Types_link SUNContext_link Profiling_link Logging_link diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1b36807e19..65684dfe18 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -14,6 +14,23 @@ # examples level CMakeLists.txt for SUNDIALS # --------------------------------------------------------------- +# We need this to ensure the installed templates have MPI when ENABLE_MPI=TRUE, +# at least until we convert all of the templates to use the SUNDIALS CMake target. + +# =============================================================== +# Configure compilers for installed examples +# =============================================================== + +foreach(lang ${_SUNDIALS_ENABLED_LANGS}) + if(ENABLE_MPI) + if(DEFINED MPI_${lang}_COMPILER) + set(_EXAMPLES_${lang}_COMPILER "${MPI_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + endif() + else() + set(_EXAMPLES_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + endif() +endforeach() + # Set variables used in generating CMake and Makefiles for examples if(EXAMPLES_INSTALL) @@ -22,9 +39,9 @@ if(EXAMPLES_INSTALL) set(exec_prefix "${CMAKE_INSTALL_PREFIX}") set(includedir "${prefix}/include") set(libdir "${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") - set(CPP "${_EXAMPLES_C_COMPILER}") - set(CPPFLAGS "${CMAKE_C_FLAGS_RELEASE}") - set(CC "${_EXAMPLES_C_COMPILER}") + set(CPP "${CMAKE_CXX_COMPILER}") + set(CPPFLAGS "${CMAKE_CXX_FLAGS_RELEASE}") + set(CC "${CMAKE_C_COMPILER}") set(CFLAGS "${CMAKE_C_FLAGS_RELEASE}") set(LDFLAGS "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") list2string(EXE_EXTRA_LINK_LIBS LIBS) @@ -52,36 +69,26 @@ if(EXAMPLES_INSTALL) list2string(LAPACK_LIBRARIES LAPACK_LIBS) endif() - if(MPI_C_FOUND) - if(MPI_C_COMPILER) - set(MPICC "${MPI_C_COMPILER}") - set(MPI_INC_DIR ".") - set(MPI_LIB_DIR ".") - set(MPI_LIBS "") - set(MPI_FLAGS "") - else() - set(MPICC "${_EXAMPLES_C_COMPILER}") - set(MPI_INC_DIR "${MPI_INCLUDE_PATH}") - set(MPI_LIB_DIR ".") - list2string(MPI_LIBRARIES MPI_LIBS) - endif() + if(HYPRE_FOUND) set(HYPRE_INC_DIR "${HYPRE_INCLUDE_DIR}") set(HYPRE_LIB_DIR "${HYPRE_LIBRARY_DIR}") set(HYPRE_LIBS "${HYPRE_LIBRARIES}") endif() + if(MPI_C_FOUND) + set(MPICC "${MPI_C_COMPILER}") + set(MPI_INC_DIR ".") + set(MPI_LIB_DIR ".") + set(MPI_LIBS "") + set(MPI_FLAGS "") + endif() + if(MPI_CXX_FOUND) - if(MPI_CXX_COMPILER) - set(MPICXX "${MPI_CXX_COMPILER}") - else() - set(MPICXX "${_EXAMPLEX_CXX_COMPILER}") - list2string(MPI_LIBRARIES MPI_LIBS) - endif() + set(MPICXX "${MPI_CXX_COMPILER}") endif() endif() - #---------------------------------------- # Add specific examples #---------------------------------------- diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp index 23944a3d55..132d6ab3c3 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp +++ b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) /* Create SUNDIALS context */ SUNContext ctx; - retval = SUNContext_Create(&comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) MPI_Abort(comm, 1); /* Add scope to destroy objects before MPIFinalize */ @@ -1105,10 +1105,7 @@ SUNNonlinearSolver TaskLocalNewton(SUNContext ctx, N_Vector y) NLS->content = content; /* Fill general content */ - tmp_comm = N_VGetCommunicator(y); - if (tmp_comm == NULL) { SUNNonlinSolFree(NLS); return NULL; } - - content->comm = *((MPI_Comm*) tmp_comm); + content->comm = N_VGetCommunicator(y); if (content->comm == MPI_COMM_NULL) { SUNNonlinSolFree(NLS); return NULL; } content->local_nls = SUNNonlinSol_Newton(N_VGetLocalVector_MPIPlusX(y), ctx); diff --git a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp index 9e2ca43a9b..9e375cd578 100644 --- a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp +++ b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp @@ -472,7 +472,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation. SUNContext ctx = NULL; MPI_Comm comm = MPI_COMM_WORLD; - SUNContext_Create((void*) &comm, &ctx); + SUNContext_Create(comm, &ctx); // MPI process ID int myid; diff --git a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp index cda3dde1df..b1062fb113 100644 --- a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp +++ b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp @@ -297,7 +297,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create((void*) &comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp index 1b068b6dde..ea22692540 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp @@ -380,7 +380,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp index e5f28fc9a6..df138e678a 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp @@ -338,7 +338,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp index de71ae3410..d377597098 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_imex.cpp @@ -341,7 +341,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // Create SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp index 28a226c42e..cd4c13b64b 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg_mri.cpp @@ -348,7 +348,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // Create SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition diff --git a/examples/arkode/CXX_serial/ark_analytic_sys.cpp b/examples/arkode/CXX_serial/ark_analytic_sys.cpp index fa7bb0b4c5..0083b7aaef 100644 --- a/examples/arkode/CXX_serial/ark_analytic_sys.cpp +++ b/examples/arkode/CXX_serial/ark_analytic_sys.cpp @@ -119,7 +119,7 @@ int main() SUNLogger logger = NULL; if (SUNDIALS_LOGGING_LEVEL >= SUN_LOGLEVEL_ERROR) { flag = SUNLogger_Create( - NULL, // no MPI communicator + SUN_COMM_NULL, // no MPI communicator 0, // output on process 0 (the only one) &logger ); diff --git a/examples/arkode/CXX_serial/ark_heat2D.cpp b/examples/arkode/CXX_serial/ark_heat2D.cpp index 2bebfd8da6..8bf03c49a6 100644 --- a/examples/arkode/CXX_serial/ark_heat2D.cpp +++ b/examples/arkode/CXX_serial/ark_heat2D.cpp @@ -215,7 +215,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // --------------- diff --git a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp index 1d9fe00536..2f35316ca0 100644 --- a/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp +++ b/examples/arkode/CXX_superludist/ark_brusselator1D_FEM_sludist.cpp @@ -196,7 +196,7 @@ int main(int argc, char *argv[]) { // Create the SUNDIALS context object for this simulation SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* This example only allows 1 MPI rank because we are demonstrating diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp index e36f3c06e5..f4cdf5e590 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp @@ -374,7 +374,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp index 66dca0e734..7820bf9d0d 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp @@ -331,7 +331,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp index c94fb5b278..8634ee23b9 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_xbraid.cpp @@ -263,7 +263,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c index 94c6ae8220..812c83e4ca 100644 --- a/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c +++ b/examples/arkode/C_manyvector/ark_brusselator1D_manyvec.c @@ -133,7 +133,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate udata structure */ diff --git a/examples/arkode/C_openmp/ark_brusselator1D_omp.c b/examples/arkode/C_openmp/ark_brusselator1D_omp.c index 78a2c8bbb0..1f53312141 100644 --- a/examples/arkode/C_openmp/ark_brusselator1D_omp.c +++ b/examples/arkode/C_openmp/ark_brusselator1D_omp.c @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate udata structure */ diff --git a/examples/arkode/C_openmp/ark_heat1D_omp.c b/examples/arkode/C_openmp/ark_heat1D_omp.c index 586f0c2037..4fc619b71a 100644 --- a/examples/arkode/C_openmp/ark_heat1D_omp.c +++ b/examples/arkode/C_openmp/ark_heat1D_omp.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* set the number of threads to use */ diff --git a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c index a25d8ffbdb..f5735e7b01 100644 --- a/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_analytic_nonlin_ompdev.c @@ -78,7 +78,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial problem output */ diff --git a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c index 5ffda25392..07202be151 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_adapt_ompdev.c @@ -131,7 +131,7 @@ int main() { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* get host and offloading device */ diff --git a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c index 8f9e9145b1..205a7768ff 100644 --- a/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c +++ b/examples/arkode/C_openmpdev/ark_heat1D_ompdev.c @@ -104,7 +104,7 @@ int main() { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate and fill udata structure */ diff --git a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c index 3e1863376a..21ab8b02c8 100644 --- a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c +++ b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) /* Start timing */ starttime = MPI_Wtime(); - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) MPI_Abort(comm, 1); /* Allocate user data structure */ @@ -1163,7 +1163,6 @@ int TaskLocalNewton_GetNumConvFails(SUNNonlinearSolver NLS, SUNNonlinearSolver TaskLocalNewton(SUNContext ctx, N_Vector y) { - void* tmp_comm; SUNNonlinearSolver NLS; TaskLocalNewton_Content content; @@ -1199,10 +1198,7 @@ SUNNonlinearSolver TaskLocalNewton(SUNContext ctx, N_Vector y) NLS->content = content; /* Fill general content */ - tmp_comm = N_VGetCommunicator(y); - if (tmp_comm == NULL) { SUNNonlinSolFree(NLS); return NULL; } - - content->comm = *((MPI_Comm*) tmp_comm); + content->comm = N_VGetCommunicator(y); if (content->comm == MPI_COMM_NULL) { SUNNonlinSolFree(NLS); return NULL; } content->local_nls = SUNNonlinSol_Newton(N_VGetLocalVector_MPIPlusX(y), ctx); diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c index c5a82ece7a..44f3c350c0 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_bbd_p.c @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - flag = SUNContext_Create((void*) &comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/arkode/C_parallel/ark_diurnal_kry_p.c b/examples/arkode/C_parallel/ark_diurnal_kry_p.c index 93224a455b..0e0e9c5e37 100644 --- a/examples/arkode/C_parallel/ark_diurnal_kry_p.c +++ b/examples/arkode/C_parallel/ark_diurnal_kry_p.c @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - flag = SUNContext_Create((void*) &comm, &ctx); + flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index 9e1377b783..feb2f15a0c 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation */ - flag = SUNContext_Create(&comm, &sunctx); + flag = SUNContext_Create(comm, &sunctx); if (check_flag(&flag, "SUNContext_Create", 1, my_pe)) return 1; /* Set local length */ diff --git a/examples/arkode/C_petsc/ark_petsc_ex25.c b/examples/arkode/C_petsc/ark_petsc_ex25.c index 2d88255774..925a5cb9d1 100644 --- a/examples/arkode/C_petsc/ark_petsc_ex25.c +++ b/examples/arkode/C_petsc/ark_petsc_ex25.c @@ -91,7 +91,7 @@ int main(int argc, char **argv) ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; /* Create SUNDIALS context */ - ierr = SUNContext_Create(&comm, &ctx); + ierr = SUNContext_Create(comm, &ctx); if (ierr) return ierr; /* Solution start and end time */ diff --git a/examples/arkode/C_serial/ark_KrylovDemo_prec.c b/examples/arkode/C_serial/ark_KrylovDemo_prec.c index 37acdbbf43..13fa0de786 100644 --- a/examples/arkode/C_serial/ark_KrylovDemo_prec.c +++ b/examples/arkode/C_serial/ark_KrylovDemo_prec.c @@ -256,7 +256,7 @@ int main(int argc, char* argv[]) /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Retrieve the command-line options */ diff --git a/examples/arkode/C_serial/ark_analytic.c b/examples/arkode/C_serial/ark_analytic.c index 18190e1a3a..74f610d536 100644 --- a/examples/arkode/C_serial/ark_analytic.c +++ b/examples/arkode/C_serial/ark_analytic.c @@ -84,7 +84,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial diagnostics output */ diff --git a/examples/arkode/C_serial/ark_analytic_mels.c b/examples/arkode/C_serial/ark_analytic_mels.c index 86dc78d0e2..9c218d7362 100644 --- a/examples/arkode/C_serial/ark_analytic_mels.c +++ b/examples/arkode/C_serial/ark_analytic_mels.c @@ -84,7 +84,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Initial diagnostics output */ diff --git a/examples/arkode/C_serial/ark_analytic_nonlin.c b/examples/arkode/C_serial/ark_analytic_nonlin.c index c55fae9bc0..201b38b396 100644 --- a/examples/arkode/C_serial/ark_analytic_nonlin.c +++ b/examples/arkode/C_serial/ark_analytic_nonlin.c @@ -69,7 +69,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial problem output */ diff --git a/examples/arkode/C_serial/ark_brusselator.c b/examples/arkode/C_serial/ark_brusselator.c index ae0b41cbcb..3a6fc6d112 100644 --- a/examples/arkode/C_serial/ark_brusselator.c +++ b/examples/arkode/C_serial/ark_brusselator.c @@ -108,7 +108,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* set up the test problem according to the desired test */ diff --git a/examples/arkode/C_serial/ark_brusselator1D.c b/examples/arkode/C_serial/ark_brusselator1D.c index 53d3dac473..5ab390760a 100644 --- a/examples/arkode/C_serial/ark_brusselator1D.c +++ b/examples/arkode/C_serial/ark_brusselator1D.c @@ -126,7 +126,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate udata structure */ diff --git a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c index 6c1496ba1f..d5f1a6839f 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_FEM_slu.c @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* if a command-line argument was supplied, set num_threads */ diff --git a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c index c27b14d8d1..87a51090f1 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_imexmri.c +++ b/examples/arkode/C_serial/ark_brusselator1D_imexmri.c @@ -195,7 +195,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx = NULL; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* diff --git a/examples/arkode/C_serial/ark_brusselator1D_klu.c b/examples/arkode/C_serial/ark_brusselator1D_klu.c index 8063885913..a35343aec5 100644 --- a/examples/arkode/C_serial/ark_brusselator1D_klu.c +++ b/examples/arkode/C_serial/ark_brusselator1D_klu.c @@ -143,7 +143,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate udata structure */ diff --git a/examples/arkode/C_serial/ark_brusselator_1D_mri.c b/examples/arkode/C_serial/ark_brusselator_1D_mri.c index 86445d02f8..fb09c9af5d 100644 --- a/examples/arkode/C_serial/ark_brusselator_1D_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_1D_mri.c @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* allocate udata structure */ diff --git a/examples/arkode/C_serial/ark_brusselator_fp.c b/examples/arkode/C_serial/ark_brusselator_fp.c index 5fe08ea875..5e81266f24 100644 --- a/examples/arkode/C_serial/ark_brusselator_fp.c +++ b/examples/arkode/C_serial/ark_brusselator_fp.c @@ -117,14 +117,14 @@ int main(int argc, char *argv[]) /* create SUNDIALS context and a logger which will record nonlinear solver info (e.g., residual) amongst other things. */ - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; - flag = SUNLogger_Create(NULL, 0, &logger); + flag = SUNLogger_Create(SUN_COMM_NULL, 0, &logger); if (check_flag(&flag, "SUNLogger_Create", 1)) return 1; if (monitor) { - flag = SUNLogger_SetInfoFilename(logger, info_fname); + flag = SUNLogger_SetInfoFilename(logger, info_fname); if (check_flag(&flag, "SUNLogger_SetInfoFilename", 1)) return 1; } diff --git a/examples/arkode/C_serial/ark_brusselator_mri.c b/examples/arkode/C_serial/ark_brusselator_mri.c index ddbecfe557..c7d2d7cac9 100644 --- a/examples/arkode/C_serial/ark_brusselator_mri.c +++ b/examples/arkode/C_serial/ark_brusselator_mri.c @@ -89,7 +89,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Set up the test problem parameters */ diff --git a/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c b/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c index 359f458f17..5fde8a5bd0 100644 --- a/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c +++ b/examples/arkode/C_serial/ark_conserved_exp_entropy_ark.c @@ -202,7 +202,7 @@ int main(int argc, char* argv[]) * ------------ */ /* Create the SUNDIALS context object for this simulation */ - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(flag, "SUNContext_Create")) return 1; /* Create serial vector and set the initial condition values */ diff --git a/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c b/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c index a13add2ac3..979e6a3da5 100644 --- a/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c +++ b/examples/arkode/C_serial/ark_conserved_exp_entropy_erk.c @@ -184,7 +184,7 @@ int main(int argc, char* argv[]) * ------------ */ /* Create the SUNDIALS context object for this simulation */ - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(flag, "SUNContext_Create")) return 1; /* Create serial vector and set the initial condition values */ diff --git a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c index 91deec32bd..2caa8dee54 100644 --- a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) dTout = (Tf - T0) / ((sunrealtype)num_output_times); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) { return 1; } printf("\n Begin time-dependent damped harmonic oscillator problem\n\n"); diff --git a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c index dbb62ec83e..78e09991c5 100644 --- a/examples/arkode/C_serial/ark_dissipated_exp_entropy.c +++ b/examples/arkode/C_serial/ark_dissipated_exp_entropy.c @@ -182,7 +182,7 @@ int main(int argc, char* argv[]) * ------------ */ /* Create the SUNDIALS context object for this simulation */ - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(flag, "SUNContext_Create")) return 1; /* Create serial vector and set the initial condition values */ diff --git a/examples/arkode/C_serial/ark_harmonic_symplectic.c b/examples/arkode/C_serial/ark_harmonic_symplectic.c index 88704c21a2..314e42662d 100644 --- a/examples/arkode/C_serial/ark_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_harmonic_symplectic.c @@ -103,7 +103,7 @@ int main(int argc, char* argv[]) /* Default problem parameters */ /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; printf("\n Begin simple harmonic oscillator problem\n\n"); diff --git a/examples/arkode/C_serial/ark_heat1D.c b/examples/arkode/C_serial/ark_heat1D.c index 7e36c58cec..3ff145660d 100644 --- a/examples/arkode/C_serial/ark_heat1D.c +++ b/examples/arkode/C_serial/ark_heat1D.c @@ -96,7 +96,7 @@ int main() { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate and fill udata structure */ diff --git a/examples/arkode/C_serial/ark_heat1D_adapt.c b/examples/arkode/C_serial/ark_heat1D_adapt.c index 867092bc13..f28bb88923 100644 --- a/examples/arkode/C_serial/ark_heat1D_adapt.c +++ b/examples/arkode/C_serial/ark_heat1D_adapt.c @@ -119,7 +119,7 @@ int main() { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* allocate and fill initial udata structure */ diff --git a/examples/arkode/C_serial/ark_kepler.c b/examples/arkode/C_serial/ark_kepler.c index d3a98e36bb..47a882e324 100644 --- a/examples/arkode/C_serial/ark_kepler.c +++ b/examples/arkode/C_serial/ark_kepler.c @@ -468,7 +468,7 @@ int main(int argc, char* argv[]) int retval = 0; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) { return 1; } /* Parse the command line arguments */ diff --git a/examples/arkode/C_serial/ark_kpr_mri.c b/examples/arkode/C_serial/ark_kpr_mri.c index d7ce20680b..0492786315 100644 --- a/examples/arkode/C_serial/ark_kpr_mri.c +++ b/examples/arkode/C_serial/ark_kpr_mri.c @@ -268,7 +268,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Create and initialize serial vector for the solution */ diff --git a/examples/arkode/C_serial/ark_onewaycouple_mri.c b/examples/arkode/C_serial/ark_onewaycouple_mri.c index 96ca69f08a..f7fda7d114 100644 --- a/examples/arkode/C_serial/ark_onewaycouple_mri.c +++ b/examples/arkode/C_serial/ark_onewaycouple_mri.c @@ -103,7 +103,7 @@ int main() /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx = NULL; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Set the initial contions */ diff --git a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c index 0716c41ef0..18b90be06e 100644 --- a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c +++ b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c @@ -107,7 +107,7 @@ int main() { /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* diff --git a/examples/arkode/C_serial/ark_robertson.c b/examples/arkode/C_serial/ark_robertson.c index 8d85c7e110..ae40e2850d 100644 --- a/examples/arkode/C_serial/ark_robertson.c +++ b/examples/arkode/C_serial/ark_robertson.c @@ -92,7 +92,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial problem output */ diff --git a/examples/arkode/C_serial/ark_robertson_constraints.c b/examples/arkode/C_serial/ark_robertson_constraints.c index 32e4ca483c..9277ade2db 100644 --- a/examples/arkode/C_serial/ark_robertson_constraints.c +++ b/examples/arkode/C_serial/ark_robertson_constraints.c @@ -97,7 +97,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial problem output */ diff --git a/examples/arkode/C_serial/ark_robertson_root.c b/examples/arkode/C_serial/ark_robertson_root.c index d59a7e0b84..ef5805426a 100644 --- a/examples/arkode/C_serial/ark_robertson_root.c +++ b/examples/arkode/C_serial/ark_robertson_root.c @@ -97,7 +97,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; /* Initial problem output */ diff --git a/examples/arkode/C_serial/ark_twowaycouple_mri.c b/examples/arkode/C_serial/ark_twowaycouple_mri.c index e66ca48a13..7a07544c86 100644 --- a/examples/arkode/C_serial/ark_twowaycouple_mri.c +++ b/examples/arkode/C_serial/ark_twowaycouple_mri.c @@ -82,7 +82,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* diff --git a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 index 1c5252c846..631c0173bd 100644 --- a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 @@ -122,6 +122,7 @@ program main use farkode_mod ! Fortran interface to the ARKode module use farkode_arkstep_mod ! Fortran interface to the ARKStep module use fnvector_complex_mod ! Custom complex N_Vector + use fsundials_types_mod use fsundials_context_mod use ode_mod ! ODE functions @@ -141,7 +142,7 @@ program main !======= Internals ============ ! create the SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! initial problem output print *, " " diff --git a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 index 02cfe67386..80be5881ce 100644 --- a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 @@ -265,6 +265,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use farkode_mod ! Fortran interface to the ARKode module use farkode_arkstep_mod ! Fortran interface to the ARKStep module @@ -300,7 +301,7 @@ program main print '(2(a,es8.1))', " reltol = ",reltol,", abstol = ",abstol ! create the SUNDIALS context for the simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) if (ierr /= 0) then write(*,*) 'Error in FSUNContext_Create' stop 1 diff --git a/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 b/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 index e48c0b7a2d..18fec4df71 100644 --- a/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 +++ b/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 @@ -47,6 +47,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fnvector_complex_mod use fnvector_test_mod @@ -70,7 +71,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! create new vectors, using New, Make and Clone routines sU => FN_VMake_Complex(N, Udata, sunctx) diff --git a/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 index 03a3f79f8f..df202e93e8 100644 --- a/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 @@ -48,6 +48,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fnvector_fortran_mod use fnvector_test_mod @@ -74,7 +75,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! create new vectors, using New, Make and Clone routines allocate(Udata(Nvar,N)) diff --git a/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 index 5a3aa1be2a..1496141b70 100644 --- a/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 @@ -72,6 +72,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fsunlinsol_test_mod @@ -97,7 +98,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! create new matrices and vectors sX => FN_VNew_Fortran(Nvar, N, sunctx) diff --git a/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 index 800ce30353..424ce2ab36 100644 --- a/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 @@ -116,6 +116,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fnvector_fortran_mod use fsunmatrix_test_mod @@ -140,7 +141,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! create new matrices and vectors sW => FN_VNew_Fortran(Nvar, N, sunctx) diff --git a/examples/arkode/F2003_parallel/CMakeLists.txt b/examples/arkode/F2003_parallel/CMakeLists.txt index 734c3e42e1..258f1c9ae5 100644 --- a/examples/arkode/F2003_parallel/CMakeLists.txt +++ b/examples/arkode/F2003_parallel/CMakeLists.txt @@ -16,14 +16,10 @@ # Example lists are tuples "name\;nodes\;tasks\;type" where the # type is develop for examples excluded from 'make test' in releases -if(SUNDIALS_LOGGING_ENABLE_MPI) - set(FARKODE_examples +set(FARKODE_examples "ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2" "ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2" "ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2") -else() - set(FARKODE_examples ) -endif() if(MPI_Fortran_COMPILER) # use MPI wrapper as the compiler @@ -33,17 +29,14 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -# Specify libraries to link against -set(ARKODE_LIBS - sundials_arkode +# Set-up linker flags and link libraries +set(SUNDIALS_LIBS sundials_arkode sundials_farkode_mod sundials_nvecmpiplusx sundials_fnvecmpiplusx_mod sundials_nvecmpimanyvector - sundials_fnvecmpimanyvector_mod) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${ARKODE_LIBS} ${EXE_EXTRA_LINK_LIBS}) + sundials_fnvecmpimanyvector_mod + ${EXE_EXTRA_LINK_LIBS}) # Add the build and install targets for each example foreach(example_tuple ${FARKODE_examples}) @@ -114,10 +107,20 @@ if(EXAMPLES_INSTALL) set(SOLVER "ARKODE") # Makefile: convert semi-colon separated target list to space separated string - list2string(ARKODE_LIBS EXAMPLE_LIBS) + set(EXAMPLE_LIBS_LIST + sundials_farkode_mod + sundials_arkode + sundials_fnvecmpiplusx_mod + sundials_nvecmpiplusx + sundials_fnvecmpimanyvector_mod + sundials_nvecmpimanyvector + sundials_fcore_mod + sundials_core) + + list2string(EXAMPLE_LIBS_LIST EXAMPLE_LIBS) # CMakeLists: replace sundials_ prefix and convert to space separted string - list(TRANSFORM ARKODE_LIBS REPLACE "sundials_" "SUNDIALS::" + list(TRANSFORM EXAMPLE_LIBS_LIST REPLACE "sundials_" "SUNDIALS::" OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) list2string(EXAMPLES_CMAKE_TARGETS_tmp EXAMPLES_CMAKE_TARGETS) diff --git a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 index e3888b5fde..ac996ee2a5 100644 --- a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 @@ -1068,6 +1068,7 @@ program main use fnvector_mpiplusx_mod ! Access MPI+X N_Vector use fnvector_mpimanyvector_mod ! Access MPIManyVector N_Vector use fnvector_serial_mod ! Access serial N_Vector + use fsundials_types_mod use fsundials_context_mod ! Access sundials context use fsundials_logger_mod ! Access SUNLogger @@ -1083,7 +1084,6 @@ program main integer :: ierr ! MPI error status integer(c_int) :: retval ! SUNDIALS error status double precision :: starttime, endtime ! timing variables - integer, pointer :: commptr type(N_Vector), pointer :: sunvec_ys ! sundials serial vector type(N_Vector), pointer :: sunvec_y ! sundials MPI+X vector @@ -1102,8 +1102,7 @@ program main ! Create SUNDIALS simulation context comm = MPI_COMM_WORLD - commptr => comm - retval = FSUNContext_Create(c_loc(commptr), sunctx) + retval = FSUNContext_Create(comm, sunctx) if (retval /= 0) then print *, "Error: FSUNContext_Create returned ",retval call MPI_Abort(comm, 1, ierr) @@ -1121,7 +1120,7 @@ program main ! SUNDIALS will only log up to the max level n, but a lesser level can ! be configured at runtime by only providing output files for the ! desired levels. We will enable informational logging here: - retval = FSUNLogger_Create(c_loc(commptr), 0, logger) + retval = FSUNLogger_Create(comm, 0, logger) if (retval /= 0) then print *, "Error: FSUNLogger_Create returned ",retval call MPI_Abort(comm, 1, ierr) @@ -2286,6 +2285,7 @@ subroutine FreeProblem() !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fsundials_logger_mod use fsundials_nvector_mod diff --git a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 index 1477c35d14..79566081a9 100644 --- a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 @@ -100,6 +100,7 @@ program main use fnvector_serial_mod ! Fortran interface to serial N_Vector use fsunmatrix_dense_mod ! Fortran interface to dense SUNMatrix use fsunlinsol_dense_mod ! Fortran interface to dense SUNLinearSolver + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fsundials_adaptcontroller_mod ! Fortran interface to the generic SUNAdaptController use fsunadaptcontroller_soderlind_mod ! Fortran interface to Soderlind controller @@ -130,7 +131,7 @@ program main !======= Internals ============ ! create the SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 index d965486cb4..ff34928c3a 100644 --- a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 @@ -80,6 +80,7 @@ module ode_mod use fnvector_serial_mod use fsunmatrix_dense_mod use fsunlinsol_dense_mod + use fsundials_types_mod use fsundials_context_mod use fsundials_matrix_mod use fsundials_linearsolver_mod @@ -701,7 +702,7 @@ program main end select ! Create the SUNDIALS context object for this simulation - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(SUN_COMM_NULL, sunctx) call check_retval(retval, 'FSUNContext_Create') ! Create and initialize serial vector for the solution diff --git a/examples/cvode/CXX_parallel/cv_heat2D_p.cpp b/examples/cvode/CXX_parallel/cv_heat2D_p.cpp index b37e77c7b6..c585b05d16 100644 --- a/examples/cvode/CXX_parallel/cv_heat2D_p.cpp +++ b/examples/cvode/CXX_parallel/cv_heat2D_p.cpp @@ -293,7 +293,7 @@ int main(int argc, char* argv[]) void *cvode_mem = NULL; // CVODE memory structure // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // Set output process flag bool outproc = (myid == 0); diff --git a/examples/cvode/CXX_parhyp/cv_heat2D_hypre_ls.cpp b/examples/cvode/CXX_parhyp/cv_heat2D_hypre_ls.cpp index 95578b722d..63b648355c 100644 --- a/examples/cvode/CXX_parhyp/cv_heat2D_hypre_ls.cpp +++ b/examples/cvode/CXX_parhyp/cv_heat2D_hypre_ls.cpp @@ -377,7 +377,7 @@ int main(int argc, char* argv[]) void *cvode_mem = NULL; // CVODE memory structure // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // Set output process flag bool outproc = (myid == 0); diff --git a/examples/cvode/CXX_parhyp/cv_heat2D_hypre_pfmg.cpp b/examples/cvode/CXX_parhyp/cv_heat2D_hypre_pfmg.cpp index dbb2732460..10515d6662 100644 --- a/examples/cvode/CXX_parhyp/cv_heat2D_hypre_pfmg.cpp +++ b/examples/cvode/CXX_parhyp/cv_heat2D_hypre_pfmg.cpp @@ -335,7 +335,7 @@ int main(int argc, char* argv[]) void *cvode_mem = NULL; // CVODE memory structure // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // Set output process flag bool outproc = (myid == 0); diff --git a/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c b/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c index 36cd2c31ce..49674662d2 100644 --- a/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c +++ b/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) local_N = MXSUB*MYSUB; /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate c[0], c[1], u, and set initial values and tolerances */ diff --git a/examples/cvode/C_openmp/cvAdvDiff_bnd_omp.c b/examples/cvode/C_openmp/cvAdvDiff_bnd_omp.c index 9e097f89a2..8c7d7ef4f2 100644 --- a/examples/cvode/C_openmp/cvAdvDiff_bnd_omp.c +++ b/examples/cvode/C_openmp/cvAdvDiff_bnd_omp.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Set the number of threads to use */ diff --git a/examples/cvode/C_openmpdev/cvAdvDiff_kry_ompdev.c b/examples/cvode/C_openmpdev/cvAdvDiff_kry_ompdev.c index 27a0a5230f..c7293141d5 100644 --- a/examples/cvode/C_openmpdev/cvAdvDiff_kry_ompdev.c +++ b/examples/cvode/C_openmpdev/cvAdvDiff_kry_ompdev.c @@ -117,7 +117,7 @@ int main(int argc, char** argv) cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Set model parameters */ diff --git a/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 index 02aa41b818..dd2a7829a1 100644 --- a/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 @@ -93,6 +93,7 @@ program main use, intrinsic :: iso_c_binding use fcvode_mod ! Fortran interface to CVODE + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fsundials_nvector_mod ! Fortran interface to generic N_Vector use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -124,7 +125,7 @@ program main !======= Internals ============ - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 index ec59845edb..f6c7d69df5 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 @@ -122,6 +122,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fcvode_mod ! Fortran interface to CVODE use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -173,7 +174,7 @@ program main yvec(3) = 1.0d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! create a serial vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 index 2fbeca0590..1979608434 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 @@ -173,6 +173,7 @@ program main use, intrinsic :: iso_c_binding use fcvode_mod ! Fortran interface to CVODE + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fnvector_serial_mod ! Fortran interface to serial N_Vector use fsunmatrix_dense_mod ! Fortran interface to dense SUNMatrix @@ -223,7 +224,7 @@ program main yvec(3) = 1.0d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! create SUNDIALS N_Vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 index bd3b36bf0e..1b09b9ce5c 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 @@ -181,6 +181,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fcvode_mod ! Fortran interface to CVODE use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -233,7 +234,7 @@ program main yvec(2) = 1.0d0 yvec(3) = 1.0d0 - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) if (ierr /= 0) then print *, 'ERROR: FSUNContext_Create returned non-zero' stop 1 diff --git a/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 b/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 index 8ce737b570..8bfb9f548e 100644 --- a/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 @@ -155,6 +155,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fcvode_mod ! Fortran interface to CVODE use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -206,7 +207,7 @@ program main yvec(3) = 2.8d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! create SUNDIALS N_Vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/cuda/cvAdvDiff_diag_cuda.cu b/examples/cvode/cuda/cvAdvDiff_diag_cuda.cu index 74589d4d72..6d229c9d4e 100644 --- a/examples/cvode/cuda/cvAdvDiff_diag_cuda.cu +++ b/examples/cvode/cuda/cvAdvDiff_diag_cuda.cu @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) usefused = 0; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); if (argc >= 2) { diff --git a/examples/cvode/cuda/cvAdvDiff_kry_cuda_managed.cu b/examples/cvode/cuda/cvAdvDiff_kry_cuda_managed.cu index 13df5a617a..789e263e19 100644 --- a/examples/cvode/cuda/cvAdvDiff_kry_cuda_managed.cu +++ b/examples/cvode/cuda/cvAdvDiff_kry_cuda_managed.cu @@ -204,7 +204,7 @@ int main(int argc, char** argv) } /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); SUNCudaThreadDirectExecPolicy stream_exec_policy(256, stream); diff --git a/examples/cvode/cuda/cvRoberts_block_cusolversp_batchqr.cu b/examples/cvode/cuda/cvRoberts_block_cusolversp_batchqr.cu index de8ef27a7d..c9f0894bb3 100644 --- a/examples/cvode/cuda/cvRoberts_block_cusolversp_batchqr.cu +++ b/examples/cvode/cuda/cvRoberts_block_cusolversp_batchqr.cu @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) cusolverSpCreate(&cusol_handle); /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create CUDA vector of length neq for I.C. and abstol */ diff --git a/examples/cvode/parallel/cvAdvDiff_diag_p.c b/examples/cvode/parallel/cvAdvDiff_diag_p.c index 6edd6aa0ff..89452fe03d 100644 --- a/examples/cvode/parallel/cvAdvDiff_diag_p.c +++ b/examples/cvode/parallel/cvAdvDiff_diag_p.c @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create((void*) &comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* This requires that SUNDIALS was configured with the CMake options @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) if (SUNDIALS_LOGGING_LEVEL >= SUN_LOGLEVEL_ERROR) { retval = SUNLogger_Create( - (void*) &comm, // MPI communicator + comm, // MPI communicator 0, // output on process 0 &logger ); diff --git a/examples/cvode/parallel/cvAdvDiff_non_p.c b/examples/cvode/parallel/cvAdvDiff_non_p.c index cbb8768b9e..38eb39718b 100644 --- a/examples/cvode/parallel/cvAdvDiff_non_p.c +++ b/examples/cvode/parallel/cvAdvDiff_non_p.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c b/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c index c14316912e..fa5cb3d3d6 100644 --- a/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c +++ b/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); if (npes != NPEX*NPEY) { diff --git a/examples/cvode/parallel/cvDiurnal_kry_p.c b/examples/cvode/parallel/cvDiurnal_kry_p.c index d56bb58111..1ba4e508bc 100644 --- a/examples/cvode/parallel/cvDiurnal_kry_p.c +++ b/examples/cvode/parallel/cvDiurnal_kry_p.c @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); if (npes != NPEX*NPEY) { diff --git a/examples/cvode/parhyp/cvAdvDiff_non_ph.c b/examples/cvode/parhyp/cvAdvDiff_non_ph.c index 3db5ab43aa..692bd8ca43 100644 --- a/examples/cvode/parhyp/cvAdvDiff_non_ph.c +++ b/examples/cvode/parhyp/cvAdvDiff_non_ph.c @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContex_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set partitioning. */ diff --git a/examples/cvode/petsc/cvAdvDiff_petsc.c b/examples/cvode/petsc/cvAdvDiff_petsc.c index 4cee5d6550..d67a472fab 100644 --- a/examples/cvode/petsc/cvAdvDiff_petsc.c +++ b/examples/cvode/petsc/cvAdvDiff_petsc.c @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) if(check_retval(&retval, "PetscInitialize", 1, my_pe)) MPI_Abort(comm, 1); /* Create SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvode/petsc/cv_petsc_ex7.c b/examples/cvode/petsc/cv_petsc_ex7.c index 38299ef68a..50b8b013fe 100644 --- a/examples/cvode/petsc/cv_petsc_ex7.c +++ b/examples/cvode/petsc/cv_petsc_ex7.c @@ -82,7 +82,7 @@ int main(int argc,char **argv) Initialize program - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; - ierr = SUNContext_Create(&comm, &sunctx);if (ierr) return ierr; + ierr = SUNContext_Create(comm, &sunctx);if (ierr) return ierr; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create distributed array (DMDA) to manage parallel grid and vectors diff --git a/examples/cvode/serial/cvAdvDiff_bnd.c b/examples/cvode/serial/cvAdvDiff_bnd.c index a32dec8b02..ea9de46dfe 100644 --- a/examples/cvode/serial/cvAdvDiff_bnd.c +++ b/examples/cvode/serial/cvAdvDiff_bnd.c @@ -132,7 +132,7 @@ int main(void) sunctx = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Get a reference to the profiler */ diff --git a/examples/cvode/serial/cvAdvDiff_bndL.c b/examples/cvode/serial/cvAdvDiff_bndL.c index b8d1e26524..49c7e5d95c 100644 --- a/examples/cvode/serial/cvAdvDiff_bndL.c +++ b/examples/cvode/serial/cvAdvDiff_bndL.c @@ -125,7 +125,7 @@ int main(void) cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create a serial vector */ diff --git a/examples/cvode/serial/cvAnalytic_mels.c b/examples/cvode/serial/cvAnalytic_mels.c index 980eec302f..0cd8c91a44 100644 --- a/examples/cvode/serial/cvAnalytic_mels.c +++ b/examples/cvode/serial/cvAnalytic_mels.c @@ -85,7 +85,7 @@ int main() long int nst, nfe, nsetups, nje, nfeLS, nni, ncfn, netf; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial diagnostics output */ diff --git a/examples/cvode/serial/cvDirectDemo_ls.c b/examples/cvode/serial/cvDirectDemo_ls.c index cdcfe062a1..5b4b864b13 100644 --- a/examples/cvode/serial/cvDirectDemo_ls.c +++ b/examples/cvode/serial/cvDirectDemo_ls.c @@ -187,7 +187,7 @@ static int Problem1(void) cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); y = N_VNew_Serial(P1_NEQ, sunctx); @@ -409,7 +409,7 @@ static int Problem2(void) cvode_mem = NULL; /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); y = N_VNew_Serial(P2_NEQ, sunctx); diff --git a/examples/cvode/serial/cvDisc_dns.c b/examples/cvode/serial/cvDisc_dns.c index fe13160568..b8adbc9d86 100644 --- a/examples/cvode/serial/cvDisc_dns.c +++ b/examples/cvode/serial/cvDisc_dns.c @@ -68,7 +68,7 @@ int main() t2 = SUN_RCONST(2.0); /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate the vector of initial conditions */ diff --git a/examples/cvode/serial/cvDiurnal_kry.c b/examples/cvode/serial/cvDiurnal_kry.c index 16171449fa..13cb9cbed9 100644 --- a/examples/cvode/serial/cvDiurnal_kry.c +++ b/examples/cvode/serial/cvDiurnal_kry.c @@ -178,7 +178,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/cvode/serial/cvDiurnal_kry_bp.c b/examples/cvode/serial/cvDiurnal_kry_bp.c index 62771cfe95..687fd22040 100644 --- a/examples/cvode/serial/cvDiurnal_kry_bp.c +++ b/examples/cvode/serial/cvDiurnal_kry_bp.c @@ -164,7 +164,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize u, and set problem data and tolerances */ diff --git a/examples/cvode/serial/cvKrylovDemo_ls.c b/examples/cvode/serial/cvKrylovDemo_ls.c index 5133974e18..72a5544a26 100644 --- a/examples/cvode/serial/cvKrylovDemo_ls.c +++ b/examples/cvode/serial/cvKrylovDemo_ls.c @@ -217,14 +217,14 @@ int main(int argc, char* argv[]) /* Create SUNDIALS context and a logger which will record nonlinear solver info (e.g., residual) amongst other things. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; - retval = SUNLogger_Create(NULL, 0, &logger); + retval = SUNLogger_Create(SUN_COMM_NULL, 0, &logger); if (check_retval(&retval, "SUNLogger_Create", 1)) return 1; if (monitor) { - retval = SUNLogger_SetInfoFilename(logger, info_fname); + retval = SUNLogger_SetInfoFilename(logger, info_fname); if (check_retval(&retval, "SUNLogger_SetInfoFilename", 1)) return 1; } @@ -314,7 +314,7 @@ int main(int argc, char* argv[]) left preconditioning and the default maximum Krylov dimension */ LS = SUNLinSol_SPGMR(u, SUN_PREC_LEFT, 0, sunctx); if (check_retval((void *)LS, "SUNLinSol_SPGMR", 0)) return(1); - + retval = CVodeSetLinearSolver(cvode_mem, LS, NULL); if (check_retval(&retval, "CVodeSetLinearSolver", 1)) return 1; @@ -332,7 +332,7 @@ int main(int argc, char* argv[]) left preconditioning and the default maximum Krylov dimension */ LS = SUNLinSol_SPFGMR(u, SUN_PREC_LEFT, 0, sunctx); if (check_retval((void *)LS, "SUNLinSol_SPFGMR", 0)) return(1); - + retval = CVodeSetLinearSolver(cvode_mem, LS, NULL); if (check_retval(&retval, "CVodeSetLinearSolver", 1)) return 1; @@ -350,7 +350,7 @@ int main(int argc, char* argv[]) left preconditioning and the default maximum Krylov dimension */ LS = SUNLinSol_SPBCGS(u, SUN_PREC_LEFT, 0, sunctx); if (check_retval((void *)LS, "SUNLinSol_SPBCGS", 0)) return(1); - + retval = CVodeSetLinearSolver(cvode_mem, LS, NULL); if (check_retval(&retval, "CVodeSetLinearSolver", 1)) return 1; diff --git a/examples/cvode/serial/cvKrylovDemo_prec.c b/examples/cvode/serial/cvKrylovDemo_prec.c index 28fa57da82..ccae5c4969 100644 --- a/examples/cvode/serial/cvKrylovDemo_prec.c +++ b/examples/cvode/serial/cvKrylovDemo_prec.c @@ -254,7 +254,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initializations */ diff --git a/examples/cvode/serial/cvParticle_dns.c b/examples/cvode/serial/cvParticle_dns.c index 10fcd3b911..a45aee060f 100644 --- a/examples/cvode/serial/cvParticle_dns.c +++ b/examples/cvode/serial/cvParticle_dns.c @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) FILE *EFID = NULL; /* error output file */ /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize user data structure */ diff --git a/examples/cvode/serial/cvPendulum_dns.c b/examples/cvode/serial/cvPendulum_dns.c index c9fb2a6115..bf8f3cb41e 100644 --- a/examples/cvode/serial/cvPendulum_dns.c +++ b/examples/cvode/serial/cvPendulum_dns.c @@ -145,7 +145,7 @@ int main(int argc, char* argv[]) SUNLinearSolver LS = NULL; /* linear solver */ /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Read command line inputs */ diff --git a/examples/cvode/serial/cvRoberts_block_klu.c b/examples/cvode/serial/cvRoberts_block_klu.c index b3558a65c9..c5fba80bf0 100644 --- a/examples/cvode/serial/cvRoberts_block_klu.c +++ b/examples/cvode/serial/cvRoberts_block_klu.c @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) udata.ngroups = ngroups; udata.neq = neq; - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "CVodeInit", 1)) return(1); /* Create serial vector of length neq for I.C. and abstol */ diff --git a/examples/cvode/serial/cvRoberts_dns.c b/examples/cvode/serial/cvRoberts_dns.c index af63236d44..19f4a5f949 100644 --- a/examples/cvode/serial/cvRoberts_dns.c +++ b/examples/cvode/serial/cvRoberts_dns.c @@ -135,7 +135,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_dnsL.c b/examples/cvode/serial/cvRoberts_dnsL.c index 5c6e9cf572..bf32af2080 100644 --- a/examples/cvode/serial/cvRoberts_dnsL.c +++ b/examples/cvode/serial/cvRoberts_dnsL.c @@ -123,7 +123,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_dns_constraints.c b/examples/cvode/serial/cvRoberts_dns_constraints.c index 24d73c37ee..5e70227cf5 100644 --- a/examples/cvode/serial/cvRoberts_dns_constraints.c +++ b/examples/cvode/serial/cvRoberts_dns_constraints.c @@ -143,7 +143,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_dns_negsol.c b/examples/cvode/serial/cvRoberts_dns_negsol.c index 4c828a19bf..94a2b32a87 100644 --- a/examples/cvode/serial/cvRoberts_dns_negsol.c +++ b/examples/cvode/serial/cvRoberts_dns_negsol.c @@ -97,7 +97,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_dns_uw.c b/examples/cvode/serial/cvRoberts_dns_uw.c index 6475f7a68d..c966ff65a0 100644 --- a/examples/cvode/serial/cvRoberts_dns_uw.c +++ b/examples/cvode/serial/cvRoberts_dns_uw.c @@ -136,7 +136,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_klu.c b/examples/cvode/serial/cvRoberts_klu.c index eed7b87537..bead669854 100644 --- a/examples/cvode/serial/cvRoberts_klu.c +++ b/examples/cvode/serial/cvRoberts_klu.c @@ -120,7 +120,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRoberts_sps.c b/examples/cvode/serial/cvRoberts_sps.c index cf43b9b80f..073a6268dd 100644 --- a/examples/cvode/serial/cvRoberts_sps.c +++ b/examples/cvode/serial/cvRoberts_sps.c @@ -120,7 +120,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvode/serial/cvRocket_dns.c b/examples/cvode/serial/cvRocket_dns.c index 33a03a659c..743f0accbb 100644 --- a/examples/cvode/serial/cvRocket_dns.c +++ b/examples/cvode/serial/cvRocket_dns.c @@ -125,7 +125,7 @@ int main() ydata = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return (1); diff --git a/examples/cvode/superludist/cvAdvDiff_sludist.cpp b/examples/cvode/superludist/cvAdvDiff_sludist.cpp index f5d5e4f9c6..0877b15196 100644 --- a/examples/cvode/superludist/cvAdvDiff_sludist.cpp +++ b/examples/cvode/superludist/cvAdvDiff_sludist.cpp @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) return(1); /* check for nprow and npcol arguments */ diff --git a/examples/cvodes/C_openmp/cvsAdvDiff_bnd_omp.c b/examples/cvodes/C_openmp/cvsAdvDiff_bnd_omp.c index a4bb4bef9a..8ac7436c63 100644 --- a/examples/cvodes/C_openmp/cvsAdvDiff_bnd_omp.c +++ b/examples/cvodes/C_openmp/cvsAdvDiff_bnd_omp.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) cvode_mem = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Set the number of threads to use */ diff --git a/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 b/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 index 74967c5f8d..b401907fcf 100644 --- a/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 +++ b/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 @@ -184,6 +184,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNDIALS context use fcvodes_mod ! Fortran interface to CVODES use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -214,7 +215,7 @@ program main call ProcessArgs(sensi, sensi_meth, err_con) ! Create SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, ctx) + retval = FSUNContext_Create(SUN_COMM_NULL, ctx) if (retval /= 0) then print *, "Error: FSUNContext_Create returned ",retval stop 1 diff --git a/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 b/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 index 1cd48cb03a..9b0d491019 100644 --- a/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 +++ b/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 @@ -93,6 +93,7 @@ program main use, intrinsic :: iso_c_binding use fcvodes_mod ! Fortran interface to CVODES + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fsundials_nvector_mod ! Fortran interface to generic N_Vector use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -124,7 +125,7 @@ program main !======= Internals ============ - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c b/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c index 4918ba26d9..fdc79428d0 100644 --- a/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c +++ b/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &my_pe); - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); npes = nprocs - 1; /* pe's dedicated to PDE integration */ diff --git a/examples/cvodes/parallel/cvsAdvDiff_FSA_non_p.c b/examples/cvodes/parallel/cvsAdvDiff_FSA_non_p.c index 0726e0d8ed..078a84638e 100644 --- a/examples/cvodes/parallel/cvsAdvDiff_FSA_non_p.c +++ b/examples/cvodes/parallel/cvsAdvDiff_FSA_non_p.c @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, my_pe, &sensi, &sensi_meth, &err_con); /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvodes/parallel/cvsAdvDiff_non_p.c b/examples/cvodes/parallel/cvsAdvDiff_non_p.c index 94218000bd..6b497ebd9b 100644 --- a/examples/cvodes/parallel/cvsAdvDiff_non_p.c +++ b/examples/cvodes/parallel/cvsAdvDiff_non_p.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c b/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c index 28c63f3db1..6314d273c3 100644 --- a/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c +++ b/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &myId); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, myId)) MPI_Abort(comm, 1); /* Check number of processes */ diff --git a/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c b/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c index 23d8fa282f..535c3db451 100644 --- a/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Process arguments */ diff --git a/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c b/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c index 4b45c8a183..e2b4948476 100644 --- a/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/cvodes/parallel/cvsDiurnal_kry_p.c b/examples/cvodes/parallel/cvsDiurnal_kry_p.c index ebc6a0494a..2d97e7511a 100644 --- a/examples/cvodes/parallel/cvsDiurnal_kry_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_kry_p.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/cvodes/serial/cvsAdvDiff_ASAi_bnd.c b/examples/cvodes/serial/cvsAdvDiff_ASAi_bnd.c index 0efcaabd46..0ecbd0d8ae 100644 --- a/examples/cvodes/serial/cvsAdvDiff_ASAi_bnd.c +++ b/examples/cvodes/serial/cvsAdvDiff_ASAi_bnd.c @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) abstol = ATOL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate u vector */ diff --git a/examples/cvodes/serial/cvsAdvDiff_FSA_non.c b/examples/cvodes/serial/cvsAdvDiff_FSA_non.c index 7e084b26e7..b5b2aad55c 100644 --- a/examples/cvodes/serial/cvsAdvDiff_FSA_non.c +++ b/examples/cvodes/serial/cvsAdvDiff_FSA_non.c @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, &sensi, &sensi_meth, &err_con); /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Set user data */ diff --git a/examples/cvodes/serial/cvsAdvDiff_bnd.c b/examples/cvodes/serial/cvsAdvDiff_bnd.c index 70dc04f305..e64c1f636b 100644 --- a/examples/cvodes/serial/cvsAdvDiff_bnd.c +++ b/examples/cvodes/serial/cvsAdvDiff_bnd.c @@ -127,7 +127,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create a serial vector */ diff --git a/examples/cvodes/serial/cvsAdvDiff_bndL.c b/examples/cvodes/serial/cvsAdvDiff_bndL.c index eb3bdd5ac7..c82a219bd2 100644 --- a/examples/cvodes/serial/cvsAdvDiff_bndL.c +++ b/examples/cvodes/serial/cvsAdvDiff_bndL.c @@ -125,7 +125,7 @@ int main(void) cvode_mem = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create a serial vector */ diff --git a/examples/cvodes/serial/cvsAnalytic_mels.c b/examples/cvodes/serial/cvsAnalytic_mels.c index e5b0e019da..e5c0251ba1 100644 --- a/examples/cvodes/serial/cvsAnalytic_mels.c +++ b/examples/cvodes/serial/cvsAnalytic_mels.c @@ -91,7 +91,7 @@ int main() printf(" abstol = %.1"ESYM"\n\n",abstol); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initialize data structures */ diff --git a/examples/cvodes/serial/cvsDirectDemo_ls.c b/examples/cvodes/serial/cvsDirectDemo_ls.c index 59d119b098..4c206b5f84 100644 --- a/examples/cvodes/serial/cvsDirectDemo_ls.c +++ b/examples/cvodes/serial/cvsDirectDemo_ls.c @@ -186,7 +186,7 @@ static int Problem1(void) NLS = NULL; cvode_mem = NULL; - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); y = N_VNew_Serial(P1_NEQ, sunctx); @@ -407,7 +407,7 @@ static int Problem2(void) NLS = NULL; cvode_mem = NULL; - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); y = N_VNew_Serial(P2_NEQ, sunctx); diff --git a/examples/cvodes/serial/cvsDiurnal_FSA_kry.c b/examples/cvodes/serial/cvsDiurnal_FSA_kry.c index 384e490dac..26babee879 100644 --- a/examples/cvodes/serial/cvsDiurnal_FSA_kry.c +++ b/examples/cvodes/serial/cvsDiurnal_FSA_kry.c @@ -208,7 +208,7 @@ int main(int argc, char *argv[]) InitUserData(data); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial states */ diff --git a/examples/cvodes/serial/cvsDiurnal_kry.c b/examples/cvodes/serial/cvsDiurnal_kry.c index ab13d90c44..fdb1c99829 100644 --- a/examples/cvodes/serial/cvsDiurnal_kry.c +++ b/examples/cvodes/serial/cvsDiurnal_kry.c @@ -179,7 +179,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/cvodes/serial/cvsDiurnal_kry_bp.c b/examples/cvodes/serial/cvsDiurnal_kry_bp.c index 0a82e88e09..78fc5981b4 100644 --- a/examples/cvodes/serial/cvsDiurnal_kry_bp.c +++ b/examples/cvodes/serial/cvsDiurnal_kry_bp.c @@ -165,7 +165,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize u, and set problem data and tolerances */ diff --git a/examples/cvodes/serial/cvsFoodWeb_ASAi_kry.c b/examples/cvodes/serial/cvsFoodWeb_ASAi_kry.c index 410e24c591..9c38866737 100644 --- a/examples/cvodes/serial/cvsFoodWeb_ASAi_kry.c +++ b/examples/cvodes/serial/cvsFoodWeb_ASAi_kry.c @@ -267,7 +267,7 @@ int main(int argc, char *argv[]) LS = LSB = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize user data */ diff --git a/examples/cvodes/serial/cvsFoodWeb_ASAp_kry.c b/examples/cvodes/serial/cvsFoodWeb_ASAp_kry.c index 342c46ef09..36a2e27379 100644 --- a/examples/cvodes/serial/cvsFoodWeb_ASAp_kry.c +++ b/examples/cvodes/serial/cvsFoodWeb_ASAp_kry.c @@ -259,7 +259,7 @@ int main(int argc, char *argv[]) LS = LSB = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize user data */ diff --git a/examples/cvodes/serial/cvsHessian_ASA_FSA.c b/examples/cvodes/serial/cvsHessian_ASA_FSA.c index 3d6db9f490..a21fa0e863 100644 --- a/examples/cvodes/serial/cvsHessian_ASA_FSA.c +++ b/examples/cvodes/serial/cvsHessian_ASA_FSA.c @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) abstolQB = 1.0e-8; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initializations for forward problem */ diff --git a/examples/cvodes/serial/cvsKrylovDemo_ls.c b/examples/cvodes/serial/cvsKrylovDemo_ls.c index f9d38416f7..dc2b7aa465 100644 --- a/examples/cvodes/serial/cvsKrylovDemo_ls.c +++ b/examples/cvodes/serial/cvsKrylovDemo_ls.c @@ -213,10 +213,10 @@ int main(int argc, char* argv[]) /* Create SUNDIALS context and a logger which will record nonlinear solver info (e.g., residual) amongst other things. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; - retval = SUNLogger_Create(NULL, 0, &logger); + retval = SUNLogger_Create(SUN_COMM_NULL, 0, &logger); if (check_retval(&retval, "SUNLogger_Create", 1)) return 1; if (monitor) { diff --git a/examples/cvodes/serial/cvsKrylovDemo_prec.c b/examples/cvodes/serial/cvsKrylovDemo_prec.c index f47e869c7e..2a70585984 100644 --- a/examples/cvodes/serial/cvsKrylovDemo_prec.c +++ b/examples/cvodes/serial/cvsKrylovDemo_prec.c @@ -253,7 +253,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initializations */ diff --git a/examples/cvodes/serial/cvsParticle_dns.c b/examples/cvodes/serial/cvsParticle_dns.c index debe2da355..b87a3021c0 100644 --- a/examples/cvodes/serial/cvsParticle_dns.c +++ b/examples/cvodes/serial/cvsParticle_dns.c @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) FILE *EFID = NULL; /* error output file */ /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate and initialize user data structure */ diff --git a/examples/cvodes/serial/cvsPendulum_dns.c b/examples/cvodes/serial/cvsPendulum_dns.c index 66424e4a2b..417ae974cf 100644 --- a/examples/cvodes/serial/cvsPendulum_dns.c +++ b/examples/cvodes/serial/cvsPendulum_dns.c @@ -145,7 +145,7 @@ int main(int argc, char* argv[]) SUNLinearSolver LS = NULL; /* linear solver */ /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Read command line inputs */ diff --git a/examples/cvodes/serial/cvsRoberts_ASAi_dns.c b/examples/cvodes/serial/cvsRoberts_ASAi_dns.c index 611cf8d520..6f625942be 100644 --- a/examples/cvodes/serial/cvsRoberts_ASAi_dns.c +++ b/examples/cvodes/serial/cvsRoberts_ASAi_dns.c @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initialize y */ diff --git a/examples/cvodes/serial/cvsRoberts_ASAi_dns_constraints.c b/examples/cvodes/serial/cvsRoberts_ASAi_dns_constraints.c index 771f4366fa..12b2b50ec7 100644 --- a/examples/cvodes/serial/cvsRoberts_ASAi_dns_constraints.c +++ b/examples/cvodes/serial/cvsRoberts_ASAi_dns_constraints.c @@ -185,7 +185,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initialize y */ diff --git a/examples/cvodes/serial/cvsRoberts_ASAi_klu.c b/examples/cvodes/serial/cvsRoberts_ASAi_klu.c index 3976e69a6b..20041fb294 100644 --- a/examples/cvodes/serial/cvsRoberts_ASAi_klu.c +++ b/examples/cvodes/serial/cvsRoberts_ASAi_klu.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initialize y */ diff --git a/examples/cvodes/serial/cvsRoberts_ASAi_sps.c b/examples/cvodes/serial/cvsRoberts_ASAi_sps.c index 7850ff4249..a2726fe4de 100644 --- a/examples/cvodes/serial/cvsRoberts_ASAi_sps.c +++ b/examples/cvodes/serial/cvsRoberts_ASAi_sps.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initialize y */ diff --git a/examples/cvodes/serial/cvsRoberts_FSA_dns.c b/examples/cvodes/serial/cvsRoberts_FSA_dns.c index bd2863d82f..07a73224c4 100644 --- a/examples/cvodes/serial/cvsRoberts_FSA_dns.c +++ b/examples/cvodes/serial/cvsRoberts_FSA_dns.c @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_FSA_dns_Switch.c b/examples/cvodes/serial/cvsRoberts_FSA_dns_Switch.c index 4dd54b49d2..a8a36cfc66 100644 --- a/examples/cvodes/serial/cvsRoberts_FSA_dns_Switch.c +++ b/examples/cvodes/serial/cvsRoberts_FSA_dns_Switch.c @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ SUNContext sunctx = NULL; - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContextCreate", 1)) return(1); /* Allocate user data structure */ diff --git a/examples/cvodes/serial/cvsRoberts_FSA_dns_constraints.c b/examples/cvodes/serial/cvsRoberts_FSA_dns_constraints.c index a3df89a0bb..2d4a17643c 100644 --- a/examples/cvodes/serial/cvsRoberts_FSA_dns_constraints.c +++ b/examples/cvodes/serial/cvsRoberts_FSA_dns_constraints.c @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_FSA_klu.c b/examples/cvodes/serial/cvsRoberts_FSA_klu.c index 9ab96e9bda..cbd4cffde8 100644 --- a/examples/cvodes/serial/cvsRoberts_FSA_klu.c +++ b/examples/cvodes/serial/cvsRoberts_FSA_klu.c @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_FSA_sps.c b/examples/cvodes/serial/cvsRoberts_FSA_sps.c index 3a801fe037..e2ee02e52c 100644 --- a/examples/cvodes/serial/cvsRoberts_FSA_sps.c +++ b/examples/cvodes/serial/cvsRoberts_FSA_sps.c @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) data->p[2] = SUN_RCONST(3.0e7); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_dns.c b/examples/cvodes/serial/cvsRoberts_dns.c index bd23804f65..b8bd7fb3e7 100644 --- a/examples/cvodes/serial/cvsRoberts_dns.c +++ b/examples/cvodes/serial/cvsRoberts_dns.c @@ -135,7 +135,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_dnsL.c b/examples/cvodes/serial/cvsRoberts_dnsL.c index 6105636d58..0476e834c4 100644 --- a/examples/cvodes/serial/cvsRoberts_dnsL.c +++ b/examples/cvodes/serial/cvsRoberts_dnsL.c @@ -123,7 +123,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_dns_constraints.c b/examples/cvodes/serial/cvsRoberts_dns_constraints.c index 04dc0ffaa3..4d97e4b325 100644 --- a/examples/cvodes/serial/cvsRoberts_dns_constraints.c +++ b/examples/cvodes/serial/cvsRoberts_dns_constraints.c @@ -143,7 +143,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_dns_uw.c b/examples/cvodes/serial/cvsRoberts_dns_uw.c index 4bb3f26ffb..d3b2219118 100644 --- a/examples/cvodes/serial/cvsRoberts_dns_uw.c +++ b/examples/cvodes/serial/cvsRoberts_dns_uw.c @@ -136,7 +136,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_klu.c b/examples/cvodes/serial/cvsRoberts_klu.c index 0d7e58cd7d..f3b9ebf75b 100644 --- a/examples/cvodes/serial/cvsRoberts_klu.c +++ b/examples/cvodes/serial/cvsRoberts_klu.c @@ -120,7 +120,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/cvodes/serial/cvsRoberts_sps.c b/examples/cvodes/serial/cvsRoberts_sps.c index 25b5e48e2c..fbc283658c 100644 --- a/examples/cvodes/serial/cvsRoberts_sps.c +++ b/examples/cvodes/serial/cvsRoberts_sps.c @@ -120,7 +120,7 @@ int main() cvode_mem = NULL; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Initial conditions */ diff --git a/examples/ida/C_openmp/idaFoodWeb_bnd_omp.c b/examples/ida/C_openmp/idaFoodWeb_bnd_omp.c index 97c611db2c..13b966cf82 100644 --- a/examples/ida/C_openmp/idaFoodWeb_bnd_omp.c +++ b/examples/ida/C_openmp/idaFoodWeb_bnd_omp.c @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) num_threads = (int) strtol(argv[1], NULL, 0); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/ida/C_openmp/idaFoodWeb_kry_omp.c b/examples/ida/C_openmp/idaFoodWeb_kry_omp.c index 3dd64eb005..aa55d8183e 100644 --- a/examples/ida/C_openmp/idaFoodWeb_kry_omp.c +++ b/examples/ida/C_openmp/idaFoodWeb_kry_omp.c @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) num_threads = (int) strtol(argv[1], NULL, 0); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 b/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 index b3c3d8a764..0a6b298702 100644 --- a/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 +++ b/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 @@ -214,6 +214,7 @@ program main use, intrinsic :: iso_c_binding use fida_mod ! Fortran interface to IDA + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fnvector_serial_mod ! Fortran interface to serial N_Vector use fsunlinsol_spgmr_mod ! Fortran interface to spgmr SUNLinearSolver @@ -243,7 +244,7 @@ program main real(c_double), dimension(mgrid,mgrid) :: uu, up, res, constraints !======= Internals ============ - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! Assign parameters in dae_mod dx = 1.d0/(mgrid-1) diff --git a/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 b/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 index 73392e6bc4..ea55a34f2a 100644 --- a/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 +++ b/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 @@ -250,6 +250,7 @@ program main use, intrinsic :: iso_c_binding use fida_mod ! Fortran interface to IDA + use fsundials_types_mod use fsundials_context_mod ! Fortran interface to SUNContext use fnvector_serial_mod ! Fortran interface to serial N_Vector use fsunmatrix_dense_mod ! Fortran interface to dense SUNMatrix @@ -282,7 +283,7 @@ program main !======= Internals ============ - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! initialize solution vectors and tolerances yval(1) = 1.d0 diff --git a/examples/ida/cuda/idaHeat2D_kry_cuda.cu b/examples/ida/cuda/idaHeat2D_kry_cuda.cu index 68d0be8607..426c4806bb 100644 --- a/examples/ida/cuda/idaHeat2D_kry_cuda.cu +++ b/examples/ida/cuda/idaHeat2D_kry_cuda.cu @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ - ier = SUNContext_Create(NULL, &ctx); + ier = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&ier, "SUNContext_Create", 1)) return 1; /* Assign parameters in the user data structure. */ diff --git a/examples/ida/mpicuda/idaHeat2D_kry_p_mpicuda.cu b/examples/ida/mpicuda/idaHeat2D_kry_p_mpicuda.cu index a2ad87c3ea..3f36edf803 100644 --- a/examples/ida/mpicuda/idaHeat2D_kry_p_mpicuda.cu +++ b/examples/ida/mpicuda/idaHeat2D_kry_p_mpicuda.cu @@ -349,7 +349,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &thispe); /* Create the SUNDIALS context object for this simulation */ - ier = SUNContext_Create((void*) &comm, &ctx); + ier = SUNContext_Create(comm, &ctx); if (check_flag(&ier, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); diff --git a/examples/ida/mpiraja/idaHeat2D_kry_p_mpiraja.cpp b/examples/ida/mpiraja/idaHeat2D_kry_p_mpiraja.cpp index 5c635297df..4d1b24b230 100644 --- a/examples/ida/mpiraja/idaHeat2D_kry_p_mpiraja.cpp +++ b/examples/ida/mpiraja/idaHeat2D_kry_p_mpiraja.cpp @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &thispe); /* Create the SUNDIALS context object for this simulation. */ - ier = SUNContext_Create((void*) &comm, &ctx); + ier = SUNContext_Create(comm, &ctx); if (check_flag(&ier, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Allocate and initialize the data structure */ diff --git a/examples/ida/parallel/idaFoodWeb_kry_bbd_p.c b/examples/ida/parallel/idaFoodWeb_kry_bbd_p.c index 34fb1fe9ef..c3d3d7ed1c 100644 --- a/examples/ida/parallel/idaFoodWeb_kry_bbd_p.c +++ b/examples/ida/parallel/idaFoodWeb_kry_bbd_p.c @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/ida/parallel/idaFoodWeb_kry_p.c b/examples/ida/parallel/idaFoodWeb_kry_p.c index 9a63a090f0..d8955a77b5 100644 --- a/examples/ida/parallel/idaFoodWeb_kry_p.c +++ b/examples/ida/parallel/idaFoodWeb_kry_p.c @@ -280,7 +280,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/ida/parallel/idaHeat2D_kry_bbd_p.c b/examples/ida/parallel/idaHeat2D_kry_bbd_p.c index 0e1f8eb544..a09692e460 100644 --- a/examples/ida/parallel/idaHeat2D_kry_bbd_p.c +++ b/examples/ida/parallel/idaHeat2D_kry_bbd_p.c @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length local_N and global length Neq. */ diff --git a/examples/ida/parallel/idaHeat2D_kry_p.c b/examples/ida/parallel/idaHeat2D_kry_p.c index 9a504eea16..2ad07d7f34 100644 --- a/examples/ida/parallel/idaHeat2D_kry_p.c +++ b/examples/ida/parallel/idaHeat2D_kry_p.c @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &thispe); /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Allocate and initialize the data structure */ diff --git a/examples/ida/petsc/idaHeat2D_petsc_snes.c b/examples/ida/petsc/idaHeat2D_petsc_snes.c index 518c9bb295..b812cccdb5 100644 --- a/examples/ida/petsc/idaHeat2D_petsc_snes.c +++ b/examples/ida/petsc/idaHeat2D_petsc_snes.c @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) if(check_retval(&ierr, "PetscInitialize", 1, thispe)) MPI_Abort(comm, 1); /* Create SUNDIALS context */ - ierr = SUNContext_Create(&comm, &ctx); + ierr = SUNContext_Create(comm, &ctx); if(check_retval(&ierr, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Initialize user application context */ diff --git a/examples/ida/petsc/idaHeat2D_petsc_spgmr.c b/examples/ida/petsc/idaHeat2D_petsc_spgmr.c index 37d3b744a8..133bd9d342 100644 --- a/examples/ida/petsc/idaHeat2D_petsc_spgmr.c +++ b/examples/ida/petsc/idaHeat2D_petsc_spgmr.c @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) CHKERRQ(ierr); /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Allocate and initialize the data structure and N-vectors. */ diff --git a/examples/ida/raja/idaHeat2D_kry_raja.cpp b/examples/ida/raja/idaHeat2D_kry_raja.cpp index 4e86d6e849..fbf8a8233c 100644 --- a/examples/ida/raja/idaHeat2D_kry_raja.cpp +++ b/examples/ida/raja/idaHeat2D_kry_raja.cpp @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ SUNContext ctx; - ier = SUNContext_Create(NULL, &ctx); + ier = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_flag(&ier, "SUNContext_Create", 1)) return 1; /* Assign parameters in the user data structure. */ diff --git a/examples/ida/serial/idaAnalytic_mels.c b/examples/ida/serial/idaAnalytic_mels.c index 70b1613ffe..97ef418fd7 100644 --- a/examples/ida/serial/idaAnalytic_mels.c +++ b/examples/ida/serial/idaAnalytic_mels.c @@ -92,7 +92,7 @@ int main(void) printf(" abstol = %.1"ESYM"\n\n",abstol); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Initialize data structures */ diff --git a/examples/ida/serial/idaFoodWeb_bnd.c b/examples/ida/serial/idaFoodWeb_bnd.c index fc976c344e..c95f0fdaf4 100644 --- a/examples/ida/serial/idaFoodWeb_bnd.c +++ b/examples/ida/serial/idaFoodWeb_bnd.c @@ -191,7 +191,7 @@ int main() LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/ida/serial/idaFoodWeb_kry.c b/examples/ida/serial/idaFoodWeb_kry.c index fb1eb1c90b..310c121090 100644 --- a/examples/ida/serial/idaFoodWeb_kry.c +++ b/examples/ida/serial/idaFoodWeb_kry.c @@ -209,7 +209,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/ida/serial/idaHeat2D_bnd.c b/examples/ida/serial/idaHeat2D_bnd.c index 38c2ca713e..d0489c1eaa 100644 --- a/examples/ida/serial/idaHeat2D_bnd.c +++ b/examples/ida/serial/idaHeat2D_bnd.c @@ -103,7 +103,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Create vectors uu, up, res, constraints, id. */ diff --git a/examples/ida/serial/idaHeat2D_klu.c b/examples/ida/serial/idaHeat2D_klu.c index 57dacb35f3..af1a3c9fe4 100644 --- a/examples/ida/serial/idaHeat2D_klu.c +++ b/examples/ida/serial/idaHeat2D_klu.c @@ -116,7 +116,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Create vectors uu, up, res, constraints, id. */ diff --git a/examples/ida/serial/idaHeat2D_kry.c b/examples/ida/serial/idaHeat2D_kry.c index 2cd19e6075..1874c2001a 100644 --- a/examples/ida/serial/idaHeat2D_kry.c +++ b/examples/ida/serial/idaHeat2D_kry.c @@ -110,7 +110,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors and the user data structure. */ diff --git a/examples/ida/serial/idaKrylovDemo_ls.c b/examples/ida/serial/idaKrylovDemo_ls.c index 552c3852e5..1353769e83 100644 --- a/examples/ida/serial/idaKrylovDemo_ls.c +++ b/examples/ida/serial/idaKrylovDemo_ls.c @@ -142,7 +142,7 @@ int main(int argc, char* argv[]) /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors and the user data structure. */ diff --git a/examples/ida/serial/idaRoberts_dns.c b/examples/ida/serial/idaRoberts_dns.c index 7732aa4883..331607152d 100644 --- a/examples/ida/serial/idaRoberts_dns.c +++ b/examples/ida/serial/idaRoberts_dns.c @@ -113,7 +113,7 @@ int main(void) NLS = NULL; /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate N-vectors. */ diff --git a/examples/ida/serial/idaRoberts_klu.c b/examples/ida/serial/idaRoberts_klu.c index 50ba414a42..62dbc1ae40 100644 --- a/examples/ida/serial/idaRoberts_klu.c +++ b/examples/ida/serial/idaRoberts_klu.c @@ -100,7 +100,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors. */ diff --git a/examples/ida/serial/idaRoberts_sps.c b/examples/ida/serial/idaRoberts_sps.c index cb2f3fd881..b91cdfeb93 100644 --- a/examples/ida/serial/idaRoberts_sps.c +++ b/examples/ida/serial/idaRoberts_sps.c @@ -95,7 +95,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors. */ diff --git a/examples/ida/serial/idaSlCrank_dns.c b/examples/ida/serial/idaSlCrank_dns.c index 85cf007afd..57bdcd4bfd 100644 --- a/examples/ida/serial/idaSlCrank_dns.c +++ b/examples/ida/serial/idaSlCrank_dns.c @@ -87,7 +87,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data */ diff --git a/examples/ida/trilinos/idaHeat2D_kry_p_tpetra.cpp b/examples/ida/trilinos/idaHeat2D_kry_p_tpetra.cpp index c005349aca..aa2a49b5aa 100644 --- a/examples/ida/trilinos/idaHeat2D_kry_p_tpetra.cpp +++ b/examples/ida/trilinos/idaHeat2D_kry_p_tpetra.cpp @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) MPI_Comm rawComm = *(mpiComm->getRawMpiComm()); SUNContext ctx; - retval = SUNContext_Create((void*) &rawComm, &ctx); + retval = SUNContext_Create(rawComm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) return -1; /* Allocate and initialize the data structure */ diff --git a/examples/ida/trilinos/idaHeat2D_kry_tpetra.cpp b/examples/ida/trilinos/idaHeat2D_kry_tpetra.cpp index 89e068cc95..d033f45655 100644 --- a/examples/ida/trilinos/idaHeat2D_kry_tpetra.cpp +++ b/examples/ida/trilinos/idaHeat2D_kry_tpetra.cpp @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx; - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return -1; /* Assign parameters in the user data structure. */ diff --git a/examples/idas/C_openmp/idasFoodWeb_bnd_omp.c b/examples/idas/C_openmp/idasFoodWeb_bnd_omp.c index d5cbe085b3..ab9512954c 100644 --- a/examples/idas/C_openmp/idasFoodWeb_bnd_omp.c +++ b/examples/idas/C_openmp/idasFoodWeb_bnd_omp.c @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/idas/C_openmp/idasFoodWeb_kry_omp.c b/examples/idas/C_openmp/idasFoodWeb_kry_omp.c index 40a8fa46f3..467367cc7d 100644 --- a/examples/idas/C_openmp/idasFoodWeb_kry_omp.c +++ b/examples/idas/C_openmp/idasFoodWeb_kry_omp.c @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 b/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 index 51ebe1c768..cf5077df95 100644 --- a/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 +++ b/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 @@ -234,6 +234,7 @@ end module dae_mod ! Main program program main use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fidas_mod ! Fortran interface to IDA use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -285,7 +286,7 @@ program main H = 737.0d0 ! Create the SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(SUN_COMM_NULL, sunctx) call check_retval(retval, "FSUNContext_Create") ! Allocate N-vectors. diff --git a/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 b/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 index 34cc887e7f..d79afadace 100644 --- a/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 +++ b/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 @@ -210,6 +210,7 @@ end module dae_mod program main use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fidas_mod ! Fortran interface to IDA use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -244,7 +245,7 @@ program main coeff = 1.d0/(dx * dx) ! Create the SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(SUN_COMM_NULL, sunctx) if (retval /= 0) then print *, 'ERROR: FSUNContext_Create returned nonzero' stop 1 diff --git a/examples/idas/parallel/idasBruss_ASAp_kry_bbd_p.c b/examples/idas/parallel/idasBruss_ASAp_kry_bbd_p.c index 7de76c0d4b..1ab9304117 100644 --- a/examples/idas/parallel/idasBruss_ASAp_kry_bbd_p.c +++ b/examples/idas/parallel/idasBruss_ASAp_kry_bbd_p.c @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/idas/parallel/idasBruss_FSA_kry_bbd_p.c b/examples/idas/parallel/idasBruss_FSA_kry_bbd_p.c index 7639eec6d0..cc1de40d6b 100644 --- a/examples/idas/parallel/idasBruss_FSA_kry_bbd_p.c +++ b/examples/idas/parallel/idasBruss_FSA_kry_bbd_p.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/idas/parallel/idasBruss_kry_bbd_p.c b/examples/idas/parallel/idasBruss_kry_bbd_p.c index 8e48071f7a..b42c2a3a54 100644 --- a/examples/idas/parallel/idasBruss_kry_bbd_p.c +++ b/examples/idas/parallel/idasBruss_kry_bbd_p.c @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/idas/parallel/idasFoodWeb_kry_bbd_p.c b/examples/idas/parallel/idasFoodWeb_kry_bbd_p.c index 63c652e236..f8e65d4ef9 100644 --- a/examples/idas/parallel/idasFoodWeb_kry_bbd_p.c +++ b/examples/idas/parallel/idasFoodWeb_kry_bbd_p.c @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/idas/parallel/idasFoodWeb_kry_p.c b/examples/idas/parallel/idasFoodWeb_kry_p.c index 460a202505..b35784487a 100644 --- a/examples/idas/parallel/idasFoodWeb_kry_p.c +++ b/examples/idas/parallel/idasFoodWeb_kry_p.c @@ -279,7 +279,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length (local_N) and global length (SystemSize). */ diff --git a/examples/idas/parallel/idasHeat2D_FSA_kry_bbd_p.c b/examples/idas/parallel/idasHeat2D_FSA_kry_bbd_p.c index 25d6c891d0..ccbdce183e 100644 --- a/examples/idas/parallel/idasHeat2D_FSA_kry_bbd_p.c +++ b/examples/idas/parallel/idasHeat2D_FSA_kry_bbd_p.c @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, thispe, &sensi, &sensi_meth, &err_con); /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length local_N and global length Neq. */ diff --git a/examples/idas/parallel/idasHeat2D_kry_bbd_p.c b/examples/idas/parallel/idasHeat2D_kry_bbd_p.c index 5f8f17bb73..a8c3a84f7b 100644 --- a/examples/idas/parallel/idasHeat2D_kry_bbd_p.c +++ b/examples/idas/parallel/idasHeat2D_kry_bbd_p.c @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length local_N and global length Neq. */ diff --git a/examples/idas/parallel/idasHeat2D_kry_p.c b/examples/idas/parallel/idasHeat2D_kry_p.c index 3b296c6e1e..a1a4516ef3 100644 --- a/examples/idas/parallel/idasHeat2D_kry_p.c +++ b/examples/idas/parallel/idasHeat2D_kry_p.c @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create((void*) &comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Set local length local_N and global length Neq. */ diff --git a/examples/idas/serial/idasAkzoNob_ASAi_dns.c b/examples/idas/serial/idasAkzoNob_ASAi_dns.c index d927e946c2..72e904b837 100644 --- a/examples/idas/serial/idasAkzoNob_ASAi_dns.c +++ b/examples/idas/serial/idasAkzoNob_ASAi_dns.c @@ -111,7 +111,7 @@ int main() printf("-------------------------------------------------------------\n\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate user data. */ diff --git a/examples/idas/serial/idasAkzoNob_dns.c b/examples/idas/serial/idasAkzoNob_dns.c index 631fcd5c7f..3a6fbaf738 100644 --- a/examples/idas/serial/idasAkzoNob_dns.c +++ b/examples/idas/serial/idasAkzoNob_dns.c @@ -94,7 +94,7 @@ int main() LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate user data. */ diff --git a/examples/idas/serial/idasAnalytic_mels.c b/examples/idas/serial/idasAnalytic_mels.c index 183a6fc7e9..2667a0b888 100644 --- a/examples/idas/serial/idasAnalytic_mels.c +++ b/examples/idas/serial/idasAnalytic_mels.c @@ -92,7 +92,7 @@ int main(void) printf(" abstol = %.1"ESYM"\n\n",abstol); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Initialize data structures */ diff --git a/examples/idas/serial/idasFoodWeb_bnd.c b/examples/idas/serial/idasFoodWeb_bnd.c index 84fdb1ecf2..a34d8df17f 100644 --- a/examples/idas/serial/idasFoodWeb_bnd.c +++ b/examples/idas/serial/idasFoodWeb_bnd.c @@ -191,7 +191,7 @@ int main() LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate and initialize user data block webdata. */ diff --git a/examples/idas/serial/idasHeat2D_bnd.c b/examples/idas/serial/idasHeat2D_bnd.c index b112e92f83..8afcc1c9bf 100644 --- a/examples/idas/serial/idasHeat2D_bnd.c +++ b/examples/idas/serial/idasHeat2D_bnd.c @@ -103,7 +103,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Create vectors uu, up, res, constraints, id. */ diff --git a/examples/idas/serial/idasHeat2D_kry.c b/examples/idas/serial/idasHeat2D_kry.c index d4bce7fa14..91a935680c 100644 --- a/examples/idas/serial/idasHeat2D_kry.c +++ b/examples/idas/serial/idasHeat2D_kry.c @@ -110,7 +110,7 @@ int main() /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors and the user data structure. */ diff --git a/examples/idas/serial/idasHessian_ASA_FSA.c b/examples/idas/serial/idasHessian_ASA_FSA.c index 48c5b6373c..8968f02121 100644 --- a/examples/idas/serial/idasHessian_ASA_FSA.c +++ b/examples/idas/serial/idasHessian_ASA_FSA.c @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx = NULL; - SUNContext_Create(NULL, &ctx); + SUNContext_Create(SUN_COMM_NULL, &ctx); /* Print problem description */ printf("\nAdjoint Sensitivity Example for Chemical Kinetics\n"); diff --git a/examples/idas/serial/idasKrylovDemo_ls.c b/examples/idas/serial/idasKrylovDemo_ls.c index 5c3c04e749..1bb800615d 100644 --- a/examples/idas/serial/idasKrylovDemo_ls.c +++ b/examples/idas/serial/idasKrylovDemo_ls.c @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) if (argc > 1) nrmfactor = atoi(argv[1]); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors and the user data structure. */ diff --git a/examples/idas/serial/idasRoberts_ASAi_dns.c b/examples/idas/serial/idasRoberts_ASAi_dns.c index e0b6f4a4c7..9a00fbf3b3 100644 --- a/examples/idas/serial/idasRoberts_ASAi_dns.c +++ b/examples/idas/serial/idasRoberts_ASAi_dns.c @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) printf(" g(t,p,y) = y3\n\n\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_ASAi_klu.c b/examples/idas/serial/idasRoberts_ASAi_klu.c index f370968eb0..1c9d99ca70 100644 --- a/examples/idas/serial/idasRoberts_ASAi_klu.c +++ b/examples/idas/serial/idasRoberts_ASAi_klu.c @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) printf(" g(t,p,y) = y3\n\n\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_ASAi_sps.c b/examples/idas/serial/idasRoberts_ASAi_sps.c index c5b36bfff9..891c525077 100644 --- a/examples/idas/serial/idasRoberts_ASAi_sps.c +++ b/examples/idas/serial/idasRoberts_ASAi_sps.c @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) printf(" g(t,p,y) = y3\n\n\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_FSA_dns.c b/examples/idas/serial/idasRoberts_FSA_dns.c index c109c7c46d..0e07928b45 100644 --- a/examples/idas/serial/idasRoberts_FSA_dns.c +++ b/examples/idas/serial/idasRoberts_FSA_dns.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, &sensi, &sensi_meth, &err_con); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_FSA_klu.c b/examples/idas/serial/idasRoberts_FSA_klu.c index a789fb5d4e..023e7141ae 100644 --- a/examples/idas/serial/idasRoberts_FSA_klu.c +++ b/examples/idas/serial/idasRoberts_FSA_klu.c @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, &sensi, &sensi_meth, &err_con); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_FSA_sps.c b/examples/idas/serial/idasRoberts_FSA_sps.c index 1cdcdfd07a..a7da20568c 100644 --- a/examples/idas/serial/idasRoberts_FSA_sps.c +++ b/examples/idas/serial/idasRoberts_FSA_sps.c @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) ProcessArgs(argc, argv, &sensi, &sensi_meth, &err_con); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* User data structure */ diff --git a/examples/idas/serial/idasRoberts_dns.c b/examples/idas/serial/idasRoberts_dns.c index 02733bf78a..84237aa279 100644 --- a/examples/idas/serial/idasRoberts_dns.c +++ b/examples/idas/serial/idasRoberts_dns.c @@ -113,7 +113,7 @@ int main(void) NLS = NULL; /* Create SUNDIALS context */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate N-vectors. */ diff --git a/examples/idas/serial/idasRoberts_klu.c b/examples/idas/serial/idasRoberts_klu.c index 25bda3a3fc..cc992e5830 100644 --- a/examples/idas/serial/idasRoberts_klu.c +++ b/examples/idas/serial/idasRoberts_klu.c @@ -100,7 +100,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors. */ diff --git a/examples/idas/serial/idasRoberts_sps.c b/examples/idas/serial/idasRoberts_sps.c index 8abf326224..9f26e5fa03 100644 --- a/examples/idas/serial/idasRoberts_sps.c +++ b/examples/idas/serial/idasRoberts_sps.c @@ -95,7 +95,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Allocate N-vectors. */ diff --git a/examples/idas/serial/idasSlCrank_FSA_dns.c b/examples/idas/serial/idasSlCrank_FSA_dns.c index 5d86efcde5..f2f6e25a74 100644 --- a/examples/idas/serial/idasSlCrank_FSA_dns.c +++ b/examples/idas/serial/idasSlCrank_FSA_dns.c @@ -113,7 +113,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; id = N_VNew_Serial(NEQ, ctx); diff --git a/examples/idas/serial/idasSlCrank_dns.c b/examples/idas/serial/idasSlCrank_dns.c index 29a56cbb6b..140e034d78 100644 --- a/examples/idas/serial/idasSlCrank_dns.c +++ b/examples/idas/serial/idasSlCrank_dns.c @@ -105,7 +105,7 @@ int main(void) LS = NULL; /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; id = N_VNew_Serial(NEQ, ctx); diff --git a/examples/kinsol/CUDA_mpi/kin_em_mpicuda.cu b/examples/kinsol/CUDA_mpi/kin_em_mpicuda.cu index 1f40b587e6..f7dc7163d8 100644 --- a/examples/kinsol/CUDA_mpi/kin_em_mpicuda.cu +++ b/examples/kinsol/CUDA_mpi/kin_em_mpicuda.cu @@ -165,7 +165,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition @@ -207,7 +207,7 @@ int main(int argc, char* argv[]) SUNDIALS will only log up to the max level n, but a lesser level can be configured at runtime by only providing output files for the desired levels. We will enable all logging here: */ - retval = SUNLogger_Create((void*)&comm_w, -1, &logger); /* output on all ranks */ + retval = SUNLogger_Create(comm_w, -1, &logger); /* output on all ranks */ if (check_retval(&retval, "SUNLogger_Create", 1)) return 1; retval = SUNLogger_SetDebugFilename(logger, fname); if (check_retval(&retval, "SUNLogger_SetDebugFilename", 1)) return 1; diff --git a/examples/kinsol/CXX_parallel/kin_em_p.cpp b/examples/kinsol/CXX_parallel/kin_em_p.cpp index f26a264427..e344c558f5 100644 --- a/examples/kinsol/CXX_parallel/kin_em_p.cpp +++ b/examples/kinsol/CXX_parallel/kin_em_p.cpp @@ -97,7 +97,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition @@ -139,7 +139,7 @@ int main(int argc, char* argv[]) SUNDIALS will only log up to the max level n, but a lesser level can be configured at runtime by only providing output files for the desired levels. We will enable all logging here: */ - retval = SUNLogger_Create((void*)&comm_w, -1, &logger); /* output on all ranks */ + retval = SUNLogger_Create(comm_w, -1, &logger); /* output on all ranks */ if (check_retval(&retval, "SUNLogger_Create", 1)) return 1; retval = SUNLogger_SetDebugFilename(logger, fname); if (check_retval(&retval, "SUNLogger_SetDebugFilename", 1)) return 1; diff --git a/examples/kinsol/CXX_parallel/kin_heat2D_nonlin_p.cpp b/examples/kinsol/CXX_parallel/kin_heat2D_nonlin_p.cpp index 600db1fc80..8422946b8d 100644 --- a/examples/kinsol/CXX_parallel/kin_heat2D_nonlin_p.cpp +++ b/examples/kinsol/CXX_parallel/kin_heat2D_nonlin_p.cpp @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition diff --git a/examples/kinsol/CXX_parhyp/kin_bratu2D_hypre_pfmg.cpp b/examples/kinsol/CXX_parhyp/kin_bratu2D_hypre_pfmg.cpp index 4df38655b0..f048394346 100644 --- a/examples/kinsol/CXX_parhyp/kin_bratu2D_hypre_pfmg.cpp +++ b/examples/kinsol/CXX_parhyp/kin_bratu2D_hypre_pfmg.cpp @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition diff --git a/examples/kinsol/CXX_parhyp/kin_heat2D_nonlin_hypre_pfmg.cpp b/examples/kinsol/CXX_parhyp/kin_heat2D_nonlin_hypre_pfmg.cpp index abc9c50a50..c091540bc9 100644 --- a/examples/kinsol/CXX_parhyp/kin_heat2D_nonlin_hypre_pfmg.cpp +++ b/examples/kinsol/CXX_parhyp/kin_heat2D_nonlin_hypre_pfmg.cpp @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) bool outproc = (myid == 0); // SUNDIALS context - sundials::Context sunctx(&comm_w); + sundials::Context sunctx(comm_w); // ------------------------------------------ // Setup UserData and parallel decomposition diff --git a/examples/kinsol/C_openmp/kinFoodWeb_kry_omp.c b/examples/kinsol/C_openmp/kinFoodWeb_kry_omp.c index d550b3137f..725bea894c 100644 --- a/examples/kinsol/C_openmp/kinFoodWeb_kry_omp.c +++ b/examples/kinsol/C_openmp/kinFoodWeb_kry_omp.c @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) data = NULL; /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 b/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 index e5fa0cda0c..5d53aebced 100644 --- a/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 @@ -119,6 +119,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fkinsol_mod ! Fortran interface to KINSOL use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -162,7 +163,7 @@ program main print '(2(a,i2),a,i3)', "Problem size: ", nx, " x ", ny, " = ", neq ! ------------------------- - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) if (ierr /= 0) then print *, 'ERROR in FSUNContext_Create' stop 1 diff --git a/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 b/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 index b6cd3d643b..f2f2b653a6 100644 --- a/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 @@ -190,6 +190,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fsundials_futils_mod ! Fortran utilities use fkinsol_mod ! Fortran interface to KINSOL @@ -242,7 +243,7 @@ program main ! ------------------------- ! Create the SUNDIALS context used for this simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! ------------------------- ! Create vectors for solution and scaling diff --git a/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 b/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 index 98c257a45d..f4815420e4 100644 --- a/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 @@ -297,6 +297,7 @@ program main !======= Inclusions =========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fkinsol_mod ! Fortran interface to KINSOL use fnvector_serial_mod ! Fortran interface to serial N_Vector @@ -348,7 +349,7 @@ program main ! ------------------------- ! Create the SUNDIALS context used for this simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(SUN_COMM_NULL, sunctx) ! ------------------------- ! Create SUNDIALS vectors for solution, scales, and constraints diff --git a/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c b/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c index ee3b260159..bec316b156 100644 --- a/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c +++ b/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/kinsol/parallel/kinFoodWeb_kry_p.c b/examples/kinsol/parallel/kinFoodWeb_kry_p.c index 8a03c363a5..cfc3e167d5 100644 --- a/examples/kinsol/parallel/kinFoodWeb_kry_p.c +++ b/examples/kinsol/parallel/kinFoodWeb_kry_p.c @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/kinsol/serial/kinAnalytic_fp.c b/examples/kinsol/serial/kinAnalytic_fp.c index 7dd4d9b021..c9681c72cd 100644 --- a/examples/kinsol/serial/kinAnalytic_fp.c +++ b/examples/kinsol/serial/kinAnalytic_fp.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) printf(" orth routine = %d\n", uopt->orth_aa); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* -------------------------------------- diff --git a/examples/kinsol/serial/kinFerTron_dns.c b/examples/kinsol/serial/kinFerTron_dns.c index 85e2387caa..ffbed1bc37 100644 --- a/examples/kinsol/serial/kinFerTron_dns.c +++ b/examples/kinsol/serial/kinFerTron_dns.c @@ -122,7 +122,7 @@ int main() data = NULL; /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* User data */ diff --git a/examples/kinsol/serial/kinFerTron_klu.c b/examples/kinsol/serial/kinFerTron_klu.c index 6a5c0fe06e..99553245d1 100644 --- a/examples/kinsol/serial/kinFerTron_klu.c +++ b/examples/kinsol/serial/kinFerTron_klu.c @@ -130,7 +130,7 @@ int main() data->nnz = 12; /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create serial vectors of length NEQ */ diff --git a/examples/kinsol/serial/kinFoodWeb_kry.c b/examples/kinsol/serial/kinFoodWeb_kry.c index 2d835489c6..97da5c1fc4 100644 --- a/examples/kinsol/serial/kinFoodWeb_kry.c +++ b/examples/kinsol/serial/kinFoodWeb_kry.c @@ -196,7 +196,7 @@ int main(void) data = NULL; /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/kinsol/serial/kinKrylovDemo_ls.c b/examples/kinsol/serial/kinKrylovDemo_ls.c index c9aa659dc3..cf907660b4 100644 --- a/examples/kinsol/serial/kinKrylovDemo_ls.c +++ b/examples/kinsol/serial/kinKrylovDemo_ls.c @@ -211,7 +211,7 @@ int main(void) /* Create the SUNDIALS context object for this simulation. */ SUNContext sunctx = NULL; - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); cc = sc = constraints = NULL; kmem = NULL; diff --git a/examples/kinsol/serial/kinLaplace_bnd.c b/examples/kinsol/serial/kinLaplace_bnd.c index d796c7eef1..97c00a5355 100644 --- a/examples/kinsol/serial/kinLaplace_bnd.c +++ b/examples/kinsol/serial/kinLaplace_bnd.c @@ -99,7 +99,7 @@ int main() printf("Problem size: %2ld x %2ld = %4ld\n", (long int) NX, (long int) NY, (long int) NEQ); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* -------------------------------------- diff --git a/examples/kinsol/serial/kinLaplace_picard_bnd.c b/examples/kinsol/serial/kinLaplace_picard_bnd.c index 09b82a38fc..3c666d0726 100644 --- a/examples/kinsol/serial/kinLaplace_picard_bnd.c +++ b/examples/kinsol/serial/kinLaplace_picard_bnd.c @@ -104,7 +104,7 @@ int main() printf("Problem size: %2ld x %2ld = %4ld\n", (long int) NX, (long int) NY, (long int) NEQ); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* -------------------------------------- diff --git a/examples/kinsol/serial/kinLaplace_picard_kry.c b/examples/kinsol/serial/kinLaplace_picard_kry.c index af3c2abf58..5dfed65340 100644 --- a/examples/kinsol/serial/kinLaplace_picard_kry.c +++ b/examples/kinsol/serial/kinLaplace_picard_kry.c @@ -101,7 +101,7 @@ int main() printf("Problem size: %2ld x %2ld = %4ld\n", (long int) NX, (long int) NY, (long int) NEQ); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* -------------------------------------- diff --git a/examples/kinsol/serial/kinRoberts_fp.c b/examples/kinsol/serial/kinRoberts_fp.c index a641834b47..a82d9a964f 100644 --- a/examples/kinsol/serial/kinRoberts_fp.c +++ b/examples/kinsol/serial/kinRoberts_fp.c @@ -115,7 +115,7 @@ int main() printf("Solution method: Anderson accelerated fixed point iteration.\n"); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* -------------------------------------- diff --git a/examples/kinsol/serial/kinRoboKin_dns.c b/examples/kinsol/serial/kinRoboKin_dns.c index 92f8fc66a8..4b5c0de181 100644 --- a/examples/kinsol/serial/kinRoboKin_dns.c +++ b/examples/kinsol/serial/kinRoboKin_dns.c @@ -85,7 +85,7 @@ int main() printf("KINSOL problem size: 8 + 2*8 = 24 \n\n"); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create vectors for solution, scales, and constraints */ diff --git a/examples/kinsol/serial/kinRoboKin_slu.c b/examples/kinsol/serial/kinRoboKin_slu.c index 9f79cb4c82..72bd608964 100644 --- a/examples/kinsol/serial/kinRoboKin_slu.c +++ b/examples/kinsol/serial/kinRoboKin_slu.c @@ -88,7 +88,7 @@ int main() printf("KINSOL problem size: 8 + 2*8 = 24 \n\n"); /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* Create vectors for solution, scales, and constraints */ diff --git a/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 b/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 index 6c5aaacd73..e85ded30ea 100644 --- a/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 +++ b/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 @@ -33,7 +33,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(N) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -70,7 +69,7 @@ integer function smoke_tests() result(ret) call FN_VSpace_OpenMP(x, lenrw, leniw) xptr => FN_VGetArrayPointer_OpenMP(x) call FN_VSetArrayPointer_OpenMP(xdata, x) - cptr = FN_VGetCommunicator(x) + ival = FN_VGetCommunicator(x) ival = FN_VGetLength_OpenMP(x) ! test standard vector operations @@ -191,7 +190,7 @@ program main !============== Introduction ============= print *, 'OpenMP N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/C_openmp/test_nvector_openmp.c b/examples/nvector/C_openmp/test_nvector_openmp.c index 86829d0826..d43f17b181 100644 --- a/examples/nvector/C_openmp/test_nvector_openmp.c +++ b/examples/nvector/C_openmp/test_nvector_openmp.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int nthreads; /* number of OpenMP threads */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/cuda/test_nvector_cuda.cu b/examples/nvector/cuda/test_nvector_cuda.cu index 80c66def1a..11f8988287 100644 --- a/examples/nvector/cuda/test_nvector_cuda.cu +++ b/examples/nvector/cuda/test_nvector_cuda.cu @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) cudaStream_t stream; /* cuda stream */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/hip/test_nvector_hip.cpp b/examples/nvector/hip/test_nvector_hip.cpp index fa9067ec79..be4695ef3e 100644 --- a/examples/nvector/hip/test_nvector_hip.cpp +++ b/examples/nvector/hip/test_nvector_hip.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) hipStream_t stream; /* hip stream */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/kokkos/test_nvector_kokkos.cpp b/examples/nvector/kokkos/test_nvector_kokkos.cpp index 3c351117c4..187bac2a56 100644 --- a/examples/nvector/kokkos/test_nvector_kokkos.cpp +++ b/examples/nvector/kokkos/test_nvector_kokkos.cpp @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) sunindextype length; /* vector length */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3) @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Clone additional vectors for testing */ VecType Y{X}; diff --git a/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 b/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 index 3286ce6ea3..ec82af966d 100644 --- a/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 +++ b/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 @@ -36,7 +36,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: x1data(N1), x2data(N2) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -68,7 +67,7 @@ integer function smoke_tests() result(ret) ! test generic vector functions ival = FN_VGetVectorID_ManyVector(x) call FN_VSpace_ManyVector(x, lenrw, leniw) - cptr = FN_VGetCommunicator(x) + ival = FN_VGetCommunicator(x) ival = FN_VGetLength_ManyVector(x) ! test standard vector operations @@ -222,7 +221,7 @@ program main !============== Introduction ============= print *, 'ManyVector N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/manyvector/test_nvector_manyvector.c b/examples/nvector/manyvector/test_nvector_manyvector.c index ea480c3c9b..ce43cd668b 100644 --- a/examples/nvector/manyvector/test_nvector_manyvector.c +++ b/examples/nvector/manyvector/test_nvector_manyvector.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test subvector accessors */ if (N_VGetNumSubvectors_ManyVector(X) != 2) { diff --git a/examples/nvector/mpicuda/test_nvector_mpicuda.cu b/examples/nvector/mpicuda/test_nvector_mpicuda.cu index e533a0bc94..067a7dfe93 100644 --- a/examples/nvector/mpicuda/test_nvector_mpicuda.cu +++ b/examples/nvector/mpicuda/test_nvector_mpicuda.cu @@ -53,20 +53,20 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); - Test_Init(&comm); + Test_Init(comm); /* check inputs */ if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) X = (i==UNMANAGED) ? N_VNew_Cuda(local_length, sunctx) : N_VNewManaged_Cuda(local_length, sunctx); if (X == NULL) { if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create the MPI+X vector */ @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) if (plusX == NULL) { N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(plusX, myid); /* Check vector communicator */ - fails += Test_N_VGetCommunicatorMPI(plusX, &comm, myid); + fails += Test_N_VGetCommunicatorMPI(plusX, comm, myid); /* Test clone functions */ fails += Test_N_VCloneEmpty(plusX, myid); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(plusX); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusZ = N_VClone(plusX); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusX); N_VDestroy(plusY); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusZ); N_VDestroy(plusU); if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -226,7 +226,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -360,13 +360,13 @@ sunrealtype get_element(N_Vector plusX, sunindextype i) double max_time(N_Vector plusX, double time) { - MPI_Comm *comm; + MPI_Comm comm; double maxt; - comm = (MPI_Comm*) N_VGetCommunicator(plusX); + comm = N_VGetCommunicator(plusX); /* get max time across all MPI ranks */ - (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, *comm); + (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, comm); return(maxt); } diff --git a/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 b/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 index 99aeaf7f5a..d0f2c964f8 100644 --- a/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 +++ b/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 @@ -17,6 +17,7 @@ module test_nvector_mpimanyvector use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_nvector_mod use fnvector_mpimanyvector_mod use fnvector_serial_mod @@ -30,7 +31,6 @@ module test_nvector_mpimanyvector integer(c_int), parameter :: nv = 3 ! length of vector arrays integer(c_long), parameter :: N = N1 + N2 ! overall manyvector length integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_int) :: nprocs ! number of MPI processes contains @@ -40,7 +40,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: x1data(N1), x2data(N2) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -56,7 +55,7 @@ integer function smoke_tests() result(ret) tmp => FN_VMake_Serial(N2, x2data, sunctx) call FN_VSetVecAtIndexVectorArray(subvecs, 1, tmp) - x => FN_VMake_MPIManyVector(MPI_COMM_WORLD, int(nsubvecs,8), subvecs, sunctx) + x => FN_VMake_MPIManyVector(comm, int(nsubvecs,8), subvecs, sunctx) call FN_VConst(ONE, x) y => FN_VClone_MPIManyVector(x) call FN_VConst(ONE, y) @@ -72,7 +71,7 @@ integer function smoke_tests() result(ret) ! test generic vector functions ival = FN_VGetVectorID_MPIManyVector(x) call FN_VSpace_MPIManyVector(x, lenrw, leniw) - cptr = FN_VGetCommunicator(x) + ival = FN_VGetCommunicator(x) ival = FN_VGetLength_MPIManyVector(x) ! test standard vector operations @@ -154,7 +153,7 @@ integer function unit_tests() result(fails) tmp => FN_VMake_Serial(N2, x2data, sunctx) call FN_VSetVecAtIndexVectorArray(subvecs, 1, tmp) - x => FN_VMake_MPIManyVector(MPI_COMM_WORLD, int(nsubvecs,8), subvecs, sunctx) + x => FN_VMake_MPIManyVector(comm, int(nsubvecs,8), subvecs, sunctx) call FN_VConst(ONE, x) !==== tests ==== @@ -250,12 +249,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'MPIManyVector N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c index cb5c3f7ab9..739ee0bc33 100644 --- a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c +++ b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c @@ -50,32 +50,32 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 4) { if (myid == 0) printf("ERROR: THREE (3) Inputs required: subvector 1 local vector length, subvector 2 local vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen1 = (sunindextype) atol(argv[1]); if (loclen1 < 1) { if (myid == 0) printf("ERROR: local subvector 1 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen2 = (sunindextype) atol(argv[2]); if (loclen2 < 1) { if (myid == 0) printf("ERROR: local subvector 2 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[3]); @@ -102,13 +102,13 @@ int main(int argc, char *argv[]) Xsub[0] = N_VNew_Serial(loclen1, sunctx); if (Xsub[0] == NULL) { printf("FAIL: Unable to create a new serial subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Xsub[1] = N_VNew_Parallel(comm, loclen2, globlen, sunctx); if (Xsub[1] == NULL) { N_VDestroy(Xsub[0]); printf("FAIL: Unable to create a new parallel subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create a new MPIManyVector */ @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new MPIManyVector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) } /* Check vector communicator */ - if (Test_N_VGetCommunicatorMPI(X, &comm, myid)) { + if (Test_N_VGetCommunicatorMPI(X, comm, myid)) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d\n\n", myid); fails += 1; } @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -409,11 +409,11 @@ sunrealtype get_element(N_Vector X, sunindextype i) double max_time(N_Vector X, double time) { double maxt; - MPI_Comm *comm; + MPI_Comm comm; /* get max time across all MPI ranks */ - comm = (MPI_Comm *) N_VGetCommunicator(X); - (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, *comm); + comm = N_VGetCommunicator(X); + (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, comm); return(maxt); } diff --git a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c index a89beffeba..c0e6f69a5d 100644 --- a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c +++ b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c @@ -52,32 +52,32 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 4) { if (myid == 0) printf("ERROR: THREE (3) Inputs required: subvector 1 local vector length, subvector 2 local vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen1 = (sunindextype) atol(argv[1]); if (loclen1 < 1) { if (myid == 0) printf("ERROR: local subvector 1 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen2 = (sunindextype) atol(argv[2]); if (loclen2 < 1) { if (myid == 0) printf("ERROR: local subvector 2 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[3]); @@ -85,11 +85,11 @@ int main(int argc, char *argv[]) /* Split main communicator into even/odd subcommunicators */ retval = MPI_Comm_split(comm, myid%2, 0, &subcomm); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_size(subcomm, &subprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(subcomm, &subid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* global parallel subvector length in subcommunicator */ globlen = subprocs*loclen2; @@ -121,13 +121,13 @@ int main(int argc, char *argv[]) Xsub[0] = N_VNew_Serial(loclen1, sunctx); if (Xsub[0] == NULL) { printf("FAIL: Unable to create a new serial subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Xsub[1] = N_VNew_Parallel(subcomm, loclen2, globlen, sunctx); if (Xsub[1] == NULL) { N_VDestroy(Xsub[0]); printf("FAIL: Unable to create a new parallel subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Make a ManyVector, where intercommunicator is specified */ @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new ManyVector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) } /* Check vector communicator */ - if (Test_N_VGetCommunicatorMPI(X, &comm, myid)) { + if (Test_N_VGetCommunicatorMPI(X, comm, myid)) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d\n\n", myid); fails += 1; } @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -428,11 +428,11 @@ sunrealtype get_element(N_Vector X, sunindextype i) double max_time(N_Vector X, double time) { double maxt; - MPI_Comm *comm; + MPI_Comm comm; /* get max time across all MPI ranks */ - comm = (MPI_Comm *) N_VGetCommunicator(X); - (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, *comm); + comm = N_VGetCommunicator(X); + (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, comm); return(maxt); } diff --git a/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 b/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 index bf675fa408..4028e4fa2f 100644 --- a/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 +++ b/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 @@ -26,7 +26,6 @@ module test_nvector_mpiplusx integer(c_long), parameter :: N = 100 ! overall manyvector length integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_int) :: nprocs ! number of MPI processes contains @@ -165,12 +164,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'MPIPlusX N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/mpiplusx/test_nvector_mpiplusx.c b/examples/nvector/mpiplusx/test_nvector_mpiplusx.c index 663b9055f9..23f4a1104a 100644 --- a/examples/nvector/mpiplusx/test_nvector_mpiplusx.c +++ b/examples/nvector/mpiplusx/test_nvector_mpiplusx.c @@ -48,25 +48,25 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector local length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) Xlocal = N_VNew_Serial(local_length, sunctx); if (Xlocal == NULL) { printf("FAIL: Unable to create a new serial vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create a new MPIPlusX */ @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) if (X == NULL) { N_VDestroy(Xlocal); printf("FAIL: Unable to create a new MPIPlusX vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) } /* Check vector communicator */ - if (Test_N_VGetCommunicatorMPI(X, &comm, myid)) { + if (Test_N_VGetCommunicatorMPI(X, comm, myid)) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d\n\n", myid); fails += 1; } @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -355,11 +355,11 @@ sunrealtype get_element(N_Vector X, sunindextype i) double max_time(N_Vector X, double time) { double maxt; - MPI_Comm *comm; + MPI_Comm comm; /* get max time across all MPI ranks */ - comm = (MPI_Comm *) N_VGetCommunicator(X); - (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, *comm); + comm = N_VGetCommunicator(X); + (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, comm); return(maxt); } diff --git a/examples/nvector/mpiraja/test_nvector_mpiraja.cpp b/examples/nvector/mpiraja/test_nvector_mpiraja.cpp index 019d2a4fdc..4eb02cf7ed 100644 --- a/examples/nvector/mpiraja/test_nvector_mpiraja.cpp +++ b/examples/nvector/mpiraja/test_nvector_mpiraja.cpp @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -62,14 +62,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } /* global length */ @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) X = (i == UNMANAGED) ? N_VNew_Raja(local_length, sunctx) : N_VNewManaged_Raja(local_length, sunctx); if (X == NULL) { if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create the MPI+X vector */ @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) if (plusX == NULL) { N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(plusX, myid); /* Check vector communicator */ - fails += Test_N_VGetCommunicatorMPI(plusX, &comm, myid); + fails += Test_N_VGetCommunicatorMPI(plusX, comm, myid); /* Test clone functions */ fails += Test_N_VCloneEmpty(plusX, myid); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(plusX); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusZ = N_VClone(plusX); @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusX); N_VDestroy(plusY); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusU = N_VMake_MPIPlusX(comm, U, sunctx); @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -220,7 +220,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusZ); N_VDestroy(plusU); if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -376,13 +376,13 @@ sunrealtype get_element(N_Vector plusX, sunindextype i) double max_time(N_Vector plusX, double time) { - MPI_Comm *comm; + MPI_Comm comm; double maxt; - comm = (MPI_Comm*) N_VGetCommunicator(plusX); + comm = N_VGetCommunicator(plusX); /* get max time across all MPI ranks */ - (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, *comm); + (void) MPI_Reduce(&time, &maxt, 1, MPI_DOUBLE, MPI_MAX, 0, comm); return(maxt); } diff --git a/examples/nvector/openmpdev/test_nvector_openmpdev.c b/examples/nvector/openmpdev/test_nvector_openmpdev.c index 0cd54ea2fb..187b86db00 100644 --- a/examples/nvector/openmpdev/test_nvector_openmpdev.c +++ b/examples/nvector/openmpdev/test_nvector_openmpdev.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/parallel/test_fnvector_parallel_mod.f90 b/examples/nvector/parallel/test_fnvector_parallel_mod.f90 index e3c2473610..57ef683511 100644 --- a/examples/nvector/parallel/test_fnvector_parallel_mod.f90 +++ b/examples/nvector/parallel/test_fnvector_parallel_mod.f90 @@ -28,7 +28,6 @@ module test_nvector_parallel integer(c_int), parameter :: ns = 2 ! number of vector arrays integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_long) :: global_length ! vector global_length integer(c_int) :: nprocs ! number of MPI processes contains @@ -38,7 +37,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(local_length) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -75,7 +73,7 @@ integer function smoke_tests() result(ret) call FN_VSpace_Parallel(x, lenrw, leniw) xptr => FN_VGetArrayPointer_Parallel(x) call FN_VSetArrayPointer_Parallel(xdata, x) - cptr = FN_VGetCommunicator_Parallel(x) + ival = FN_VGetCommunicator_Parallel(x) ival = FN_VGetLength_Parallel(x) ! test standard vector operations @@ -215,12 +213,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'Parallel N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/parallel/test_nvector_mpi.c b/examples/nvector/parallel/test_nvector_mpi.c index 5cd0fb786c..9627d8edd6 100644 --- a/examples/nvector/parallel/test_nvector_mpi.c +++ b/examples/nvector/parallel/test_nvector_mpi.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -52,14 +52,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -78,14 +78,14 @@ int main(int argc, char *argv[]) W = N_VNewEmpty_Parallel(comm, local_length, global_length, sunctx); if (W == NULL) { if (myid == 0) printf("FAIL: Unable to create a new empty vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } X = N_VNew_Parallel(comm, local_length, global_length, sunctx); if (X == NULL) { N_VDestroy(W); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, myid); /* Check vector communicator */ - fails += Test_N_VGetCommunicatorMPI(X, &comm, myid); + fails += Test_N_VGetCommunicatorMPI(X, comm, myid); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, myid); @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) N_VDestroy(W); N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Y); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); N_VDestroy(Z); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); N_VDestroy(U); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/parhyp/test_nvector_parhyp.c b/examples/nvector/parhyp/test_nvector_parhyp.c index 5a902552af..da2b66514d 100644 --- a/examples/nvector/parhyp/test_nvector_parhyp.c +++ b/examples/nvector/parhyp/test_nvector_parhyp.c @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -56,14 +56,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) if (local_length < 1) { printf("Using global partition.\n"); printf("I don't do this stuff. Now exiting...\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } } @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, myid); /* Check vector communicator */ - fails += Test_N_VGetCommunicatorMPI(X, &comm, myid); + fails += Test_N_VGetCommunicatorMPI(X, comm, myid); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, myid); @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/petsc/test_nvector_petsc.c b/examples/nvector/petsc/test_nvector_petsc.c index ba6fc134ad..6eac644667 100644 --- a/examples/nvector/petsc/test_nvector_petsc.c +++ b/examples/nvector/petsc/test_nvector_petsc.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -57,14 +57,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) PETSc vector is not necessarily identical to the one supplied to VecCreate, so we compare against the one that is actually *used* in the PETSc vector. */ PetscObjectGetComm((PetscObject) xvec, &comm2); - fails += Test_N_VGetCommunicatorMPI(X, &comm2, myid); + fails += Test_N_VGetCommunicatorMPI(X, comm2, myid); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, myid); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 b/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 index b5e71882a7..72fd773b7e 100644 --- a/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 +++ b/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 @@ -33,7 +33,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(N) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -70,7 +69,7 @@ integer function smoke_tests() result(ret) call FN_VSpace_Pthreads(x, lenrw, leniw) xptr => FN_VGetArrayPointer_Pthreads(x) call FN_VSetArrayPointer_Pthreads(xdata, x) - cptr = FN_VGetCommunicator(x) + ival = FN_VGetCommunicator(x) ival = FN_VGetLength_Pthreads(x) ! test standard vector operations @@ -191,7 +190,7 @@ program main !============== Introduction ============= print *, 'Pthreads N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/pthreads/test_nvector_pthreads.c b/examples/nvector/pthreads/test_nvector_pthreads.c index ac3803f739..cbbbd6a233 100644 --- a/examples/nvector/pthreads/test_nvector_pthreads.c +++ b/examples/nvector/pthreads/test_nvector_pthreads.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int nthreads; /* number of POSIX threads */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/raja/test_nvector_raja.cpp b/examples/nvector/raja/test_nvector_raja.cpp index 0228e84ed3..51dc5e19f8 100644 --- a/examples/nvector/raja/test_nvector_raja.cpp +++ b/examples/nvector/raja/test_nvector_raja.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int memtype; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/serial/test_fnvector_serial_mod.f90 b/examples/nvector/serial/test_fnvector_serial_mod.f90 index 8ffd817b6f..70fe61fdd7 100644 --- a/examples/nvector/serial/test_fnvector_serial_mod.f90 +++ b/examples/nvector/serial/test_fnvector_serial_mod.f90 @@ -32,7 +32,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(N) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -69,7 +68,7 @@ integer function smoke_tests() result(ret) call FN_VSpace_Serial(x, lenrw, leniw) xptr => FN_VGetArrayPointer_Serial(x) call FN_VSetArrayPointer_Serial(xdata, x) - cptr = FN_VGetCommunicator(x) + ival = FN_VGetCommunicator(x) ival = FN_VGetLength_Serial(x) ! test standard vector operations @@ -181,6 +180,7 @@ end function has_data program main !======== Inclusions ========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use test_nvector_serial !======== Declarations ======== @@ -190,7 +190,7 @@ program main !============== Introduction ============= print *, 'Serial N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/serial/test_nvector_serial.c b/examples/nvector/serial/test_nvector_serial.c index 15b6ed9a06..28f4c1ebcd 100644 --- a/examples/nvector/serial/test_nvector_serial.c +++ b/examples/nvector/serial/test_nvector_serial.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/sycl/test_nvector_sycl.cpp b/examples/nvector/sycl/test_nvector_sycl.cpp index 523e144ccc..f6b5b80174 100644 --- a/examples/nvector/sycl/test_nvector_sycl.cpp +++ b/examples/nvector/sycl/test_nvector_sycl.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) int threadsPerBlock; /* sycl block size */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4) @@ -233,7 +233,7 @@ int main(int argc, char *argv[]) fails += Test_N_VGetLength(X, 0); /* Check vector communicator */ - fails += Test_N_VGetCommunicator(X, NULL, 0); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, 0); /* Test clone functions */ fails += Test_N_VCloneEmpty(X, 0); diff --git a/examples/nvector/test_mpinvector.c b/examples/nvector/test_mpinvector.c index e2806a3bef..b74b71c218 100644 --- a/examples/nvector/test_mpinvector.c +++ b/examples/nvector/test_mpinvector.c @@ -23,46 +23,41 @@ #include "test_nvector.h" -void Test_AbortMPI(void* comm, int code) +void Test_AbortMPI(SUNComm comm, int code) { Test_Finalize(); - MPI_Abort(*((MPI_Comm*)comm), code); + MPI_Abort(comm, code); } /* ---------------------------------------------------------------------- * Test_N_VGetCommunicator Test (with MPI dependency). * --------------------------------------------------------------------*/ -int Test_N_VGetCommunicatorMPI(N_Vector W, void *comm, int myid) +int Test_N_VGetCommunicatorMPI(N_Vector W, SUNComm comm, int myid) { - void* wcomm; - MPI_Comm* Wcomm; - MPI_Comm* Comm; + SUNComm wcomm; int same; /* ask W for its communicator */ - wcomm = NULL; wcomm = N_VGetCommunicator(W); /* return with success if both are NULL */ - if ((wcomm == NULL) && (comm == NULL)) { + if ((wcomm == SUN_COMM_NULL) && (comm == SUN_COMM_NULL)) { printf("PASSED test -- N_VGetCommunicator\n"); return(0); } /* return with failure if either is NULL */ - if (wcomm == NULL) { + if (wcomm == SUN_COMM_NULL) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d (incorrectly reports NULL comm)\n", myid); return(1); } - if (comm == NULL) { + if (comm == SUN_COMM_NULL) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d (incorrectly reports non-NULL comm)\n", myid); return(1); } /* call MPI_Comm_compare to check that communicators match or are congruent */ - Wcomm = (MPI_Comm *) wcomm; - Comm = (MPI_Comm *) comm; - if (MPI_Comm_compare(*Comm, *Wcomm, &same) != MPI_SUCCESS) { + if (MPI_Comm_compare(comm, wcomm, &same) != MPI_SUCCESS) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d (error in MPI_Comm_compare)\n", myid); return(1); } diff --git a/examples/nvector/test_nvector.c b/examples/nvector/test_nvector.c index 776dbc1742..25781bf89e 100644 --- a/examples/nvector/test_nvector.c +++ b/examples/nvector/test_nvector.c @@ -71,7 +71,7 @@ static int print_time = 0; #define FMT "%s Time: %22.15e\n\n" #define PRINT_TIME(test, time) if (print_time) printf(FMT, test, time) -int Test_Init(void* comm) +int Test_Init(SUNComm comm) { if (sunctx == NULL) { if (SUNContext_Create(comm, &sunctx)) { @@ -503,32 +503,32 @@ int Test_N_VGetLength(N_Vector W, int myid) /* ---------------------------------------------------------------------- * Test_N_VGetCommunicator Test (without MPI dependency) * --------------------------------------------------------------------*/ -int Test_N_VGetCommunicator(N_Vector W, void *comm, int myid) +int Test_N_VGetCommunicator(N_Vector W, SUNComm comm, int myid) { - void* wcomm; + SUNComm wcomm; /* ask W for its communicator */ - wcomm = NULL; wcomm = N_VGetCommunicator(W); /* return with success if both are NULL */ - if ((wcomm == NULL) && (comm == NULL)) { + if ((wcomm == SUN_COMM_NULL) && (comm == SUN_COMM_NULL)) { printf("PASSED test -- N_VGetCommunicator\n"); return(0); } /* return with failure if either is NULL */ - if (wcomm == NULL) { + if (wcomm == SUN_COMM_NULL) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d (incorrectly reports NULL comm)\n", myid); return(1); } - if (comm == NULL) { + if (comm == SUN_COMM_NULL) { printf(">>> FAILED test -- N_VGetCommunicator, Proc %d (incorrectly reports non-NULL comm)\n", myid); return(1); } if (myid == 0) printf(">>> FAILED test -- N_VGetCommunicator, Proc %d has non-NULL comm with MPI disabled\n", myid); + return(0); } diff --git a/examples/nvector/test_nvector.h b/examples/nvector/test_nvector.h index 910f7719ce..f29af71de5 100644 --- a/examples/nvector/test_nvector.h +++ b/examples/nvector/test_nvector.h @@ -44,10 +44,10 @@ double max_time(N_Vector X, double time); void sync_device(N_Vector X); /* Shared test initialization/finalization */ -int Test_Init(void* comm); +int Test_Init(SUNComm comm); int Test_Finalize(); void Test_Abort(int code); -void Test_AbortMPI(void* comm, int code); +void Test_AbortMPI(SUNComm comm, int code); /* Vector ID test */ int Test_N_VGetVectorID(N_Vector X, N_Vector_ID ID, int myid); @@ -66,8 +66,8 @@ int Test_N_VClone(N_Vector W, sunindextype local_length, int myid); int Test_N_VGetArrayPointer(N_Vector W, sunindextype local_length, int myid); int Test_N_VSetArrayPointer(N_Vector W, sunindextype local_length, int myid); int Test_N_VGetLength(N_Vector W, int myid); -int Test_N_VGetCommunicator(N_Vector W, void *comm, int myid); -int Test_N_VGetCommunicatorMPI(N_Vector W, void *comm, int myid); +int Test_N_VGetCommunicator(N_Vector W, SUNComm comm, int myid); +int Test_N_VGetCommunicatorMPI(N_Vector W, SUNComm comm, int myid); /* Standard vector operation tests */ int Test_N_VLinearSum(N_Vector X, N_Vector Y, N_Vector Z, diff --git a/examples/nvector/trilinos/test_nvector_trilinos.cpp b/examples/nvector/trilinos/test_nvector_trilinos.cpp index b0c1273146..b0e19b2045 100644 --- a/examples/nvector/trilinos/test_nvector_trilinos.cpp +++ b/examples/nvector/trilinos/test_nvector_trilinos.cpp @@ -43,7 +43,7 @@ int main (int argc, char *argv[]) typedef TpetraVectorInterface::vector_type vector_type; typedef vector_type::map_type map_type; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* Start an MPI session */ Tpetra::ScopeGuard tpetraScope(&argc, &argv); @@ -113,9 +113,9 @@ int main (int argc, char *argv[]) /* Check vector communicator */ #ifdef SUNDIALS_TRILINOS_HAVE_MPI auto mpicomm = Teuchos::rcp_dynamic_cast>(comm); - fails += Test_N_VGetCommunicatorMPI(X, (MPI_Comm *) mpicomm->getRawMpiComm().get(), myRank); + fails += Test_N_VGetCommunicatorMPI(X, *(mpicomm->getRawMpiComm().get()), myRank); #else - fails += Test_N_VGetCommunicator(X, NULL, myRank); + fails += Test_N_VGetCommunicator(X, SUN_COMM_NULL, myRank); #endif /* Test clone functions */ diff --git a/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 b/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 index 73b88e410b..b820b4768b 100644 --- a/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 +++ b/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 @@ -171,7 +171,7 @@ program main !============== Introduction ============= print *, 'Band SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/band/test_sunlinsol_band.c b/examples/sunlinsol/band/test_sunlinsol_band.c index 13428d2304..51d562f1af 100644 --- a/examples/sunlinsol/band/test_sunlinsol_band.c +++ b/examples/sunlinsol/band/test_sunlinsol_band.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) sunrealtype *colj, *xdata; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/cusolversp/test_sunlinsol_cusolversp_batchqr.cu b/examples/sunlinsol/cusolversp/test_sunlinsol_cusolversp_batchqr.cu index 67e8f63ed2..dfbece031a 100644 --- a/examples/sunlinsol/cusolversp/test_sunlinsol_cusolversp_batchqr.cu +++ b/examples/sunlinsol/cusolversp/test_sunlinsol_cusolversp_batchqr.cu @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) cusolverSpHandle_t cusol_handle; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 b/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 index 17806c16ec..f632272ada 100644 --- a/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 +++ b/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 @@ -170,7 +170,7 @@ program main !============== Introduction ============= print *, 'Dense SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/dense/test_sunlinsol_dense.c b/examples/sunlinsol/dense/test_sunlinsol_dense.c index dbb6f2ce1c..426f31aae4 100644 --- a/examples/sunlinsol/dense/test_sunlinsol_dense.c +++ b/examples/sunlinsol/dense/test_sunlinsol_dense.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) sunrealtype *colj, *xdata, *colIj; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 b/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 index c99a986a11..5b31d27dea 100644 --- a/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 +++ b/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 @@ -166,7 +166,7 @@ program main !============== Introduction ============= print *, 'KLU SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/klu/test_sunlinsol_klu.c b/examples/sunlinsol/klu/test_sunlinsol_klu.c index 4f2954f6eb..e53e0f8e24 100644 --- a/examples/sunlinsol/klu/test_sunlinsol_klu.c +++ b/examples/sunlinsol/klu/test_sunlinsol_klu.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) sun_klu_common *common; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/kokkos/CMakeLists.txt b/examples/sunlinsol/kokkos/CMakeLists.txt index 5acf11920d..a2fa95541a 100644 --- a/examples/sunlinsol/kokkos/CMakeLists.txt +++ b/examples/sunlinsol/kokkos/CMakeLists.txt @@ -51,7 +51,6 @@ foreach(example_tuple ${examples_list}) # libraries to link against target_link_libraries(${example_target} PRIVATE - sundials_generic sundials_nveckokkos sundials_sunmatrixkokkosdense sundials_sunlinsolkokkosdense diff --git a/examples/sunlinsol/lapackband/test_sunlinsol_lapackband.c b/examples/sunlinsol/lapackband/test_sunlinsol_lapackband.c index 6e04a975dd..e3677cdf1f 100644 --- a/examples/sunlinsol/lapackband/test_sunlinsol_lapackband.c +++ b/examples/sunlinsol/lapackband/test_sunlinsol_lapackband.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) sunrealtype *colj, *xdata; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 b/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 index 927a72f2b3..9e9e1803a7 100644 --- a/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 +++ b/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 @@ -170,7 +170,7 @@ program main !============== Introduction ============= print *, 'LAPACK-Dense SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/lapackdense/test_sunlinsol_lapackdense.c b/examples/sunlinsol/lapackdense/test_sunlinsol_lapackdense.c index 567fdd65a5..70383167e3 100644 --- a/examples/sunlinsol/lapackdense/test_sunlinsol_lapackdense.c +++ b/examples/sunlinsol/lapackdense/test_sunlinsol_lapackdense.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) sunrealtype *colj, *xdata, *colIj; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/magmadense/test_sunlinsol_magmadense.cpp b/examples/sunlinsol/magmadense/test_sunlinsol_magmadense.cpp index 57f39868b4..42a17cd8ec 100644 --- a/examples/sunlinsol/magmadense/test_sunlinsol_magmadense.cpp +++ b/examples/sunlinsol/magmadense/test_sunlinsol_magmadense.cpp @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) sunrealtype *Adata, *Idata, *xdata; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/onemkldense/test_sunlinsol_onemkldense.cpp b/examples/sunlinsol/onemkldense/test_sunlinsol_onemkldense.cpp index 936b161c38..50d9e61840 100644 --- a/examples/sunlinsol/onemkldense/test_sunlinsol_onemkldense.cpp +++ b/examples/sunlinsol/onemkldense/test_sunlinsol_onemkldense.cpp @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) sunindextype i, j, k; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c b/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c index 76807cc872..2cde940d9c 100644 --- a/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c +++ b/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } @@ -157,8 +157,8 @@ int main(int argc, char *argv[]) if (ProbData.myid == 0) { printf("\nPCG linear solver test:\n"); printf(" nprocs = %i\n", ProbData.nprocs); - printf(" local/global problem sizes = %ld/%ld\n", (long int) ProbData.Nloc, - (long int) ProbData.nprocs * ProbData.Nloc); + printf(" local/global problem sizes = %ld/%lld\n", (long int) ProbData.Nloc, + (long long int) ProbData.nprocs * ProbData.Nloc); printf(" Maximum Krylov subspace dimension = %i\n", maxl); printf(" Solver Tolerance = %g\n", tol); printf(" timing output flag = %i\n\n", print_timing); diff --git a/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 b/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 index bc62fcbc84..2b04f76289 100644 --- a/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 +++ b/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 @@ -341,7 +341,7 @@ program main print *, 'PCG SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/pcg/serial/test_sunlinsol_pcg_serial.c b/examples/sunlinsol/pcg/serial/test_sunlinsol_pcg_serial.c index efe3137ac2..1da72b55c4 100644 --- a/examples/sunlinsol/pcg/serial/test_sunlinsol_pcg_serial.c +++ b/examples/sunlinsol/pcg/serial/test_sunlinsol_pcg_serial.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) double tol; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c b/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c index 4b67992d36..0b376c00aa 100644 --- a/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c +++ b/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 b/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 index e1a052d9ce..a0b0b4d633 100644 --- a/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 +++ b/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 @@ -332,7 +332,7 @@ program main print *, 'SPBCGS SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spbcgs/serial/test_sunlinsol_spbcgs_serial.c b/examples/sunlinsol/spbcgs/serial/test_sunlinsol_spbcgs_serial.c index 7bea073e27..9e11b098b2 100644 --- a/examples/sunlinsol/spbcgs/serial/test_sunlinsol_spbcgs_serial.c +++ b/examples/sunlinsol/spbcgs/serial/test_sunlinsol_spbcgs_serial.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) double tol; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c b/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c index 0fd34e785a..5e3bc6e6b9 100644 --- a/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c +++ b/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 b/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 index 27e19cff89..dc05bfd811 100644 --- a/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 +++ b/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 @@ -334,7 +334,7 @@ program main print *, 'SPFGMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spfgmr/serial/test_sunlinsol_spfgmr_serial.c b/examples/sunlinsol/spfgmr/serial/test_sunlinsol_spfgmr_serial.c index b7537d8509..f8c3548ce2 100644 --- a/examples/sunlinsol/spfgmr/serial/test_sunlinsol_spfgmr_serial.c +++ b/examples/sunlinsol/spfgmr/serial/test_sunlinsol_spfgmr_serial.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) double tol; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c b/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c index 42bcd041e5..27b6ece71d 100644 --- a/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c +++ b/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 b/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 index febe3c6034..c4612120da 100644 --- a/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 +++ b/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 @@ -334,7 +334,7 @@ program main print *, 'SPGMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spgmr/serial/test_sunlinsol_spgmr_serial.c b/examples/sunlinsol/spgmr/serial/test_sunlinsol_spgmr_serial.c index b9d81c712c..e37c97efd5 100644 --- a/examples/sunlinsol/spgmr/serial/test_sunlinsol_spgmr_serial.c +++ b/examples/sunlinsol/spgmr/serial/test_sunlinsol_spgmr_serial.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) double tol; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c b/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c index e74332086b..f9c3f13a89 100644 --- a/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c +++ b/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 b/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 index 8d15238e67..a5c5ef5d4c 100644 --- a/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 +++ b/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 @@ -332,7 +332,7 @@ program main print *, 'SPTFQMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/sptfqmr/serial/test_sunlinsol_sptfqmr_serial.c b/examples/sunlinsol/sptfqmr/serial/test_sunlinsol_sptfqmr_serial.c index 47268df199..d93c6325ab 100644 --- a/examples/sunlinsol/sptfqmr/serial/test_sunlinsol_sptfqmr_serial.c +++ b/examples/sunlinsol/sptfqmr/serial/test_sunlinsol_sptfqmr_serial.c @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) double tol; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp b/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp index b43c2d5f42..7e24e0f3db 100644 --- a/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp +++ b/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - if (SUNContext_Create(&comm, &sunctx)) { + if (SUNContext_Create(comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/superlumt/test_sunlinsol_superlumt.c b/examples/sunlinsol/superlumt/test_sunlinsol_superlumt.c index 802dc14bd6..4e70622dcd 100644 --- a/examples/sunlinsol/superlumt/test_sunlinsol_superlumt.c +++ b/examples/sunlinsol/superlumt/test_sunlinsol_superlumt.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) sunindextype i, j, k; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 b/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 index 7a4ba62d68..cdfd2fdc26 100644 --- a/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 +++ b/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 @@ -182,7 +182,7 @@ program main !============== Introduction ============= print *, 'Band SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunmatrix/band/test_sunmatrix_band.c b/examples/sunmatrix/band/test_sunmatrix_band.c index 73aecb80f9..cbc7bef48f 100644 --- a/examples/sunmatrix/band/test_sunmatrix_band.c +++ b/examples/sunmatrix/band/test_sunmatrix_band.c @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) sunrealtype *colj, *xdata, *ydata; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/cusparse/test_sunmatrix_cusparse.cu b/examples/sunmatrix/cusparse/test_sunmatrix_cusparse.cu index e1737a7702..a1d915e8e3 100644 --- a/examples/sunmatrix/cusparse/test_sunmatrix_cusparse.cu +++ b/examples/sunmatrix/cusparse/test_sunmatrix_cusparse.cu @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) cusparseStatus_t cusp_status; cusparseHandle_t cusp_handle; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 b/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 index 87d9e0e46b..2ccaa1f0e3 100644 --- a/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 +++ b/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 @@ -167,7 +167,7 @@ program main !============== Introduction ============= print *, 'Dense SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunmatrix/dense/test_sunmatrix_dense.c b/examples/sunmatrix/dense/test_sunmatrix_dense.c index 81f8aa260a..9d7b577f61 100644 --- a/examples/sunmatrix/dense/test_sunmatrix_dense.c +++ b/examples/sunmatrix/dense/test_sunmatrix_dense.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) sunindextype i, j, m, n; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/kokkos/CMakeLists.txt b/examples/sunmatrix/kokkos/CMakeLists.txt index 36380536bc..9320bf385c 100644 --- a/examples/sunmatrix/kokkos/CMakeLists.txt +++ b/examples/sunmatrix/kokkos/CMakeLists.txt @@ -53,7 +53,7 @@ foreach(example_tuple ${examples_list}) # libraries to link against target_link_libraries(${example_target} PRIVATE - sundials_generic + sundials_core sundials_nveckokkos sundials_sunmatrixkokkosdense ${EXE_EXTRA_LINK_LIBS} diff --git a/examples/sunmatrix/magmadense/test_sunmatrix_magmadense.cpp b/examples/sunmatrix/magmadense/test_sunmatrix_magmadense.cpp index 2d07eb611a..2c5b003987 100644 --- a/examples/sunmatrix/magmadense/test_sunmatrix_magmadense.cpp +++ b/examples/sunmatrix/magmadense/test_sunmatrix_magmadense.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) sunindextype i, j, k, m, n; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/onemkldense/test_sunmatrix_onemkldense.cpp b/examples/sunmatrix/onemkldense/test_sunmatrix_onemkldense.cpp index 3e074aebe8..26a15a2470 100644 --- a/examples/sunmatrix/onemkldense/test_sunmatrix_onemkldense.cpp +++ b/examples/sunmatrix/onemkldense/test_sunmatrix_onemkldense.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) sunindextype i, j, k, m, n; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp b/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp index 2de558b9b4..8a7313abb5 100644 --- a/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp +++ b/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &rank); - if (SUNContext_Create(&comm, &sunctx)) { + if (SUNContext_Create(comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 b/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 index 51c5197ba7..9a6a075d98 100644 --- a/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 +++ b/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 @@ -183,7 +183,7 @@ program main !============== Introduction ============= print *, 'Sparse SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunmatrix/sparse/test_sunmatrix_sparse.c b/examples/sunmatrix/sparse/test_sunmatrix_sparse.c index 68d329f2b7..8a29a8c844 100644 --- a/examples/sunmatrix/sparse/test_sunmatrix_sparse.c +++ b/examples/sunmatrix/sparse/test_sunmatrix_sparse.c @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) int print_timing, square; SUNContext sunctx; - if (SUNContext_Create(NULL, &sunctx)) { + if (SUNContext_Create(SUN_COMM_NULL, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 b/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 index b9325be1a1..dd3b4d4529 100644 --- a/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 +++ b/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 @@ -41,6 +41,7 @@ integer(C_INT) function unit_tests() result(retval) use fsundials_nonlinearsolver_mod use fnvector_serial_mod use fsunnonlinsol_fixedpoint_mod + use fsundials_types_mod use fsundials_context_mod implicit none @@ -203,7 +204,7 @@ program main !============== Introduction ============= print *, 'fixedpoint SUNNonlinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunnonlinsol/fixedpoint/test_sunnonlinsol_fixedpoint.c b/examples/sunnonlinsol/fixedpoint/test_sunnonlinsol_fixedpoint.c index 43b986d4d6..9a956c03a0 100644 --- a/examples/sunnonlinsol/fixedpoint/test_sunnonlinsol_fixedpoint.c +++ b/examples/sunnonlinsol/fixedpoint/test_sunnonlinsol_fixedpoint.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) printf(" damping = %"GSYM"\n", damping); /* create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* create proxy for integrator memory */ diff --git a/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 b/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 index bc9111c163..e428b365cc 100644 --- a/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 +++ b/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 @@ -47,6 +47,7 @@ module test_fsunnonlinsol_newton integer(C_INT) function unit_tests() result(retval) use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod use fsundials_nvector_mod use fsundials_matrix_mod @@ -334,7 +335,7 @@ program main !============== Introduction ============= print *, 'Newton SUNNonlinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) retval = unit_tests() if (retval /= 0) then diff --git a/examples/sunnonlinsol/newton/test_sunnonlinsol_newton.c b/examples/sunnonlinsol/newton/test_sunnonlinsol_newton.c index 0c752aec63..7e7e0dd1d0 100644 --- a/examples/sunnonlinsol/newton/test_sunnonlinsol_newton.c +++ b/examples/sunnonlinsol/newton/test_sunnonlinsol_newton.c @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) SUNContext sunctx; /* create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* create proxy for integrator memory */ diff --git a/examples/sunnonlinsol/petsc/test_sunnonlinsol_petscsnes.c b/examples/sunnonlinsol/petsc/test_sunnonlinsol_petscsnes.c index b54a4e4979..83a4974768 100644 --- a/examples/sunnonlinsol/petsc/test_sunnonlinsol_petscsnes.c +++ b/examples/sunnonlinsol/petsc/test_sunnonlinsol_petscsnes.c @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) retval = PetscInitializeNoArguments();CHKERRQ(retval); /* create SUNDIALS context */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return(1); /* create vector */ diff --git a/examples/templates/cmakelists_CUDA_MPI_ex.in b/examples/templates/cmakelists_CUDA_MPI_ex.in index 0ae08e7196..cb09f5fdc9 100644 --- a/examples/templates/cmakelists_CUDA_MPI_ex.in +++ b/examples/templates/cmakelists_CUDA_MPI_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,12 +39,12 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") # Set cache variables for CUDA compilers and flags set(CMAKE_CUDA_COMPILER - @CMAKE_CUDA_COMPILER@ + "@CMAKE_CUDA_COMPILER@" CACHE FILEPATH "CUDA compiler") set(CMAKE_CUDA_FLAGS @@ -60,15 +60,15 @@ set(CMAKE_CUDA_HOST_COMPILER # Set cache variables for MPI compiler and executable set(MPI_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(MPI_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "MPI C++ compiler") set(MPIEXEC_EXECUTABLE - @MPIEXEC_EXECUTABLE@ + "@MPIEXEC_EXECUTABLE@" CACHE FILEPATH "MPI executable") # Specify project name and languages diff --git a/examples/templates/cmakelists_CUDA_ex.in b/examples/templates/cmakelists_CUDA_ex.in index 1204206dbd..2bf3c98718 100644 --- a/examples/templates/cmakelists_CUDA_ex.in +++ b/examples/templates/cmakelists_CUDA_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,12 +39,12 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") # Set cache variables for CUDA compilers and flags set(CMAKE_CUDA_COMPILER - @CMAKE_CUDA_COMPILER@ + "@CMAKE_CUDA_COMPILER@" CACHE FILEPATH "CUDA compiler") set(CMAKE_CUDA_FLAGS diff --git a/examples/templates/cmakelists_CXX_MPI_ex.in b/examples/templates/cmakelists_CXX_MPI_ex.in index 30156af031..9fcc76a69f 100644 --- a/examples/templates/cmakelists_CXX_MPI_ex.in +++ b/examples/templates/cmakelists_CXX_MPI_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,20 +39,20 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") # Set cache variables for MPI compiler and executable set(MPI_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(MPI_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "MPI C++ compiler") set(MPIEXEC_EXECUTABLE - @MPIEXEC_EXECUTABLE@ + "@MPIEXEC_EXECUTABLE@" CACHE FILEPATH "MPI executable") # Specify project name and languages diff --git a/examples/templates/cmakelists_CXX_ex.in b/examples/templates/cmakelists_CXX_ex.in index 7b67f90ffa..2e330bc470 100644 --- a/examples/templates/cmakelists_CXX_ex.in +++ b/examples/templates/cmakelists_CXX_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,7 +39,7 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") # Specify project name and languages diff --git a/examples/templates/cmakelists_HIP_MPI_ex.in b/examples/templates/cmakelists_HIP_MPI_ex.in index 1468026fd5..e558a440b1 100644 --- a/examples/templates/cmakelists_HIP_MPI_ex.in +++ b/examples/templates/cmakelists_HIP_MPI_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,7 +39,7 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") set(AMDGPU_TARGETS @@ -48,15 +48,15 @@ set(AMDGPU_TARGETS # Set cache variables for MPI compiler and executable set(MPI_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(MPI_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "MPI C++ compiler") set(MPIEXEC_EXECUTABLE - @MPIEXEC_EXECUTABLE@ + "@MPIEXEC_EXECUTABLE@" CACHE FILEPATH "MPI executable") # Specify project name and languages diff --git a/examples/templates/cmakelists_HIP_ex.in b/examples/templates/cmakelists_HIP_ex.in index 1a159aac10..a626f3898a 100644 --- a/examples/templates/cmakelists_HIP_ex.in +++ b/examples/templates/cmakelists_HIP_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for C compilers and flags set(CMAKE_C_COMPILER - @CMAKE_C_COMPILER@ + "@CMAKE_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -31,7 +31,7 @@ endif() # Set cache variables for C++ compilers and flags set(CMAKE_CXX_COMPILER - @CMAKE_CXX_COMPILER@ + "@CMAKE_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS @@ -39,7 +39,7 @@ set(CMAKE_CXX_FLAGS CACHE STRING "CXX compiler flags") set(CMAKE_CXX_STANDARD - @CMAKE_CXX_STANDARD@ + "@CMAKE_CXX_STANDARD@" CACHE STRING "C++ standard") set(AMDGPU_TARGETS diff --git a/examples/templates/cmakelists_MPI_ex.in b/examples/templates/cmakelists_MPI_ex.in index b78e26cf1e..1e7e75779a 100644 --- a/examples/templates/cmakelists_MPI_ex.in +++ b/examples/templates/cmakelists_MPI_ex.in @@ -17,14 +17,14 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_Fortran_COMPILER - @MPI_Fortran_COMPILER@ + "@MPI_Fortran_COMPILER@" CACHE FILEPATH "Fortran compiler") set(CMAKE_Fortran_FLAGS "@CMAKE_Fortran_FLAGS@" CACHE STRING "Fortran compiler flags") set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" @@ -35,7 +35,7 @@ if("@CMAKE_C_STANDARD@") endif() set(CMAKE_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "CXX compiler") set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" diff --git a/examples/templates/cmakelists_openmp_C_ex.in b/examples/templates/cmakelists_openmp_C_ex.in index 6e1e5657b2..8f8cd768fe 100644 --- a/examples/templates/cmakelists_openmp_C_ex.in +++ b/examples/templates/cmakelists_openmp_C_ex.in @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -63,11 +63,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecopenmp ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_OPENMP library") @@ -84,7 +86,8 @@ endif() set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_openmpdev_ex.in b/examples/templates/cmakelists_openmpdev_ex.in index a5e02a4703..2c52f8e325 100644 --- a/examples/templates/cmakelists_openmpdev_ex.in +++ b/examples/templates/cmakelists_openmpdev_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -62,11 +62,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecopenmp ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR OpenMP Device Offloading library") @@ -84,6 +86,7 @@ set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIB}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parallel_CUDA_ex.in b/examples/templates/cmakelists_parallel_CUDA_ex.in index d68469a1d2..b2c32f4375 100644 --- a/examples/templates/cmakelists_parallel_CUDA_ex.in +++ b/examples/templates/cmakelists_parallel_CUDA_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -36,7 +36,7 @@ if("@CMAKE_C_STANDARD@") endif() set(CMAKE_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "C++ compiler") set(CMAKE_CXX_FLAGS @@ -52,7 +52,7 @@ set(CMAKE_CUDA_COMPILER CACHE FILEPATH "CUDA compiler") set(CMAKE_CUDA_HOST_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "CUDA host compiler") # Specify project name and languages @@ -73,11 +73,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nveccuda ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_CUDA library") @@ -100,6 +102,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_MPIPLUSX_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parallel_CXX_ex.in b/examples/templates/cmakelists_parallel_CXX_ex.in index 56fa961d5a..1b03066892 100644 --- a/examples/templates/cmakelists_parallel_CXX_ex.in +++ b/examples/templates/cmakelists_parallel_CXX_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "MPI C++ compiler") set(CMAKE_CXX_FLAGS @@ -52,11 +52,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVECPAR_LIB sundials_nvecparallel ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_PARALLEL library") @@ -89,6 +91,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_NVECSER_LIB} ${SUNDIALS_MANYVEC_LIB} ${SUNDIALS_MPIPLUSX_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parallel_C_ex.in b/examples/templates/cmakelists_parallel_C_ex.in index 77b71b7065..459a714012 100644 --- a/examples/templates/cmakelists_parallel_C_ex.in +++ b/examples/templates/cmakelists_parallel_C_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(CMAKE_C_FLAGS @@ -53,11 +53,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVECPAR_LIB sundials_nvecparallel ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_PARALLEL library") @@ -90,6 +92,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_NVECSER_LIB} ${SUNDIALS_MANYVEC_LIB} ${SUNDIALS_MPIPLUSX_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parallel_F2003_ex.in b/examples/templates/cmakelists_parallel_F2003_ex.in index 7ad328ca79..2063a78230 100644 --- a/examples/templates/cmakelists_parallel_F2003_ex.in +++ b/examples/templates/cmakelists_parallel_F2003_ex.in @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_Fortran_COMPILER - @MPI_Fortran_COMPILER@ + "@MPI_Fortran_COMPILER@" CACHE FILEPATH "MPI Fortran compiler") set(CMAKE_Fortran_FLAGS diff --git a/examples/templates/cmakelists_parallel_RAJA_ex.in b/examples/templates/cmakelists_parallel_RAJA_ex.in index 804b7c93bc..c6747a2ae1 100644 --- a/examples/templates/cmakelists_parallel_RAJA_ex.in +++ b/examples/templates/cmakelists_parallel_RAJA_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -36,7 +36,7 @@ if("@CMAKE_C_STANDARD@") endif() set(CMAKE_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "C++ compiler") set(CMAKE_CXX_FLAGS @@ -52,7 +52,7 @@ set(CMAKE_CUDA_COMPILER CACHE FILEPATH "CUDA compiler") set(CMAKE_CUDA_HOST_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "CUDA host compiler") # Specify project name and languages @@ -73,11 +73,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nveccudaraja ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_RAJA library") @@ -100,6 +102,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_MPIPLUSX_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parhyp_CXX_ex.in b/examples/templates/cmakelists_parhyp_CXX_ex.in index 8955f1a517..3eae892ef1 100644 --- a/examples/templates/cmakelists_parhyp_CXX_ex.in +++ b/examples/templates/cmakelists_parhyp_CXX_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_CXX_COMPILER - @MPI_CXX_COMPILER@ + "@MPI_CXX_COMPILER@" CACHE FILEPATH "MPI C++ compiler") set(CMAKE_CXX_FLAGS @@ -52,11 +52,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecparallel ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_PARALLEL library") @@ -79,6 +81,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_NVECPH_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_parhyp_C_ex.in b/examples/templates/cmakelists_parhyp_C_ex.in index 81371fab16..3e0687965b 100644 --- a/examples/templates/cmakelists_parhyp_C_ex.in +++ b/examples/templates/cmakelists_parhyp_C_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(CMAKE_C_FLAGS @@ -53,11 +53,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecparhyp ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_PARHYP library") @@ -74,7 +76,8 @@ endif() set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_petsc_C_ex.in b/examples/templates/cmakelists_petsc_C_ex.in index 5cb2e2098e..7b8aea5403 100644 --- a/examples/templates/cmakelists_petsc_C_ex.in +++ b/examples/templates/cmakelists_petsc_C_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @MPI_C_COMPILER@ + "@MPI_C_COMPILER@" CACHE FILEPATH "MPI C compiler") set(CMAKE_C_FLAGS diff --git a/examples/templates/cmakelists_pthreads_C_ex.in b/examples/templates/cmakelists_pthreads_C_ex.in index fae8c2df61..faa91b857e 100644 --- a/examples/templates/cmakelists_pthreads_C_ex.in +++ b/examples/templates/cmakelists_pthreads_C_ex.in @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -59,11 +59,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecpthreads ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_PTHREAD library") @@ -80,7 +82,8 @@ endif() set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_serial_CUDA_ex.in b/examples/templates/cmakelists_serial_CUDA_ex.in index dda8da6acc..57c75b2235 100644 --- a/examples/templates/cmakelists_serial_CUDA_ex.in +++ b/examples/templates/cmakelists_serial_CUDA_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -36,7 +36,7 @@ if("@CMAKE_C_STANDARD@") endif() set(CMAKE_CXX_COMPILER - @_EXAMPLES_CXX_COMPILER@ + "@_EXAMPLES_CXX_COMPILER@" CACHE FILEPATH "C++ compiler") set(CMAKE_CXX_FLAGS @@ -77,11 +77,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nveccuda ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_CUDA library") @@ -119,6 +121,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_CUSPARSEMAT_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ @@ -160,10 +163,12 @@ endif() # List of SUNDIALS libraries set(SUNDIALS_LIBRARIES + -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_CUSPARSEMAT_LIB} ${SUNDIALS_CUSOLVERSP_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # Create targets for each example diff --git a/examples/templates/cmakelists_serial_CXX_ex.in b/examples/templates/cmakelists_serial_CXX_ex.in index 2c88aabe0d..55fd9bfba7 100644 --- a/examples/templates/cmakelists_serial_CXX_ex.in +++ b/examples/templates/cmakelists_serial_CXX_ex.in @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_CXX_COMPILER - @_EXAMPLES_CXX_COMPILER@ + "@_EXAMPLES_CXX_COMPILER@" CACHE FILEPATH "C++ compiler") set(CMAKE_CXX_FLAGS @@ -54,6 +54,10 @@ set(SUNDIALS_LIBRARY_DIR CACHE PATH "Location of SUNDIALS libraries") # Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") @@ -80,6 +84,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_MANYVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) include_directories(.) diff --git a/examples/templates/cmakelists_serial_C_ex.in b/examples/templates/cmakelists_serial_C_ex.in index 33c620e643..72d1cd0644 100644 --- a/examples/templates/cmakelists_serial_C_ex.in +++ b/examples/templates/cmakelists_serial_C_ex.in @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -54,11 +54,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvecserial ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_SERIAL library") @@ -81,6 +83,7 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_MANYVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # Include the current directory diff --git a/examples/templates/cmakelists_serial_F2003_ex.in b/examples/templates/cmakelists_serial_F2003_ex.in index 4679ddf8fa..870ee5624b 100644 --- a/examples/templates/cmakelists_serial_F2003_ex.in +++ b/examples/templates/cmakelists_serial_F2003_ex.in @@ -54,7 +54,14 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + +find_library(SUNDIALS_FCORE_LIB + sundials_fcore_mod ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS Fortran core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") @@ -108,6 +115,8 @@ set(SUNDIALS_LIBRARIES ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVEC_LIB} ${SUNDIALS_SUNLS_LIB} + ${SUNDIALS_FCORE_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_serial_RAJA_ex.in b/examples/templates/cmakelists_serial_RAJA_ex.in index 975b8ab060..862a350c86 100644 --- a/examples/templates/cmakelists_serial_RAJA_ex.in +++ b/examples/templates/cmakelists_serial_RAJA_ex.in @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION @CMAKE_VERSION@) # Set cache variables for compilers and flags set(CMAKE_C_COMPILER - @_EXAMPLES_C_COMPILER@ + "@_EXAMPLES_C_COMPILER@" CACHE FILEPATH "C compiler") set(CMAKE_C_FLAGS @@ -36,7 +36,7 @@ if("@CMAKE_C_STANDARD@") endif() set(CMAKE_CXX_COMPILER - @_EXAMPLES_CXX_COMPILER@ + "@_EXAMPLES_CXX_COMPILER@" CACHE FILEPATH "C++ compiler") set(CMAKE_CXX_FLAGS @@ -52,7 +52,7 @@ set(CMAKE_CUDA_COMPILER CACHE FILEPATH "CUDA compiler") set(CMAKE_CUDA_HOST_COMPILER - @_EXAMPLES_CXX_COMPILER@ + "@_EXAMPLES_CXX_COMPILER@" CACHE FILEPATH "CUDA host compiler") # Specify project name and languages @@ -73,11 +73,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nveccudaraja ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_RAJA library") @@ -94,7 +96,8 @@ endif() set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_trilinos_CXX_ex.in b/examples/templates/cmakelists_trilinos_CXX_ex.in index 0dce9203b8..62a325c95b 100644 --- a/examples/templates/cmakelists_trilinos_CXX_ex.in +++ b/examples/templates/cmakelists_trilinos_CXX_ex.in @@ -65,11 +65,13 @@ set(SUNDIALS_LIBRARY_DIR @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CACHE PATH "Location of SUNDIALS libraries") -# Find the SUNDIALS libraries +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") - find_library(SUNDIALS_NVEC_LIB sundials_nvectrilinos ${SUNDIALS_LIBRARY_DIR} DOC "NVECTOR_TRILINOS library") @@ -86,7 +88,8 @@ endif() set(SUNDIALS_LIBRARIES -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_NVEC_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/cmakelists_xbraid_CXX_ex.in b/examples/templates/cmakelists_xbraid_CXX_ex.in index e1282d45b7..49416060d5 100644 --- a/examples/templates/cmakelists_xbraid_CXX_ex.in +++ b/examples/templates/cmakelists_xbraid_CXX_ex.in @@ -59,6 +59,10 @@ find_library(SUNDIALS_SOLVER_LIB @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} DOC "@SOLVER@ library") +find_library(SUNDIALS_CORE_LIB + sundials_core ${SUNDIALS_LIBRARY_DIR} + DOC "SUNDIALS core library") + # Find the parallel vector library find_library(SUNDIALS_NVECPAR_LIB sundials_nvecparallel ${SUNDIALS_LIBRARY_DIR} @@ -73,10 +77,12 @@ find_library(SUNDIALS_XBRAID_LIB set(SUNDIALS_EXTRA_LIBS @LIBS@ CACHE STRING "Additional libraries") # List of SUNDIALS libraries -set(SUNDIALS_LIBRARIES +set(SUNDIALS_LIBRARIES + -L${SUNDIALS_LIBRARY_DIR} ${SUNDIALS_SOLVER_LIB} ${SUNDIALS_NVECPAR_LIB} ${SUNDIALS_XBRAID_LIB} + ${SUNDIALS_CORE_LIB} ${SUNDIALS_EXTRA_LIBS}) # ------------------------------------------------------------------------------ diff --git a/examples/templates/makefile_openmp_C_ex.in b/examples/templates/makefile_openmp_C_ex.in index d420b6e69b..f352b5e92f 100644 --- a/examples/templates/makefile_openmp_C_ex.in +++ b/examples/templates/makefile_openmp_C_ex.in @@ -51,7 +51,7 @@ LINKFLAGS_SLUMT = ${LINKFLAGS}:@SUPERLUMT_LIBRARY_DIR@ TMP_INCS = ${includedir} ${INCLUDES_SLUMT} ${INCLUDES_KLU} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecopenmp ${LIBS} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecopenmp -lsundials_core ${LIBS} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_openmpdev_ex.in b/examples/templates/makefile_openmpdev_ex.in index 73ad2647fc..00d25d9fff 100644 --- a/examples/templates/makefile_openmpdev_ex.in +++ b/examples/templates/makefile_openmpdev_ex.in @@ -50,7 +50,7 @@ LINKFLAGS_SLUMT = ${LINKFLAGS}:@SUPERLUMT_LIBRARY_DIR@ TMP_INCS = ${includedir} ${INCLUDES_SLUMT} ${INCLUDES_KLU} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecopenmpdev ${LIBS} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecopenmpdev -lsundials_core ${LIBS} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_parallel_CUDA_ex.in b/examples/templates/makefile_parallel_CUDA_ex.in index 4bb0ac2288..aeceb55205 100644 --- a/examples/templates/makefile_parallel_CUDA_ex.in +++ b/examples/templates/makefile_parallel_CUDA_ex.in @@ -46,7 +46,7 @@ TMP_LIBDIRS = ${libdir} LIBDIRS = $(addprefix -L, ${TMP_LIBDIRS}) TMP_SUNDIALSLIBS = @SOLVER_LIB@ sundials_nvecparallel sundials_nveccuda sundials_nvecserial \ - sundials_nvecmpimanyvector sundials_nvecmpiplusx + sundials_nvecmpimanyvector sundials_nvecmpiplusx sundials_core SUNDIALSLIBS = $(addprefix -l, ${TMP_SUNDIALSLIBS}) LIBRARIES = ${SUNDIALSLIBS} ${LIBS} diff --git a/examples/templates/makefile_parallel_CXX_ex.in b/examples/templates/makefile_parallel_CXX_ex.in index dfe7113ea6..796720dad2 100644 --- a/examples/templates/makefile_parallel_CXX_ex.in +++ b/examples/templates/makefile_parallel_CXX_ex.in @@ -44,7 +44,7 @@ MPI_FLAGS = @MPI_FLAGS@ TMP_INCS = ${includedir} ${MPI_INC_DIR} INCLUDES = $(addprefix -I, ${TMP_INCS}) LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparallel -lsundials_nvecserial \ - -lsundials_nvecmpimanyvector -lsundials_nvecmpiplusx ${LIBS} + -lsundials_nvecmpimanyvector -lsundials_nvecmpiplusx -lsundials_core ${LIBS} EXAMPLES = $(basename @EXAMPLES@) OBJECTS = ${EXAMPLES:=.o} diff --git a/examples/templates/makefile_parallel_C_ex.in b/examples/templates/makefile_parallel_C_ex.in index 456fcf7c5a..6c07b02ee2 100644 --- a/examples/templates/makefile_parallel_C_ex.in +++ b/examples/templates/makefile_parallel_C_ex.in @@ -44,7 +44,7 @@ MPI_FLAGS = @MPI_FLAGS@ TMP_INCS = ${includedir} ${MPI_INC_DIR} INCLUDES = $(addprefix -I, ${TMP_INCS}) LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparallel -lsundials_nvecserial \ - -lsundials_nvecmpimanyvector -lsundials_nvecmpiplusx ${LIBS} + -lsundials_nvecmpimanyvector -lsundials_nvecmpiplusx -lsundials_core ${LIBS} EXAMPLES = @EXAMPLES@ EXAMPLES_DEPENDENCIES = @EXAMPLES_DEPENDENCIES@ diff --git a/examples/templates/makefile_parallel_RAJA_ex.in b/examples/templates/makefile_parallel_RAJA_ex.in index 3f8c421879..b079ebd64f 100644 --- a/examples/templates/makefile_parallel_RAJA_ex.in +++ b/examples/templates/makefile_parallel_RAJA_ex.in @@ -50,7 +50,7 @@ TMP_LIBDIRS = ${libdir} ${RAJA_LIB_DIR} LIBDIRS = $(addprefix -L, ${TMP_LIBDIRS}) TMP_SUNDIALSLIBS = @SOLVER_LIB@ sundials_nvecparallel sundials_nveccudaraja \ - sundials_nvecserial sundials_nvecmpimanyvector sundials_nvecmpiplusx + sundials_nvecserial sundials_nvecmpimanyvector sundials_nvecmpiplusx sundials_core SUNDIALSLIBS = $(addprefix -l, ${TMP_SUNDIALSLIBS}) LIBRARIES = ${SUNDIALSLIBS} ${RAJALIBS} ${CUDALIBS} ${LIBS} diff --git a/examples/templates/makefile_parhyp_CXX_ex.in b/examples/templates/makefile_parhyp_CXX_ex.in index 4a7d0f5e04..ff37ff8369 100644 --- a/examples/templates/makefile_parhyp_CXX_ex.in +++ b/examples/templates/makefile_parhyp_CXX_ex.in @@ -49,7 +49,7 @@ LINKFLAGS_HYPRE = ${LINKFLAGS}:@HYPRE_LIBRARY_DIR@ TMP_INCS = ${includedir} ${MPI_INC_DIR} ${INCLUDES_HYPRE} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparhyp -lsundials_nvecparallel ${LIBS} ${LIBRARIES_HYPRE} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparhyp -lsundials_nvecparallel -lsundials_core ${LIBS} ${LIBRARIES_HYPRE} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_parhyp_C_ex.in b/examples/templates/makefile_parhyp_C_ex.in index 737f4c176b..8bde256fe0 100644 --- a/examples/templates/makefile_parhyp_C_ex.in +++ b/examples/templates/makefile_parhyp_C_ex.in @@ -49,7 +49,7 @@ LINKFLAGS_HYPRE = ${LINKFLAGS}:@HYPRE_LIBRARY_DIR@ TMP_INCS = ${includedir} ${MPI_INC_DIR} ${INCLUDES_HYPRE} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparhyp ${LIBS} ${LIBRARIES_HYPRE} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparhyp -lsundials_core ${LIBS} ${LIBRARIES_HYPRE} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_petsc_C_ex.in b/examples/templates/makefile_petsc_C_ex.in index fa1c68dd08..c0b71564cb 100644 --- a/examples/templates/makefile_petsc_C_ex.in +++ b/examples/templates/makefile_petsc_C_ex.in @@ -51,7 +51,7 @@ LINKFLAGS_PETSC = ${LINKFLAGS} TMP_INCS = ${includedir} ${MPI_INC_DIR} ${INCLUDES_PETSC} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecpetsc -lsundials_sunnonlinsolpetscsnes ${LIBS} ${LIBRARIES_PETSC} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecpetsc -lsundials_sunnonlinsolpetscsnes -lsundials_core ${LIBS} ${LIBRARIES_PETSC} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_pthreads_C_ex.in b/examples/templates/makefile_pthreads_C_ex.in index 2c8458ecc5..39780171fc 100644 --- a/examples/templates/makefile_pthreads_C_ex.in +++ b/examples/templates/makefile_pthreads_C_ex.in @@ -51,7 +51,7 @@ LINKFLAGS_SLUMT = ${LINKFLAGS}:@SUPERLUMT_LIBRARY_DIR@ TMP_INCS = ${includedir} ${INCLUDES_SLUMT} ${INCLUDES_KLU} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecpthreads ${LIBS} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecpthreads -lsundials_core ${LIBS} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_serial_CUDA_ex.in b/examples/templates/makefile_serial_CUDA_ex.in index e8c12f2794..a1144590c1 100644 --- a/examples/templates/makefile_serial_CUDA_ex.in +++ b/examples/templates/makefile_serial_CUDA_ex.in @@ -42,7 +42,7 @@ INCLUDES = $(addprefix -I, ${TMP_INCS}) TMP_LIBDIRS = ${libdir} LIBDIRS = $(addprefix -L, ${TMP_LIBDIRS}) -TMP_SUNDIALSLIBS = @SOLVER_LIB@ @NVECTOR_LIB@ @SUNMAT_LIB@ @SUNLS_LIB@ +TMP_SUNDIALSLIBS = @SOLVER_LIB@ @NVECTOR_LIB@ @SUNMAT_LIB@ @SUNLS_LIB@ sundials_core SUNDIALSLIBS = $(addprefix -l, ${TMP_SUNDIALSLIBS}) LIBRARIES = ${SUNDIALSLIBS} ${LIBS} diff --git a/examples/templates/makefile_serial_C_ex.in b/examples/templates/makefile_serial_C_ex.in index fc9c4a6389..e3bf6b7787 100644 --- a/examples/templates/makefile_serial_C_ex.in +++ b/examples/templates/makefile_serial_C_ex.in @@ -51,7 +51,7 @@ LINKFLAGS_SLUMT = ${LINKFLAGS}:@SUPERLUMT_LIBRARY_DIR@ TMP_INCS = ${includedir} ${INCLUDES_SLUMT} ${INCLUDES_KLU} INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecserial -lsundials_nvecmanyvector ${LIBS} +LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecserial -lsundials_nvecmanyvector -lsundials_core ${LIBS} # ----------------------------------------------------------------------------------------- diff --git a/examples/templates/makefile_serial_F2003_ex.in b/examples/templates/makefile_serial_F2003_ex.in index 0875c76241..4c4f814d55 100644 --- a/examples/templates/makefile_serial_F2003_ex.in +++ b/examples/templates/makefile_serial_F2003_ex.in @@ -38,7 +38,7 @@ LINKFLAGS = -Wl,-rpath,@libdir@ INCLUDES_KLU = ${INCLUDES} -I@KLU_INCLUDE_DIR@ LIBRARIES_KLU = ${LIBRARIES} \ -lsundials_sunmatrixsparse -lsundials_fsunmatrixsparse_mod \ - -lsundials_sunlinsolklu -lsundials_fsunlinsolklu_mod \ + -lsundials_sunlinsolklu -lsundials_fsunlinsolklu_mod -lsundials_fcore_mod -lsundials_core \ @KLU_LIBS@ LINKFLAGS_KLU = ${LINKFLAGS}:@KLU_LIBRARY_DIR@ diff --git a/examples/templates/makefile_serial_RAJA_ex.in b/examples/templates/makefile_serial_RAJA_ex.in index e6fa7aeced..7baddb719a 100644 --- a/examples/templates/makefile_serial_RAJA_ex.in +++ b/examples/templates/makefile_serial_RAJA_ex.in @@ -45,7 +45,7 @@ INCLUDES = $(addprefix -I, ${TMP_INCS}) TMP_LIBDIRS = ${libdir} ${RAJA_LIB_DIR} LIBDIRS = $(addprefix -L, ${TMP_LIBDIRS}) -TMP_SUNDIALSLIBS = @SOLVER_LIB@ @NVECTOR_LIB@ +TMP_SUNDIALSLIBS = @SOLVER_LIB@ @NVECTOR_LIB@ sundials_core SUNDIALSLIBS = $(addprefix -l, ${TMP_SUNDIALSLIBS}) LIBRARIES = ${SUNDIALSLIBS} ${RAJALIBS} ${LIBS} diff --git a/examples/templates/makefile_trilinos_CXX_ex.in b/examples/templates/makefile_trilinos_CXX_ex.in index cdf5bae12e..b704006140 100644 --- a/examples/templates/makefile_trilinos_CXX_ex.in +++ b/examples/templates/makefile_trilinos_CXX_ex.in @@ -43,7 +43,7 @@ TRILINOS_LIBRARIES = -L@Trilinos_LIBRARY_DIRS@;@Trilinos_LIBRARIES@ TRILINOS_TPL_LIBRARIES = @Trilinos_TPL_LIBRARIES@ TRILIBS = $(subst ;, -l, ${TRILINOS_LIBRARIES}) TRITPLS = $(subst ;, , ${TRILINOS_TPL_LIBRARIES}) -LIBRARIES = -lsundials_nvectrilinos -l@SOLVER_LIB@ ${TRILIBS} ${LIBS} ${TRITPLS} +LIBRARIES = -lsundials_nvectrilinos -l@SOLVER_LIB@ -lsundials_core ${TRILIBS} ${LIBS} ${TRITPLS} EXAMPLES = @EXAMPLES@ EXAMPLES_DEPENDENCIES = @EXAMPLES_DEPENDENCIES@ diff --git a/examples/templates/makefile_xbraid_CXX_ex.in b/examples/templates/makefile_xbraid_CXX_ex.in index c152b726ac..e0e925eb7b 100644 --- a/examples/templates/makefile_xbraid_CXX_ex.in +++ b/examples/templates/makefile_xbraid_CXX_ex.in @@ -26,7 +26,7 @@ LDFLAGS = @CMAKE_EXE_LINKER_FLAGS_RELEASE@ # SUNDIALS includes and libraries SUNDIALS_INCLUDES = @CMAKE_INSTALL_PREFIX@/include SUNDIALS_LIB_DIR = @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -SUNDIALS_LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparallel -l@SOLVER_LIB@_xbraid +SUNDIALS_LIBRARIES = -l@SOLVER_LIB@ -lsundials_nvecparallel -l@SOLVER_LIB@_xbraid -lsundials_core # XBraid includes and libraries XBRAID_INCLUDES = @XBRAID_INCS@ diff --git a/examples/utilities/test_utilities.f90 b/examples/utilities/test_utilities.f90 index 7ff5c32fe2..8fb0c7e53d 100644 --- a/examples/utilities/test_utilities.f90 +++ b/examples/utilities/test_utilities.f90 @@ -17,6 +17,7 @@ module test_utilities use, intrinsic :: iso_c_binding + use fsundials_types_mod use fsundials_context_mod implicit none @@ -40,8 +41,8 @@ module test_utilities subroutine Test_Init(comm) implicit none - type(C_PTR), value :: comm - integer(C_INT) :: retval + integer(C_INT), value :: comm + integer(C_INT) :: retval retval = FSUNContext_Create(comm, sunctx) if (retval /= 0) then diff --git a/include/nvector/nvector_mpimanyvector.h b/include/nvector/nvector_mpimanyvector.h index bc975e03d7..7d1f1d14c3 100644 --- a/include/nvector/nvector_mpimanyvector.h +++ b/include/nvector/nvector_mpimanyvector.h @@ -93,7 +93,7 @@ SUNDIALS_EXPORT N_Vector N_VClone_MPIManyVector(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_MPIManyVector(N_Vector v); SUNDIALS_EXPORT void N_VSpace_MPIManyVector(N_Vector v, sunindextype *lrw, sunindextype *liw); -SUNDIALS_EXPORT void *N_VGetCommunicator_MPIManyVector(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_MPIManyVector(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_MPIManyVector(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetSubvectorLocalLength_MPIManyVector(N_Vector v, sunindextype vec_num); SUNDIALS_EXPORT void N_VLinearSum_MPIManyVector(sunrealtype a, N_Vector x, diff --git a/include/nvector/nvector_parallel.h b/include/nvector/nvector_parallel.h index 1a2ad48195..d00d605d5e 100644 --- a/include/nvector/nvector_parallel.h +++ b/include/nvector/nvector_parallel.h @@ -122,7 +122,7 @@ SUNDIALS_EXPORT void N_VSpace_Parallel(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT sunrealtype *N_VGetArrayPointer_Parallel(N_Vector v); SUNDIALS_EXPORT void N_VSetArrayPointer_Parallel(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT void *N_VGetCommunicator_Parallel(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Parallel(N_Vector v); /* standard vector operations */ SUNDIALS_EXPORT void N_VLinearSum_Parallel(sunrealtype a, N_Vector x, sunrealtype b, N_Vector y, N_Vector z); diff --git a/include/nvector/nvector_parhyp.h b/include/nvector/nvector_parhyp.h index 1287ac5128..bab5b1505d 100644 --- a/include/nvector/nvector_parhyp.h +++ b/include/nvector/nvector_parhyp.h @@ -98,7 +98,7 @@ SUNDIALS_EXPORT void N_VSpace_ParHyp(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT sunrealtype *N_VGetArrayPointer_ParHyp(N_Vector v); SUNDIALS_EXPORT void N_VSetArrayPointer_ParHyp(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT void *N_VGetCommunicator_ParHyp(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_ParHyp(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_ParHyp(N_Vector v); /* standard vector operations */ diff --git a/include/nvector/nvector_petsc.h b/include/nvector/nvector_petsc.h index 0edf01e560..908a891cbb 100644 --- a/include/nvector/nvector_petsc.h +++ b/include/nvector/nvector_petsc.h @@ -92,7 +92,7 @@ SUNDIALS_EXPORT N_Vector N_VClone_Petsc(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_Petsc(N_Vector v); SUNDIALS_EXPORT void N_VSpace_Petsc(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT void N_VSetArrayPointer_Petsc(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT void *N_VGetCommunicator_Petsc(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Petsc(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_Petsc(N_Vector v); /* standard vector operations */ diff --git a/include/nvector/nvector_trilinos.h b/include/nvector/nvector_trilinos.h index bc98564880..c9bbeb30ee 100644 --- a/include/nvector/nvector_trilinos.h +++ b/include/nvector/nvector_trilinos.h @@ -98,7 +98,7 @@ SUNDIALS_EXPORT N_Vector N_VCloneEmpty_Trilinos(N_Vector w); SUNDIALS_EXPORT N_Vector N_VClone_Trilinos(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_Trilinos(N_Vector v); SUNDIALS_EXPORT void N_VSpace_Trilinos(N_Vector v, sunindextype *lrw, sunindextype *liw); -SUNDIALS_EXPORT void *N_VGetCommunicator_Trilinos(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Trilinos(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_Trilinos(N_Vector v); SUNDIALS_EXPORT void N_VLinearSum_Trilinos(sunrealtype a, N_Vector x, sunrealtype b, N_Vector y, N_Vector z); SUNDIALS_EXPORT void N_VConst_Trilinos(sunrealtype c, N_Vector z); diff --git a/include/sundials/sundials_config.in b/include/sundials/sundials_config.in index 23846def6d..1cddb359ce 100644 --- a/include/sundials/sundials_config.in +++ b/include/sundials/sundials_config.in @@ -96,9 +96,6 @@ /* BUILD SUNDIALS with logging functionalities */ #define SUNDIALS_LOGGING_LEVEL @SUNDIALS_LOGGING_LEVEL@ -/* BUILD SUNDIALS with MPI-enabled logging */ -#cmakedefine SUNDIALS_LOGGING_ENABLE_MPI - /* Is snprintf available? */ #cmakedefine SUNDIALS_C_COMPILER_HAS_SNPRINTF_AND_VA_COPY #ifndef SUNDIALS_C_COMPILER_HAS_SNPRINTF_AND_VA_COPY diff --git a/include/sundials/sundials_context.h b/include/sundials/sundials_context.h index 6fef61b81d..b93d1f6762 100644 --- a/include/sundials/sundials_context.h +++ b/include/sundials/sundials_context.h @@ -29,7 +29,7 @@ extern "C" { typedef struct _SUNContext* SUNContext; -SUNDIALS_EXPORT int SUNContext_Create(void* comm, SUNContext* ctx); +SUNDIALS_EXPORT int SUNContext_Create(SUNComm comm, SUNContext* ctx); SUNDIALS_EXPORT int SUNContext_GetProfiler(SUNContext sunctx, SUNProfiler* profiler); SUNDIALS_EXPORT int SUNContext_SetProfiler(SUNContext sunctx, SUNProfiler profiler); SUNDIALS_EXPORT int SUNContext_GetLogger(SUNContext sunctx, SUNLogger* logger); diff --git a/include/sundials/sundials_context.hpp b/include/sundials/sundials_context.hpp index 92149d6546..b481c5d0c0 100644 --- a/include/sundials/sundials_context.hpp +++ b/include/sundials/sundials_context.hpp @@ -20,13 +20,14 @@ #include #include #include +#include "sundials/sundials_types.h" namespace sundials { class Context : public sundials::ConvertibleTo { public: - explicit Context(void* comm = nullptr) + explicit Context(SUNComm comm = SUN_COMM_NULL) { sunctx_ = std::make_unique(); SUNContext_Create(comm, sunctx_.get()); diff --git a/include/sundials/sundials_logger.h b/include/sundials/sundials_logger.h index 95790402ba..e9f827797d 100644 --- a/include/sundials/sundials_logger.h +++ b/include/sundials/sundials_logger.h @@ -35,9 +35,9 @@ typedef enum { SUN_LOGLEVEL_DEBUG = 4 } SUNLogLevel; -SUNDIALS_EXPORT int SUNLogger_Create(void* comm, int output_rank, +SUNDIALS_EXPORT int SUNLogger_Create(SUNComm comm, int output_rank, SUNLogger* logger); -SUNDIALS_EXPORT int SUNLogger_CreateFromEnv(void* comm, SUNLogger* logger); +SUNDIALS_EXPORT int SUNLogger_CreateFromEnv(SUNComm comm, SUNLogger* logger); SUNDIALS_EXPORT int SUNLogger_SetErrorFilename(SUNLogger logger, const char* error_filename); SUNDIALS_EXPORT int SUNLogger_SetWarningFilename(SUNLogger logger, diff --git a/include/sundials/sundials_nvector.h b/include/sundials/sundials_nvector.h index 8cb15d2d9d..183f34c929 100644 --- a/include/sundials/sundials_nvector.h +++ b/include/sundials/sundials_nvector.h @@ -110,7 +110,7 @@ struct _generic_N_Vector_Ops sunrealtype* (*nvgetarraypointer)(N_Vector); sunrealtype* (*nvgetdevicearraypointer)(N_Vector); void (*nvsetarraypointer)(sunrealtype*, N_Vector); - void* (*nvgetcommunicator)(N_Vector); + SUNComm (*nvgetcommunicator)(N_Vector); sunindextype (*nvgetlength)(N_Vector); sunindextype (*nvgetlocallength)(N_Vector); @@ -221,7 +221,7 @@ SUNDIALS_EXPORT void N_VSpace(N_Vector v, sunindextype* lrw, sunindextype* liw); SUNDIALS_EXPORT sunrealtype* N_VGetArrayPointer(N_Vector v); SUNDIALS_EXPORT sunrealtype* N_VGetDeviceArrayPointer(N_Vector v); SUNDIALS_EXPORT void N_VSetArrayPointer(sunrealtype* v_data, N_Vector v); -SUNDIALS_EXPORT void* N_VGetCommunicator(N_Vector v); +SUNDIALS_EXPORT SUNComm N_VGetCommunicator(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLocalLength(N_Vector v); diff --git a/include/sundials/sundials_profiler.h b/include/sundials/sundials_profiler.h index a7a1666736..2081932dc5 100644 --- a/include/sundials/sundials_profiler.h +++ b/include/sundials/sundials_profiler.h @@ -17,7 +17,8 @@ #include -#include "sundials/sundials_config.h" +#include +#include #if defined(SUNDIALS_BUILD_WITH_PROFILING) && defined(SUNDIALS_CALIPER_ENABLED) #include "caliper/cali.h" @@ -29,7 +30,7 @@ extern "C" { typedef struct _SUNProfiler* SUNProfiler; -SUNDIALS_EXPORT int SUNProfiler_Create(void* comm, const char* title, +SUNDIALS_EXPORT int SUNProfiler_Create(SUNComm comm, const char* title, SUNProfiler* p); SUNDIALS_EXPORT int SUNProfiler_Free(SUNProfiler* p); SUNDIALS_EXPORT int SUNProfiler_Begin(SUNProfiler p, const char* name); diff --git a/include/sundials/sundials_types.h b/include/sundials/sundials_types.h index a1dcea797e..3def8ffc70 100644 --- a/include/sundials/sundials_types.h +++ b/include/sundials/sundials_types.h @@ -54,6 +54,10 @@ #include #include +#if SUNDIALS_MPI_ENABLED +#include +#endif + #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif @@ -163,6 +167,24 @@ typedef enum { SUN_OUTPUTFORMAT_CSV } SUNOutputFormat; + +/* + *------------------------------------------------------------------ + * Type : SUNComm + *------------------------------------------------------------------ + * SUNComm replaces MPI_Comm use in SUNDIALS code. It maps to + * MPI_Comm when MPI is enabled. + *------------------------------------------------------------------ + */ + +#if SUNDIALS_MPI_ENABLED +#define SUN_COMM_NULL MPI_COMM_NULL +typedef MPI_Comm SUNComm; +#else +#define SUN_COMM_NULL 0 +typedef int SUNComm; +#endif + #ifdef __cplusplus } #endif diff --git a/src/arkode/CMakeLists.txt b/src/arkode/CMakeLists.txt index 7b50ba325f..ec0db07e50 100644 --- a/src/arkode/CMakeLists.txt +++ b/src/arkode/CMakeLists.txt @@ -72,8 +72,9 @@ sundials_add_library(sundials_arkode ${arkode_HEADERS} INCLUDE_SUBDIR arkode + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunadaptcontrollerimexgus_obj diff --git a/src/arkode/fmod/CMakeLists.txt b/src/arkode/fmod/CMakeLists.txt index 840dfb2591..4448443e9b 100644 --- a/src/arkode/fmod/CMakeLists.txt +++ b/src/arkode/fmod/CMakeLists.txt @@ -30,8 +30,9 @@ set(arkode_SOURCES sundials_add_f2003_library(sundials_farkode_mod SOURCES ${arkode_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunadaptcontrollersoderlind_mod_obj sundials_fsunadaptcontrollerimexgus_mod_obj diff --git a/src/arkode/fmod/farkode_arkstep_mod.f90 b/src/arkode/fmod/farkode_arkstep_mod.f90 index 6bbe5a1d51..0e1b172504 100644 --- a/src/arkode/fmod/farkode_arkstep_mod.f90 +++ b/src/arkode/fmod/farkode_arkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_arkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -35,7 +36,6 @@ module farkode_arkstep_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod use fsundials_adaptcontroller_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_erkstep_mod.f90 b/src/arkode/fmod/farkode_erkstep_mod.f90 index d3650fe392..f247fd72e6 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.f90 +++ b/src/arkode/fmod/farkode_erkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_erkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -35,7 +36,6 @@ module farkode_erkstep_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod use fsundials_adaptcontroller_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_mod.f90 b/src/arkode/fmod/farkode_mod.f90 index c0f017e672..929d318e31 100644 --- a/src/arkode/fmod/farkode_mod.f90 +++ b/src/arkode/fmod/farkode_mod.f90 @@ -20,6 +20,7 @@ module farkode_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -34,7 +35,6 @@ module farkode_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod use fsundials_adaptcontroller_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_mristep_mod.f90 b/src/arkode/fmod/farkode_mristep_mod.f90 index 2ab7982f6a..efdabb6d74 100644 --- a/src/arkode/fmod/farkode_mristep_mod.f90 +++ b/src/arkode/fmod/farkode_mristep_mod.f90 @@ -20,6 +20,7 @@ module farkode_mristep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -35,7 +36,6 @@ module farkode_mristep_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod use fsundials_adaptcontroller_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_sprkstep_mod.f90 b/src/arkode/fmod/farkode_sprkstep_mod.f90 index 7598cdc481..b27bd72a36 100644 --- a/src/arkode/fmod/farkode_sprkstep_mod.f90 +++ b/src/arkode/fmod/farkode_sprkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_sprkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -35,7 +36,6 @@ module farkode_sprkstep_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod use fsundials_adaptcontroller_mod - use fsundials_types_mod implicit none private diff --git a/src/cvode/CMakeLists.txt b/src/cvode/CMakeLists.txt index ed1eb55dfe..293c948ebb 100644 --- a/src/cvode/CMakeLists.txt +++ b/src/cvode/CMakeLists.txt @@ -56,6 +56,7 @@ if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) COMPILE_DEFINITIONS PRIVATE USE_CUDA LINK_LIBRARIES + PUBLIC sundials_core PRIVATE sundials_nveccuda OUTPUT_NAME sundials_cvode_fused_cuda @@ -73,6 +74,7 @@ if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) COMPILE_DEFINITIONS PRIVATE USE_HIP LINK_LIBRARIES + PUBLIC sundials_core PRIVATE sundials_nvechip OUTPUT_NAME sundials_cvode_fused_hip @@ -86,6 +88,8 @@ if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) sundials_add_library(sundials_cvode_fused_stubs SOURCES cvode_fused_stubs.c + LINK_LIBRARIES + PUBLIC sundials_core OUTPUT_NAME sundials_cvode_fused_stubs VERSION @@ -105,8 +109,9 @@ sundials_add_library(sundials_cvode ${cvode_HEADERS} INCLUDE_SUBDIR cvode + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunmatrixband_obj diff --git a/src/cvode/fmod/CMakeLists.txt b/src/cvode/fmod/CMakeLists.txt index 538ac63b9d..6a01b164df 100644 --- a/src/cvode/fmod/CMakeLists.txt +++ b/src/cvode/fmod/CMakeLists.txt @@ -20,8 +20,9 @@ set(cvode_SOURCES fcvode_mod.f90 fcvode_mod.c) sundials_add_f2003_library(sundials_fcvode_mod SOURCES ${cvode_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj sundials_fsunmatrixdense_mod_obj diff --git a/src/cvode/fmod/fcvode_mod.f90 b/src/cvode/fmod/fcvode_mod.f90 index 6cad0fc9f2..b3678dd74c 100644 --- a/src/cvode/fmod/fcvode_mod.f90 +++ b/src/cvode/fmod/fcvode_mod.f90 @@ -20,6 +20,7 @@ module fcvode_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -33,7 +34,6 @@ module fcvode_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/cvodes/CMakeLists.txt b/src/cvodes/CMakeLists.txt index 38cfc129a9..51198dfe51 100644 --- a/src/cvodes/CMakeLists.txt +++ b/src/cvodes/CMakeLists.txt @@ -55,8 +55,9 @@ sundials_add_library(sundials_cvodes ${cvodes_HEADERS} INCLUDE_SUBDIR cvodes + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunmatrixband_obj diff --git a/src/cvodes/fmod/CMakeLists.txt b/src/cvodes/fmod/CMakeLists.txt index 1b40bb3012..ac23fc4fdd 100644 --- a/src/cvodes/fmod/CMakeLists.txt +++ b/src/cvodes/fmod/CMakeLists.txt @@ -19,8 +19,9 @@ set(cvodes_SOURCES fcvodes_mod.f90 fcvodes_mod.c) sundials_add_f2003_library(sundials_fcvodes_mod SOURCES ${cvodes_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj sundials_fsunmatrixdense_mod_obj diff --git a/src/cvodes/fmod/fcvodes_mod.f90 b/src/cvodes/fmod/fcvodes_mod.f90 index d34ac805dd..14c7adc844 100644 --- a/src/cvodes/fmod/fcvodes_mod.f90 +++ b/src/cvodes/fmod/fcvodes_mod.f90 @@ -20,6 +20,7 @@ module fcvodes_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -33,7 +34,6 @@ module fcvodes_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/ida/CMakeLists.txt b/src/ida/CMakeLists.txt index b95ee46f48..a293722a13 100644 --- a/src/ida/CMakeLists.txt +++ b/src/ida/CMakeLists.txt @@ -45,8 +45,9 @@ sundials_add_library(sundials_ida ${ida_HEADERS} INCLUDE_SUBDIR ida + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunmatrixband_obj diff --git a/src/ida/fmod/CMakeLists.txt b/src/ida/fmod/CMakeLists.txt index 2d11a3bcbd..6e01be9b80 100644 --- a/src/ida/fmod/CMakeLists.txt +++ b/src/ida/fmod/CMakeLists.txt @@ -20,8 +20,9 @@ set(ida_SOURCES fida_mod.f90 fida_mod.c) sundials_add_f2003_library(sundials_fida_mod SOURCES ${ida_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj sundials_fsunmatrixdense_mod_obj diff --git a/src/idas/CMakeLists.txt b/src/idas/CMakeLists.txt index b0c6aa4df0..6c8f7716d0 100644 --- a/src/idas/CMakeLists.txt +++ b/src/idas/CMakeLists.txt @@ -49,8 +49,9 @@ sundials_add_library(sundials_idas ${idas_HEADERS} INCLUDE_SUBDIR idas + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunmatrixband_obj diff --git a/src/idas/fmod/CMakeLists.txt b/src/idas/fmod/CMakeLists.txt index e1814f8369..3e71f6ab3b 100644 --- a/src/idas/fmod/CMakeLists.txt +++ b/src/idas/fmod/CMakeLists.txt @@ -19,8 +19,9 @@ set(idas_SOURCES fidas_mod.f90 fidas_mod.c) sundials_add_f2003_library(sundials_fidas_mod SOURCES ${idas_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj sundials_fsunmatrixdense_mod_obj diff --git a/src/kinsol/CMakeLists.txt b/src/kinsol/CMakeLists.txt index aa331f6560..c024eb04d0 100644 --- a/src/kinsol/CMakeLists.txt +++ b/src/kinsol/CMakeLists.txt @@ -43,8 +43,9 @@ sundials_add_library(sundials_kinsol ${kinsol_HEADERS} INCLUDE_SUBDIR kinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsys_obj sundials_nvecserial_obj sundials_sunmatrixband_obj diff --git a/src/kinsol/fmod/CMakeLists.txt b/src/kinsol/fmod/CMakeLists.txt index e89740bbf3..697f087d77 100644 --- a/src/kinsol/fmod/CMakeLists.txt +++ b/src/kinsol/fmod/CMakeLists.txt @@ -20,8 +20,9 @@ set(kinsol_SOURCES fkinsol_mod.f90 fkinsol_mod.c) sundials_add_f2003_library(sundials_fkinsol_mod SOURCES ${kinsol_SOURCES} + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj sundials_fsunmatrixdense_mod_obj diff --git a/src/nvector/CMakeLists.txt b/src/nvector/CMakeLists.txt index 9f2f63ec05..3639014b00 100644 --- a/src/nvector/CMakeLists.txt +++ b/src/nvector/CMakeLists.txt @@ -73,6 +73,7 @@ if(BUILD_NVECTOR_KOKKOS) install(CODE "MESSAGE(\"\nInstall NVECTOR_KOKKOS\n\")") message(STATUS "Added BUILD_NVECTOR_KOKKOS module") add_library(sundials_nveckokkos INTERFACE) + target_link_libraries(sundials_nveckokkos INTERFACE sundials_core) if(ENABLE_HIP) target_link_libraries(sundials_nveckokkos INTERFACE Kokkos::kokkos hip::device) diff --git a/src/nvector/cuda/CMakeLists.txt b/src/nvector/cuda/CMakeLists.txt index f1b1d4dfc0..b44be96106 100644 --- a/src/nvector/cuda/CMakeLists.txt +++ b/src/nvector/cuda/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_nveccuda ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_cuda.h INCLUDE_SUBDIR nvector + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemcuda_obj OUTPUT_NAME sundials_nveccuda diff --git a/src/nvector/hip/CMakeLists.txt b/src/nvector/hip/CMakeLists.txt index a10c0ea61a..248d20d752 100644 --- a/src/nvector/hip/CMakeLists.txt +++ b/src/nvector/hip/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_nvechip ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_hip.h INCLUDE_SUBDIR nvector + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemhip_obj LINK_LIBRARIES PUBLIC hip::device diff --git a/src/nvector/manyvector/CMakeLists.txt b/src/nvector/manyvector/CMakeLists.txt index 96c18b94cc..5c061d950c 100644 --- a/src/nvector/manyvector/CMakeLists.txt +++ b/src/nvector/manyvector/CMakeLists.txt @@ -26,8 +26,8 @@ if(BUILD_NVECTOR_MANYVECTOR) ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_manyvector.h INCLUDE_SUBDIR nvector - OBJECT_LIBRARIES - sundials_generic_obj + LINK_LIBRARIES + PUBLIC sundials_core OUTPUT_NAME sundials_nvecmanyvector VERSION @@ -59,8 +59,8 @@ if(BUILD_NVECTOR_MPIMANYVECTOR) ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpimanyvector.h INCLUDE_SUBDIR nvector - OBJECT_LIBRARIES - sundials_generic_obj + LINK_LIBRARIES + PUBLIC sundials_core COMPILE_DEFINITIONS PRIVATE MANYVECTOR_BUILD_WITH_MPI OUTPUT_NAME diff --git a/src/nvector/manyvector/fmod/CMakeLists.txt b/src/nvector/manyvector/fmod/CMakeLists.txt index fb01abcb4b..57c35cfed6 100644 --- a/src/nvector/manyvector/fmod/CMakeLists.txt +++ b/src/nvector/manyvector/fmod/CMakeLists.txt @@ -18,8 +18,8 @@ if(BUILD_NVECTOR_MANYVECTOR) sundials_add_f2003_library(sundials_fnvecmanyvector_mod SOURCES fnvector_manyvector_mod.f90 fnvector_manyvector_mod.c - OBJECT_LIBRARIES - sundials_fgeneric_mod_obj + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OUTPUT_NAME sundials_fnvecmanyvector_mod VERSION @@ -47,8 +47,8 @@ if(BUILD_NVECTOR_MPIMANYVECTOR) sundials_add_f2003_library(sundials_fnvecmpimanyvector_mod SOURCES fnvector_mpimanyvector_mod.f90 fnvector_mpimanyvector_mod.c - OBJECT_LIBRARIES - sundials_fgeneric_mod_obj + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OUTPUT_NAME sundials_fnvecmpimanyvector_mod VERSION diff --git a/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 b/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 index 61f1c49a7d..2fce7fef05 100644 --- a/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 +++ b/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 @@ -20,6 +20,7 @@ module fnvector_manyvector_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c index 314eee4d75..6ae3b9460f 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c @@ -216,8 +216,14 @@ SWIGEXPORT N_Vector _wrap_FN_VMake_MPIManyVector(int const *farg1, int64_t const SUNContext arg4 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED - arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = 0; + } #else arg1 = *farg1; #endif @@ -362,14 +368,24 @@ SWIGEXPORT void _wrap_FN_VSpace_MPIManyVector(N_Vector farg1, int64_t *farg2, in } -SWIGEXPORT void * _wrap_FN_VGetCommunicator_MPIManyVector(N_Vector farg1) { - void * fresult ; +SWIGEXPORT int _wrap_FN_VGetCommunicator_MPIManyVector(N_Vector farg1) { + int fresult ; N_Vector arg1 = (N_Vector) 0 ; - void *result = 0 ; + MPI_Comm result; arg1 = (N_Vector)(farg1); - result = (void *)N_VGetCommunicator_MPIManyVector(arg1); + result = N_VGetCommunicator_MPIManyVector(arg1); +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + fresult = (int)(MPI_Comm_c2f(result)); + } else { + fresult = 0; + } +#else fresult = result; +#endif return fresult; } diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 index eb7edeecf0..09211fe5c9 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 @@ -20,6 +20,7 @@ module fnvector_mpimanyvector_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -203,7 +204,7 @@ function swigc_FN_VGetCommunicator_MPIManyVector(farg1) & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR) :: fresult +integer(C_INT) :: fresult end function function swigc_FN_VGetLength_MPIManyVector(farg1) & @@ -883,14 +884,14 @@ subroutine FN_VSpace_MPIManyVector(v, lrw, liw) function FN_VGetCommunicator_MPIManyVector(v) & result(swig_result) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: swig_result +integer :: swig_result type(N_Vector), target, intent(inout) :: v -type(C_PTR) :: fresult +integer(C_INT) :: fresult type(C_PTR) :: farg1 farg1 = c_loc(v) fresult = swigc_FN_VGetCommunicator_MPIManyVector(farg1) -swig_result = fresult +swig_result = int(fresult) end function function FN_VGetLength_MPIManyVector(v) & diff --git a/src/nvector/manyvector/nvector_manyvector.c b/src/nvector/manyvector/nvector_manyvector.c index baa4e0921f..c1f92b6625 100644 --- a/src/nvector/manyvector/nvector_manyvector.c +++ b/src/nvector/manyvector/nvector_manyvector.c @@ -220,37 +220,41 @@ N_Vector N_VNew_MPIManyVector(sunindextype num_subvectors, { sunindextype i; sunbooleantype nocommfound; - void* tmpcomm; - MPI_Comm comm, *vcomm; + + MPI_Comm comm, vcomm; int retval, comparison; N_Vector v = NULL; /* Check that all subvectors have identical MPI communicators (if present) */ nocommfound = SUNTRUE; - comm = MPI_COMM_NULL; + vcomm = MPI_COMM_NULL; for (i=0; i xv = N_VGetVector_Trilinos(x); /* Access Teuchos::Comm* (which is actually a Teuchos::MpiComm*) */ auto comm = Teuchos::rcp_dynamic_cast>(xv->getMap()->getComm()); - - return((void*) comm->getRawMpiComm().get()); /* extract raw pointer to MPI_Comm */ + return(*(comm->getRawMpiComm().get())); /* extract MPI_Comm */ #else return(NULL); #endif diff --git a/src/sunadaptcontroller/imexgus/CMakeLists.txt b/src/sunadaptcontroller/imexgus/CMakeLists.txt index a98374f2a3..67c7ae92cf 100644 --- a/src/sunadaptcontroller/imexgus/CMakeLists.txt +++ b/src/sunadaptcontroller/imexgus/CMakeLists.txt @@ -18,6 +18,8 @@ sundials_add_library(sundials_sunadaptcontrollerimexgus sunadaptcontroller_imexgus.c HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_imexgus.h + LINK_LIBRARIES + PUBLIC sundials_core INCLUDE_SUBDIR sunadaptcontroller OBJECT_LIB_ONLY diff --git a/src/sunadaptcontroller/imexgus/fmod/CMakeLists.txt b/src/sunadaptcontroller/imexgus/fmod/CMakeLists.txt index 7c943d4724..e4e98f7d0f 100644 --- a/src/sunadaptcontroller/imexgus/fmod/CMakeLists.txt +++ b/src/sunadaptcontroller/imexgus/fmod/CMakeLists.txt @@ -15,8 +15,9 @@ sundials_add_f2003_library(sundials_fsunadaptcontrollerimexgus_mod SOURCES fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunadaptcontrollerimexgus_mod OBJECT_LIB_ONLY diff --git a/src/sunadaptcontroller/imexgus/fmod/fsunadaptcontroller_imexgus_mod.f90 b/src/sunadaptcontroller/imexgus/fmod/fsunadaptcontroller_imexgus_mod.f90 index bb6525471f..3370588bde 100644 --- a/src/sunadaptcontroller/imexgus/fmod/fsunadaptcontroller_imexgus_mod.f90 +++ b/src/sunadaptcontroller/imexgus/fmod/fsunadaptcontroller_imexgus_mod.f90 @@ -20,9 +20,10 @@ module fsunadaptcontroller_imexgus_mod use, intrinsic :: ISO_C_BINDING - use fsundials_adaptcontroller_mod use fsundials_types_mod + use fsundials_adaptcontroller_mod use fsundials_context_mod + use fsundials_types_mod implicit none private diff --git a/src/sunadaptcontroller/soderlind/CMakeLists.txt b/src/sunadaptcontroller/soderlind/CMakeLists.txt index ef8ed40df0..4c392b4db6 100644 --- a/src/sunadaptcontroller/soderlind/CMakeLists.txt +++ b/src/sunadaptcontroller/soderlind/CMakeLists.txt @@ -18,6 +18,8 @@ sundials_add_library(sundials_sunadaptcontrollersoderlind sunadaptcontroller_soderlind.c HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_soderlind.h + LINK_LIBRARIES + PUBLIC sundials_core INCLUDE_SUBDIR sunadaptcontroller OBJECT_LIB_ONLY diff --git a/src/sunadaptcontroller/soderlind/fmod/CMakeLists.txt b/src/sunadaptcontroller/soderlind/fmod/CMakeLists.txt index 99cfdcbc0f..d6c55b3713 100644 --- a/src/sunadaptcontroller/soderlind/fmod/CMakeLists.txt +++ b/src/sunadaptcontroller/soderlind/fmod/CMakeLists.txt @@ -15,8 +15,9 @@ sundials_add_f2003_library(sundials_fsunadaptcontrollersoderlind_mod SOURCES fsunadaptcontroller_soderlind_mod.f90 fsunadaptcontroller_soderlind_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunadaptcontrollersoderlind_mod OBJECT_LIB_ONLY diff --git a/src/sunadaptcontroller/soderlind/fmod/fsunadaptcontroller_soderlind_mod.f90 b/src/sunadaptcontroller/soderlind/fmod/fsunadaptcontroller_soderlind_mod.f90 index c186227418..9245c8060c 100644 --- a/src/sunadaptcontroller/soderlind/fmod/fsunadaptcontroller_soderlind_mod.f90 +++ b/src/sunadaptcontroller/soderlind/fmod/fsunadaptcontroller_soderlind_mod.f90 @@ -20,9 +20,10 @@ module fsunadaptcontroller_soderlind_mod use, intrinsic :: ISO_C_BINDING - use fsundials_adaptcontroller_mod use fsundials_types_mod + use fsundials_adaptcontroller_mod use fsundials_context_mod + use fsundials_types_mod implicit none private diff --git a/src/sundials/CMakeLists.txt b/src/sundials/CMakeLists.txt index 13521d9798..619e607428 100644 --- a/src/sundials/CMakeLists.txt +++ b/src/sundials/CMakeLists.txt @@ -104,16 +104,21 @@ endif() # Add prefix with complete path to the source files add_prefix(${SUNDIALS_SOURCE_DIR}/src/sundials/ sundials_SOURCES) -if(SUNDIALS_LOGGING_ENABLE_MPI) - if(ENABLE_MPI AND MPI_C_FOUND) - # Workaround bug in CMake < 3.17.3 when using MPI::MPI_CXX and CUDA - set(_include_mpi_if_needed PUBLIC ${MPI_C_INCLUDE_DIRS}) - set(_link_mpi_if_needed PUBLIC ${MPI_C_LIBRARIES}) +if(ENABLE_MPI AND MPI_C_FOUND) + set(_link_mpi_if_needed PUBLIC MPI::MPI_C) +endif() + +if(SUNDIALS_BUILD_WITH_PROFILING) + if(ENABLE_CALIPER) + set(_link_caliper_if_needed PUBLIC caliper) + endif() + if(ENABLE_ADIAK) + set(_link_adiak_if_needed PUBLIC adiak::adiak ${CMAKE_DL_LIBS}) endif() endif() # Create a library out of the generic sundials modules -sundials_add_library(sundials_generic +sundials_add_library(sundials_core SOURCES ${sundials_SOURCES} HEADERS @@ -125,7 +130,7 @@ sundials_add_library(sundials_generic LINK_LIBRARIES ${_link_mpi_if_needed} OUTPUT_NAME - sundials_generic + sundials_core VERSION ${sundialslib_VERSION} SOVERSION @@ -135,7 +140,7 @@ sundials_add_library(sundials_generic # SUNDIALS_EXPORT macro include(GenerateExportHeader) generate_export_header( - sundials_generic BASE_NAME SUNDIALS + sundials_core BASE_NAME SUNDIALS EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/include/sundials/sundials_export.h" ) diff --git a/src/sundials/fmod/CMakeLists.txt b/src/sundials/fmod/CMakeLists.txt index 94325ce9d8..d244b1ecd8 100644 --- a/src/sundials/fmod/CMakeLists.txt +++ b/src/sundials/fmod/CMakeLists.txt @@ -40,8 +40,9 @@ if(SUNDIALS_BUILD_WITH_PROFILING) fsundials_profiler_mod.c) endif() -sundials_add_f2003_library(sundials_fgeneric_mod +sundials_add_f2003_library(sundials_fcore_mod SOURCES ${sundials_SOURCES} - OBJECT_LIB_ONLY + LINK_LIBRARIES + PUBLIC sundials_core ) diff --git a/src/sundials/fmod/fsundials_adaptcontroller_mod.f90 b/src/sundials/fmod/fsundials_adaptcontroller_mod.f90 index 0e59f3f6d3..7813ff1155 100644 --- a/src/sundials/fmod/fsundials_adaptcontroller_mod.f90 +++ b/src/sundials/fmod/fsundials_adaptcontroller_mod.f90 @@ -7,6 +7,7 @@ module fsundials_adaptcontroller_mod use, intrinsic :: ISO_C_BINDING use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod implicit none private diff --git a/src/sundials/fmod/fsundials_context_mod.c b/src/sundials/fmod/fsundials_context_mod.c index 3da738eeb8..44a0577085 100644 --- a/src/sundials/fmod/fsundials_context_mod.c +++ b/src/sundials/fmod/fsundials_context_mod.c @@ -205,6 +205,30 @@ #include "sundials/sundials_context.h" +SWIGEXPORT int _wrap_FSUNContext_Create(int const *farg1, void *farg2) { + int fresult ; + SUNComm arg1 ; + SUNContext *arg2 = (SUNContext *) 0 ; + int result; + +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif + arg2 = (SUNContext *)(farg2); + result = (int)SUNContext_Create(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNContext_GetProfiler(void *farg1, void *farg2) { int fresult ; SUNContext arg1 = (SUNContext) 0 ; @@ -261,38 +285,16 @@ SWIGEXPORT int _wrap_FSUNContext_SetLogger(void *farg1, void *farg2) { } - SWIGEXPORT int _wrap_FSUNContext_Free(void *farg1) { int fresult ; SUNContext *arg1 = (SUNContext *) 0 ; int result; -#ifdef SUNDIALS_BUILD_WITH_PROFILING - SUNProfiler profiler; -#endif - + arg1 = (SUNContext *)(farg1); -#ifdef SUNDIALS_BUILD_WITH_PROFILING - result = (int)SUNContext_GetProfiler(*arg1,&profiler); - result = (int)SUNContext_Free(arg1); - result = (int)SUNProfiler_Free(&profiler); -#else result = (int)SUNContext_Free(arg1); -#endif fresult = (int)(result); return fresult; } -SWIGEXPORT int _wrap_FSUNContext_Create(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNContext *arg2 = (SUNContext *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNContext *)(farg2); - result = (int)SUNContext_Create(arg1,arg2); - fresult = (int)(result); - return fresult; -} diff --git a/src/sundials/fmod/fsundials_context_mod.f90 b/src/sundials/fmod/fsundials_context_mod.f90 index cc493ca5bd..3417e9892e 100644 --- a/src/sundials/fmod/fsundials_context_mod.f90 +++ b/src/sundials/fmod/fsundials_context_mod.f90 @@ -18,26 +18,31 @@ ! SUNDIALS Copyright End ! --------------------------------------------------------------- - -#include "sundials/sundials_config.h" - module fsundials_context_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private ! DECLARATION CONSTRUCTS + public :: FSUNContext_Create public :: FSUNContext_GetProfiler public :: FSUNContext_SetProfiler public :: FSUNContext_GetLogger public :: FSUNContext_SetLogger - -public :: FSUNContext_Free -public :: FSUNContext_Create - + public :: FSUNContext_Free ! WRAPPER DECLARATIONS interface +function swigc_FSUNContext_Create(farg1, farg2) & +bind(C, name="_wrap_FSUNContext_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNContext_GetProfiler(farg1, farg2) & bind(C, name="_wrap_FSUNContext_GetProfiler") & result(fresult) @@ -74,7 +79,6 @@ function swigc_FSUNContext_SetLogger(farg1, farg2) & integer(C_INT) :: fresult end function - function swigc_FSUNContext_Free(farg1) & bind(C, name="_wrap_FSUNContext_Free") & result(fresult) @@ -83,21 +87,27 @@ function swigc_FSUNContext_Free(farg1) & integer(C_INT) :: fresult end function -function swigc_FSUNContext_Create(farg1, farg2) & -bind(C, name="_wrap_FSUNContext_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -integer(C_INT) :: fresult -end function - - end interface contains ! MODULE SUBPROGRAMS +function FSUNContext_Create(comm, ctx) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +integer :: comm +type(C_PTR), target, intent(inout) :: ctx +integer(C_INT) :: fresult +integer(C_INT) :: farg1 +type(C_PTR) :: farg2 + +farg1 = int(comm, C_INT) +farg2 = c_loc(ctx) +fresult = swigc_FSUNContext_Create(farg1, farg2) +swig_result = fresult +end function + function FSUNContext_GetProfiler(sunctx, profiler) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -162,45 +172,18 @@ function FSUNContext_SetLogger(sunctx, logger) & swig_result = fresult end function - function FSUNContext_Free(ctx) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 +integer(C_INT) :: fresult +type(C_PTR) :: farg1 farg1 = c_loc(ctx) fresult = swigc_FSUNContext_Free(farg1) swig_result = fresult end function -function FSUNContext_Create(comm, ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -#ifdef SUNDIALS_BUILD_WITH_PROFILING -use fsundials_profiler_mod, only : FSUNProfiler_Create -#endif -integer(C_INT) :: swig_result -type(C_PTR) :: comm -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 -#ifdef SUNDIALS_BUILD_WITH_PROFILING -type(C_PTR) :: profiler -#endif - -farg1 = comm -farg2 = c_loc(ctx) -fresult = swigc_FSUNContext_Create(c_null_ptr, farg2) -#ifdef SUNDIALS_BUILD_WITH_PROFILING -fresult = FSUNProfiler_Create(farg1, "FSUNContext Default", profiler) -fresult = swigc_FSUNContext_SetProfiler(ctx, profiler) -#endif -swig_result = fresult -end function - end module diff --git a/src/sundials/fmod/fsundials_futils_mod.f90 b/src/sundials/fmod/fsundials_futils_mod.f90 index 13f5c8720e..32846cea30 100644 --- a/src/sundials/fmod/fsundials_futils_mod.f90 +++ b/src/sundials/fmod/fsundials_futils_mod.f90 @@ -20,6 +20,7 @@ module fsundials_futils_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private diff --git a/src/sundials/fmod/fsundials_linearsolver_mod.f90 b/src/sundials/fmod/fsundials_linearsolver_mod.f90 index 2c4272768e..76a70e6330 100644 --- a/src/sundials/fmod/fsundials_linearsolver_mod.f90 +++ b/src/sundials/fmod/fsundials_linearsolver_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_linearsolver_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_logger_mod.c b/src/sundials/fmod/fsundials_logger_mod.c index 82b7767708..650d92ba5a 100644 --- a/src/sundials/fmod/fsundials_logger_mod.c +++ b/src/sundials/fmod/fsundials_logger_mod.c @@ -204,7 +204,7 @@ #include "sundials/sundials_logger.h" -#ifdef SUNDIALS_LOGGING_ENABLE_MPI +#if SUNDIALS_MPI_ENABLED #include #endif @@ -233,13 +233,49 @@ SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { return result; } -SWIGEXPORT int _wrap_FSUNLogger_CreateFromEnv(void *farg1, void *farg2) { +SWIGEXPORT int _wrap_FSUNLogger_Create(int const *farg1, int const *farg2, void *farg3) { int fresult ; - void *arg1 = (void *) 0 ; + SUNComm arg1 ; + int arg2 ; + SUNLogger *arg3 = (SUNLogger *) 0 ; + int result; + +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif + arg2 = (int)(*farg2); + arg3 = (SUNLogger *)(farg3); + result = (int)SUNLogger_Create(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FSUNLogger_CreateFromEnv(int const *farg1, void *farg2) { + int fresult ; + SUNComm arg1 ; SUNLogger *arg2 = (SUNLogger *) 0 ; int result; - arg1 = (void *)(farg1); +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif arg2 = (SUNLogger *)(farg2); result = (int)SUNLogger_CreateFromEnv(arg1,arg2); fresult = (int)(result); @@ -365,32 +401,3 @@ SWIGEXPORT int _wrap_FSUNLogger_Destroy(void *farg1) { -SWIGEXPORT int _wrap_FSUNLogger_Create(void *farg1, int const *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - SUNLogger *arg3 = (SUNLogger *) 0 ; - int result; -#ifdef SUNDIALS_LOGGING_ENABLE_MPI - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - arg3 = (SUNLogger *)(farg3); -#ifdef SUNDIALS_LOGGING_ENABLE_MPI - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNLogger_Create((void*)&comm,arg2,arg3); - } - else { - result = (int)SUNLogger_Create(arg1,arg2,arg3); - } -#else - result = (int)SUNLogger_Create(arg1,arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} - - diff --git a/src/sundials/fmod/fsundials_logger_mod.f90 b/src/sundials/fmod/fsundials_logger_mod.f90 index 550d8b5c5e..d49cc1674c 100644 --- a/src/sundials/fmod/fsundials_logger_mod.f90 +++ b/src/sundials/fmod/fsundials_logger_mod.f90 @@ -20,6 +20,7 @@ module fsundials_logger_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private @@ -36,6 +37,7 @@ module fsundials_logger_mod integer, parameter, public :: SUNLogLevel = kind(SUN_LOGLEVEL_ALL) public :: SUN_LOGLEVEL_ALL, SUN_LOGLEVEL_NONE, SUN_LOGLEVEL_ERROR, SUN_LOGLEVEL_WARNING, SUN_LOGLEVEL_INFO, & SUN_LOGLEVEL_DEBUG + public :: FSUNLogger_Create public :: FSUNLogger_CreateFromEnv type, bind(C) :: SwigArrayWrapper type(C_PTR), public :: data = C_NULL_PTR @@ -50,16 +52,23 @@ module fsundials_logger_mod public :: FSUNLogger_GetOutputRank public :: FSUNLogger_Destroy - public :: FSUNLogger_Create - - ! WRAPPER DECLARATIONS interface +function swigc_FSUNLogger_Create(farg1, farg2, farg3) & +bind(C, name="_wrap_FSUNLogger_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FSUNLogger_CreateFromEnv(farg1, farg2) & bind(C, name="_wrap_FSUNLogger_CreateFromEnv") & result(fresult) use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg1 type(C_PTR), value :: farg2 integer(C_INT) :: fresult end function @@ -143,33 +152,41 @@ function swigc_FSUNLogger_Destroy(farg1) & integer(C_INT) :: fresult end function - -function swigc_FSUNLogger_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNLogger_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function - end interface contains ! MODULE SUBPROGRAMS +function FSUNLogger_Create(comm, output_rank, logger) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +integer :: comm +integer(C_INT), intent(in) :: output_rank +type(C_PTR), target, intent(inout) :: logger +integer(C_INT) :: fresult +integer(C_INT) :: farg1 +integer(C_INT) :: farg2 +type(C_PTR) :: farg3 + +farg1 = int(comm, C_INT) +farg2 = output_rank +farg3 = c_loc(logger) +fresult = swigc_FSUNLogger_Create(farg1, farg2, farg3) +swig_result = fresult +end function + function FSUNLogger_CreateFromEnv(comm, logger) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result -type(C_PTR) :: comm +integer :: comm type(C_PTR), target, intent(inout) :: logger integer(C_INT) :: fresult -type(C_PTR) :: farg1 +integer(C_INT) :: farg1 type(C_PTR) :: farg2 -farg1 = comm +farg1 = int(comm, C_INT) farg2 = c_loc(logger) fresult = swigc_FSUNLogger_CreateFromEnv(farg1, farg2) swig_result = fresult @@ -335,24 +352,4 @@ function FSUNLogger_Destroy(logger) & end function -function FSUNLogger_Create(comm, output_rank, logger) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -integer(C_INT), intent(in) :: output_rank -type(C_PTR), target, intent(inout) :: logger -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -farg2 = output_rank -farg3 = c_loc(logger) -fresult = swigc_FSUNLogger_Create(farg1, farg2, farg3) -swig_result = fresult -end function - - end module diff --git a/src/sundials/fmod/fsundials_matrix_mod.f90 b/src/sundials/fmod/fsundials_matrix_mod.f90 index 815cbfab7a..a995110793 100644 --- a/src/sundials/fmod/fsundials_matrix_mod.f90 +++ b/src/sundials/fmod/fsundials_matrix_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_matrix_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 b/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 index 44b6e60255..ec27ef8a79 100644 --- a/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 +++ b/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_nonlinearsolver_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_nvector_mod.c b/src/sundials/fmod/fsundials_nvector_mod.c index 3cc84776ff..b91aef43b4 100644 --- a/src/sundials/fmod/fsundials_nvector_mod.c +++ b/src/sundials/fmod/fsundials_nvector_mod.c @@ -290,14 +290,24 @@ SWIGEXPORT void _wrap_FN_VSetArrayPointer(double *farg1, N_Vector farg2) { } -SWIGEXPORT void * _wrap_FN_VGetCommunicator(N_Vector farg1) { - void * fresult ; +SWIGEXPORT int _wrap_FN_VGetCommunicator(N_Vector farg1) { + int fresult ; N_Vector arg1 = (N_Vector) 0 ; - void *result = 0 ; + SUNComm result; arg1 = (N_Vector)(farg1); - result = (void *)N_VGetCommunicator(arg1); + result = (SUNComm)N_VGetCommunicator(arg1); +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + fresult = (int)(MPI_Comm_c2f(result)); + } else { + fresult = 0; + } +#else fresult = result; +#endif return fresult; } diff --git a/src/sundials/fmod/fsundials_nvector_mod.f90 b/src/sundials/fmod/fsundials_nvector_mod.f90 index 0b3cd32bf7..3085309345 100644 --- a/src/sundials/fmod/fsundials_nvector_mod.f90 +++ b/src/sundials/fmod/fsundials_nvector_mod.f90 @@ -242,7 +242,7 @@ function swigc_FN_VGetCommunicator(farg1) & result(fresult) use, intrinsic :: ISO_C_BINDING type(C_PTR), value :: farg1 -type(C_PTR) :: fresult +integer(C_INT) :: fresult end function function swigc_FN_VGetLength(farg1) & @@ -841,14 +841,14 @@ subroutine FN_VSetArrayPointer(v_data, v) function FN_VGetCommunicator(v) & result(swig_result) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: swig_result +integer :: swig_result type(N_Vector), target, intent(inout) :: v -type(C_PTR) :: fresult +integer(C_INT) :: fresult type(C_PTR) :: farg1 farg1 = c_loc(v) fresult = swigc_FN_VGetCommunicator(farg1) -swig_result = fresult +swig_result = int(fresult) end function function FN_VGetLength(v) & diff --git a/src/sundials/fmod/fsundials_profiler_mod.c b/src/sundials/fmod/fsundials_profiler_mod.c index 75599fa693..141e6f2edf 100644 --- a/src/sundials/fmod/fsundials_profiler_mod.c +++ b/src/sundials/fmod/fsundials_profiler_mod.c @@ -233,6 +233,32 @@ SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { return result; } +SWIGEXPORT int _wrap_FSUNProfiler_Create(int const *farg1, SwigArrayWrapper *farg2, void *farg3) { + int fresult ; + SUNComm arg1 ; + char *arg2 = (char *) 0 ; + SUNProfiler *arg3 = (SUNProfiler *) 0 ; + int result; + +#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif + arg2 = (char *)(farg2->data); + arg3 = (SUNProfiler *)(farg3); + result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNProfiler_Free(void *farg1) { int fresult ; SUNProfiler *arg1 = (SUNProfiler *) 0 ; @@ -330,32 +356,3 @@ SWIGEXPORT int _wrap_FSUNProfiler_Reset(void *farg1) { -SWIGEXPORT int _wrap_FSUNProfiler_Create(void *farg1, SwigArrayWrapper *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - char *arg2 = (char *) 0 ; - SUNProfiler *arg3 = (SUNProfiler *) 0 ; - int result; -#if SUNDIALS_MPI_ENABLED - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (char *)(farg2->data); - arg3 = (SUNProfiler *)(farg3); -#if SUNDIALS_MPI_ENABLED - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNProfiler_Create((void*)&comm,(char const *)arg2,arg3); - } - else { - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); - } -#else - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} - - diff --git a/src/sundials/fmod/fsundials_profiler_mod.f90 b/src/sundials/fmod/fsundials_profiler_mod.f90 index 328243e3a3..f5f3eec902 100644 --- a/src/sundials/fmod/fsundials_profiler_mod.f90 +++ b/src/sundials/fmod/fsundials_profiler_mod.f90 @@ -20,15 +20,17 @@ module fsundials_profiler_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private ! DECLARATION CONSTRUCTS - public :: FSUNProfiler_Free type, bind(C) :: SwigArrayWrapper type(C_PTR), public :: data = C_NULL_PTR integer(C_SIZE_T), public :: size = 0 end type + public :: FSUNProfiler_Create + public :: FSUNProfiler_Free public :: FSUNProfiler_Begin public :: FSUNProfiler_End public :: FSUNProfiler_GetTimerResolution @@ -36,11 +38,19 @@ module fsundials_profiler_mod public :: FSUNProfiler_Print public :: FSUNProfiler_Reset - public :: FSUNProfiler_Create - - ! WRAPPER DECLARATIONS interface +function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & +bind(C, name="_wrap_FSUNProfiler_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +integer(C_INT), intent(in) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FSUNProfiler_Free(farg1) & bind(C, name="_wrap_FSUNProfiler_Free") & result(fresult) @@ -106,36 +116,11 @@ function swigc_FSUNProfiler_Reset(farg1) & integer(C_INT) :: fresult end function - -function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNProfiler_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(C_PTR), value :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function - end interface contains ! MODULE SUBPROGRAMS -function FSUNProfiler_Free(p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 - -farg1 = c_loc(p) -fresult = swigc_FSUNProfiler_Free(farg1) -swig_result = fresult -end function - subroutine SWIG_string_to_chararray(string, chars, wrap) use, intrinsic :: ISO_C_BINDING @@ -154,6 +139,39 @@ subroutine SWIG_string_to_chararray(string, chars, wrap) wrap%size = len(string) end subroutine +function FSUNProfiler_Create(comm, title, p) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +integer :: comm +character(kind=C_CHAR, len=*), target :: title +character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars +type(C_PTR), target, intent(inout) :: p +integer(C_INT) :: fresult +integer(C_INT) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR) :: farg3 + +farg1 = int(comm, C_INT) +call SWIG_string_to_chararray(title, farg2_chars, farg2) +farg3 = c_loc(p) +fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) +swig_result = fresult +end function + +function FSUNProfiler_Free(p) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR), target, intent(inout) :: p +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = c_loc(p) +fresult = swigc_FSUNProfiler_Free(farg1) +swig_result = fresult +end function + function FSUNProfiler_Begin(p, name) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -254,25 +272,4 @@ function FSUNProfiler_Reset(p) & end function -function FSUNProfiler_Create(comm, title, p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -character(kind=C_CHAR, len=*), target :: title -character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -call SWIG_string_to_chararray(title, farg2_chars, farg2) -farg3 = c_loc(p) -fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) -swig_result = fresult -end function - - end module diff --git a/src/sundials/fmod/fsundials_types_mod.c b/src/sundials/fmod/fsundials_types_mod.c index e71eab7a3c..5e15ad4735 100644 --- a/src/sundials/fmod/fsundials_types_mod.c +++ b/src/sundials/fmod/fsundials_types_mod.c @@ -216,4 +216,10 @@ #error "The Fortran bindings are only targeted at 64-bit indices" #endif +SWIGEXPORT SWIGEXTERN int const _wrap_SUNFALSE = (int)(0); + +SWIGEXPORT SWIGEXTERN int const _wrap_SUNTRUE = (int)(1); + +SWIGEXPORT SWIGEXTERN int const _wrap_SUN_COMM_NULL = (int)(0); + diff --git a/src/sundials/fmod/fsundials_types_mod.f90 b/src/sundials/fmod/fsundials_types_mod.f90 index 38f3d40cca..c2823b52ad 100644 --- a/src/sundials/fmod/fsundials_types_mod.f90 +++ b/src/sundials/fmod/fsundials_types_mod.f90 @@ -24,8 +24,10 @@ module fsundials_types_mod private ! DECLARATION CONSTRUCTS - integer(C_INT), parameter, public :: SUNFALSE = 0_C_INT - integer(C_INT), parameter, public :: SUNTRUE = 1_C_INT + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUNFALSE") :: SUNFALSE + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUNTRUE") :: SUNTRUE ! typedef enum SUNOutputFormat enum, bind(c) enumerator :: SUN_OUTPUTFORMAT_TABLE @@ -33,5 +35,7 @@ module fsundials_types_mod end enum integer, parameter, public :: SUNOutputFormat = kind(SUN_OUTPUTFORMAT_TABLE) public :: SUN_OUTPUTFORMAT_TABLE, SUN_OUTPUTFORMAT_CSV + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUN_COMM_NULL") :: SUN_COMM_NULL end module diff --git a/src/sundials/sundials_context.c b/src/sundials/sundials_context.c index 9ff4204da7..0371118d52 100644 --- a/src/sundials/sundials_context.c +++ b/src/sundials/sundials_context.c @@ -30,30 +30,35 @@ void sunAdiakCollectMetadata(); #endif -int SUNContext_Create(void* comm, SUNContext* sunctx) +int SUNContext_Create(SUNComm comm, SUNContext* sunctx) { SUNProfiler profiler = NULL; SUNLogger logger = NULL; + #if defined(SUNDIALS_BUILD_WITH_PROFILING) && !defined(SUNDIALS_CALIPER_ENABLED) if (SUNProfiler_Create(comm, "SUNContext Default", &profiler)) return (-1); #endif #ifdef SUNDIALS_ADIAK_ENABLED - adiak_init(comm); - sunAdiakCollectMetadata(comm); + adiak_init(&comm); + sunAdiakCollectMetadata(); #endif #if SUNDIALS_LOGGING_LEVEL > 0 -#if defined(SUNDIALS_LOGGING_ENABLE_MPI) +#if SUNDIALS_MPI_ENABLED if (SUNLogger_CreateFromEnv(comm, &logger)) #else - if (SUNLogger_CreateFromEnv(NULL, &logger)) + if (SUNLogger_CreateFromEnv(SUN_COMM_NULL, &logger)) #endif { return (-1); } #else - if (SUNLogger_Create(NULL, 0, &logger)) +#if SUNDIALS_MPI_ENABLED + if (SUNLogger_Create(comm, 0, &logger)) +#else + if (SUNLogger_Create(SUN_COMM_NULL, 0, &logger)) +#endif { return (-1); } @@ -280,7 +285,7 @@ void sunAdiakCollectMetadata() { adiak_namevalue("magma_version", 2, NULL, "%s", SUN_MAGMA_VERSION); #endif -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED adiak_namevalue("mpi_c_compiler", 2, NULL, "%s", SUN_MPI_C_COMPILER); adiak_namevalue("mpi_c_version", 2, NULL, "%s", SUN_MPI_C_VERSION); diff --git a/src/sundials/sundials_logger.c b/src/sundials/sundials_logger.c index ce4769c76f..d1343e77be 100644 --- a/src/sundials/sundials_logger.c +++ b/src/sundials/sundials_logger.c @@ -19,7 +19,7 @@ #include #include -#ifdef SUNDIALS_LOGGING_ENABLE_MPI +#if SUNDIALS_MPI_ENABLED #include #endif @@ -30,8 +30,6 @@ #define SUN_MAX_LOGFILE_HANDLES_ 8 /* shortcut */ -#define SUNLOGGER_MPICOMM(logger) (*((MPI_Comm*)logger->commptr)) - static void sunCreateLogMessage(SUNLogLevel lvl, int rank, const char* scope, const char* label, const char* txt, va_list args, char** log_msg) @@ -112,12 +110,12 @@ static sunbooleantype sunLoggerIsOutputRank(SUNLogger logger, int* rank_ref) { sunbooleantype retval; -#ifdef SUNDIALS_LOGGING_ENABLE_MPI +#if SUNDIALS_MPI_ENABLED int rank = 0; - if (logger->commptr) + if (logger->comm != SUN_COMM_NULL) { - MPI_Comm_rank(SUNLOGGER_MPICOMM(logger), &rank); + MPI_Comm_rank(logger->comm, &rank); if (logger->output_rank < 0) { @@ -151,7 +149,7 @@ static sunbooleantype sunLoggerIsOutputRank(SUNLogger logger, int* rank_ref) return retval; } -int SUNLogger_Create(void* comm, int output_rank, SUNLogger* logger_ptr) +int SUNLogger_Create(SUNComm comm, int output_rank, SUNLogger* logger_ptr) { SUNLogger logger = NULL; @@ -162,19 +160,19 @@ int SUNLogger_Create(void* comm, int output_rank, SUNLogger* logger_ptr) } /* Attach the comm, duplicating it if MPI is used. */ -#ifdef SUNDIALS_LOGGING_ENABLE_MPI - logger->commptr = NULL; - if (comm != NULL) +#if SUNDIALS_MPI_ENABLED + logger->comm = SUN_COMM_NULL; + if (comm != SUN_COMM_NULL) { - logger->commptr = malloc(sizeof(MPI_Comm)); - MPI_Comm_dup(*((MPI_Comm*) comm), (MPI_Comm*) logger->commptr); + MPI_Comm_dup(comm, &logger->comm); } #else - if (comm != NULL) + if (comm != SUN_COMM_NULL) { + free(logger); return -1; } - logger->commptr = NULL; + logger->comm = SUN_COMM_NULL; #endif logger->output_rank = output_rank; logger->content = NULL; @@ -201,7 +199,7 @@ int SUNLogger_Create(void* comm, int output_rank, SUNLogger* logger_ptr) return 0; } -int SUNLogger_CreateFromEnv(void* comm, SUNLogger* logger) +int SUNLogger_CreateFromEnv(SUNComm comm, SUNLogger* logger) { int retval = 0; @@ -535,27 +533,36 @@ int SUNLogger_GetOutputRank(SUNLogger logger, int* output_rank) return retval; } -int SUNLogger_Destroy(SUNLogger* logger) +int SUNLogger_Destroy(SUNLogger* logger_ptr) { int retval = 0; + SUNLogger logger = NULL; + + if (!logger_ptr) { return 0; } - if ((*logger)->destroy) + logger = *logger_ptr; + + if (logger && logger->destroy) { - retval = (*logger)->destroy(logger); + retval = logger->destroy(logger_ptr); } - else + else if (logger) { - if (logger && (*logger)) - { - /* Default implementation */ - if (sunLoggerIsOutputRank(*logger, NULL)) - { - SUNHashMap_Destroy(&(*logger)->filenames, sunCloseLogFile); - } + /* Default implementation */ - free(*logger); - *logger = NULL; + if (sunLoggerIsOutputRank(logger, NULL)) + { + SUNHashMap_Destroy(&logger->filenames, sunCloseLogFile); } + +#if SUNDIALS_MPI_ENABLED + if (logger->comm != SUN_COMM_NULL) { + MPI_Comm_free(&logger->comm); + } +#endif + + free(logger); + logger = NULL; } return retval; diff --git a/src/sundials/sundials_logger_impl.h b/src/sundials/sundials_logger_impl.h index 0609f1181f..0b0fbb3af7 100644 --- a/src/sundials/sundials_logger_impl.h +++ b/src/sundials/sundials_logger_impl.h @@ -33,7 +33,7 @@ struct SUNLogger_ { /* MPI information */ - void* commptr; + SUNComm comm; int output_rank; /* Ouput files */ diff --git a/src/sundials/sundials_nvector.c b/src/sundials/sundials_nvector.c index 018a8f20e4..05341298b6 100644 --- a/src/sundials/sundials_nvector.c +++ b/src/sundials/sundials_nvector.c @@ -339,12 +339,12 @@ void N_VSetArrayPointer(sunrealtype *v_data, N_Vector v) return; } -void *N_VGetCommunicator(N_Vector v) +SUNComm N_VGetCommunicator(N_Vector v) { if (v->ops->nvgetcommunicator) return(v->ops->nvgetcommunicator(v)); else - return(NULL); + return(SUN_COMM_NULL); } sunindextype N_VGetLength(N_Vector v) diff --git a/src/sundials/sundials_profiler.c b/src/sundials/sundials_profiler.c index adc2052c2d..8a29ab899b 100644 --- a/src/sundials/sundials_profiler.c +++ b/src/sundials/sundials_profiler.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "sundials_debug.h" #include "sundials_hashmap.h" @@ -148,14 +149,14 @@ static void sunResetTiming(sunTimerStruct* entry) struct _SUNProfiler { - void* comm; + SUNComm comm; char* title; SUNHashMap map; sunTimerStruct* overhead; double sundials_time; }; -int SUNProfiler_Create(void* comm, const char* title, SUNProfiler* p) +int SUNProfiler_Create(SUNComm comm, const char* title, SUNProfiler* p) { SUNProfiler profiler; int max_entries; @@ -163,7 +164,7 @@ int SUNProfiler_Create(void* comm, const char* title, SUNProfiler* p) *p = profiler = (SUNProfiler)malloc(sizeof(struct _SUNProfiler)); - if (profiler == NULL) return (-1); + if (profiler == NULL) { return 0; } profiler->overhead = sunTimerStructNew(); if (profiler->overhead == NULL) @@ -192,14 +193,18 @@ int SUNProfiler_Create(void* comm, const char* title, SUNProfiler* p) /* Attach the comm, duplicating it if MPI is used. */ #if SUNDIALS_MPI_ENABLED - profiler->comm = NULL; - if (comm != NULL) + profiler->comm = SUN_COMM_NULL; + if (comm != SUN_COMM_NULL) { - profiler->comm = malloc(sizeof(MPI_Comm)); - MPI_Comm_dup(*((MPI_Comm*)comm), (MPI_Comm*)profiler->comm); + MPI_Comm_dup(comm, &profiler->comm); } #else - profiler->comm = comm; + if (comm != SUN_COMM_NULL) + { + free(profiler); + return -1; + } + profiler->comm = SUN_COMM_NULL; #endif /* Copy the title of the profiler (note strlen does not include terminating @@ -227,10 +232,9 @@ int SUNProfiler_Free(SUNProfiler* p) SUNHashMap_Destroy(&(*p)->map, sunTimerStructFree); sunTimerStructFree((void*)(*p)->overhead); #if SUNDIALS_MPI_ENABLED - if ((*p)->comm) + if ((*p)->comm != SUN_COMM_NULL) { - MPI_Comm_free((*p)->comm); - free((*p)->comm); + MPI_Comm_free(&(*p)->comm); } #endif free((*p)->title); @@ -387,9 +391,9 @@ int SUNProfiler_Print(SUNProfiler p, FILE* fp) p->sundials_time = timer->elapsed; #if SUNDIALS_MPI_ENABLED - if (p->comm) + if (p->comm != SUN_COMM_NULL) { - MPI_Comm_rank(*((MPI_Comm*)p->comm), &rank); + MPI_Comm_rank(p->comm, &rank); /* Find the max and average time across all ranks */ sunCollectTimers(p); } @@ -412,7 +416,7 @@ int SUNProfiler_Print(SUNProfiler p, FILE* fp) "==================================================\n"); #if SUNDIALS_MPI_ENABLED - if (p->comm == NULL) + if (p->comm == SUN_COMM_NULL) printf( "WARNING: no MPI communicator provided, times shown are for rank 0\n"); #endif @@ -458,7 +462,7 @@ int sunCollectTimers(SUNProfiler p) { int i, rank, nranks; - MPI_Comm comm = *((MPI_Comm*)p->comm); + MPI_Comm comm = p->comm; MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &nranks); diff --git a/src/sunlinsol/CMakeLists.txt b/src/sunlinsol/CMakeLists.txt index 050c3ecb45..38bb3381b0 100644 --- a/src/sunlinsol/CMakeLists.txt +++ b/src/sunlinsol/CMakeLists.txt @@ -32,6 +32,7 @@ if(BUILD_SUNLINSOL_GINKGO) install(CODE "MESSAGE(\"\nInstall SUNLINSOL_GINKGO\n\")") message(STATUS "Added BUILD_SUNLINSOL_GINKGO module") add_library(sundials_sunlinsolginkgo INTERFACE) + target_link_libraries(sundials_sunlinsolginkgo INTERFACE sundials_core) target_include_directories(sundials_sunlinsolginkgo INTERFACE $ $ @@ -51,7 +52,7 @@ if(BUILD_SUNLINSOL_KOKKOSDENSE) message(STATUS "Added BUILD_SUNLINSOL_KOKKOSDENSE module") add_library(sundials_sunlinsolkokkosdense INTERFACE) target_link_libraries(sundials_sunlinsolkokkosdense INTERFACE - Kokkos::kokkos Kokkos::kokkoskernels) + sundials_core Kokkos::kokkos Kokkos::kokkoskernels) target_include_directories(sundials_sunlinsolkokkosdense INTERFACE $ $ diff --git a/src/sunlinsol/band/CMakeLists.txt b/src/sunlinsol/band/CMakeLists.txt index 3041c51c38..705517f245 100644 --- a/src/sunlinsol/band/CMakeLists.txt +++ b/src/sunlinsol/band/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunlinsolband ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_band.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixband OUTPUT_NAME diff --git a/src/sunlinsol/band/fmod/CMakeLists.txt b/src/sunlinsol/band/fmod/CMakeLists.txt index e3e3cb88a7..1df9a3736b 100644 --- a/src/sunlinsol/band/fmod/CMakeLists.txt +++ b/src/sunlinsol/band/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolband_mod SOURCES fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj LINK_LIBRARIES PUBLIC sundials_fsunmatrixband_mod OUTPUT_NAME diff --git a/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 b/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 index f544eff42f..5009f36daa 100644 --- a/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 +++ b/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_band_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/cusolversp/CMakeLists.txt b/src/sunlinsol/cusolversp/CMakeLists.txt index e2e7f95589..6154a2c4dc 100644 --- a/src/sunlinsol/cusolversp/CMakeLists.txt +++ b/src/sunlinsol/cusolversp/CMakeLists.txt @@ -23,8 +23,9 @@ sundials_add_library(sundials_sunlinsolcusolversp ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_cusolversp_batchqr.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixcusparse CUDA::cusolver PRIVATE CUDA::cusparse diff --git a/src/sunlinsol/dense/CMakeLists.txt b/src/sunlinsol/dense/CMakeLists.txt index 40e10cd3bd..e4729d9c62 100644 --- a/src/sunlinsol/dense/CMakeLists.txt +++ b/src/sunlinsol/dense/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunlinsoldense ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_dense.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixdense OUTPUT_NAME diff --git a/src/sunlinsol/dense/fmod/CMakeLists.txt b/src/sunlinsol/dense/fmod/CMakeLists.txt index 24c10e5f70..4fd4c9df21 100644 --- a/src/sunlinsol/dense/fmod/CMakeLists.txt +++ b/src/sunlinsol/dense/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsoldense_mod SOURCES fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod OUTPUT_NAME diff --git a/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 b/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 index 6234253719..3c2fe3b810 100644 --- a/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 +++ b/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_dense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/klu/CMakeLists.txt b/src/sunlinsol/klu/CMakeLists.txt index 69c4eb0ddc..442c2a905f 100644 --- a/src/sunlinsol/klu/CMakeLists.txt +++ b/src/sunlinsol/klu/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsolklu ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_klu.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse SUNDIALS::KLU OUTPUT_NAME diff --git a/src/sunlinsol/klu/fmod/CMakeLists.txt b/src/sunlinsol/klu/fmod/CMakeLists.txt index c6b9504fa5..ac1f0a4c43 100644 --- a/src/sunlinsol/klu/fmod/CMakeLists.txt +++ b/src/sunlinsol/klu/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolklu_mod SOURCES fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj LINK_LIBRARIES PUBLIC sundials_fsunmatrixsparse_mod OUTPUT_NAME diff --git a/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 b/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 index a048d29508..c47191e8ec 100644 --- a/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 +++ b/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_klu_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/lapackband/CMakeLists.txt b/src/sunlinsol/lapackband/CMakeLists.txt index a89e132998..de7e6c935d 100644 --- a/src/sunlinsol/lapackband/CMakeLists.txt +++ b/src/sunlinsol/lapackband/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsollapackband ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackband.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixband "${LAPACK_LIBRARIES}" OUTPUT_NAME diff --git a/src/sunlinsol/lapackdense/CMakeLists.txt b/src/sunlinsol/lapackdense/CMakeLists.txt index c03f8c896e..3e3a946b89 100644 --- a/src/sunlinsol/lapackdense/CMakeLists.txt +++ b/src/sunlinsol/lapackdense/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsollapackdense ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackdense.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixdense "${LAPACK_LIBRARIES}" OUTPUT_NAME diff --git a/src/sunlinsol/lapackdense/fmod/CMakeLists.txt b/src/sunlinsol/lapackdense/fmod/CMakeLists.txt index d7b281ec71..f2b87cdbc5 100644 --- a/src/sunlinsol/lapackdense/fmod/CMakeLists.txt +++ b/src/sunlinsol/lapackdense/fmod/CMakeLists.txt @@ -18,8 +18,9 @@ sundials_add_f2003_library(sundials_fsunlinsollapackdense_mod SOURCES fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod OUTPUT_NAME diff --git a/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 b/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 index a615f9ba43..9d2f3bae85 100644 --- a/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 +++ b/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_lapackdense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/magmadense/CMakeLists.txt b/src/sunlinsol/magmadense/CMakeLists.txt index ed186d064d..55e78fb138 100644 --- a/src/sunlinsol/magmadense/CMakeLists.txt +++ b/src/sunlinsol/magmadense/CMakeLists.txt @@ -30,8 +30,9 @@ sundials_add_library(sundials_sunlinsolmagmadense ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_magmadense.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC SUNDIALS::MAGMA ${_libs_needed} OUTPUT_NAME diff --git a/src/sunlinsol/onemkldense/CMakeLists.txt b/src/sunlinsol/onemkldense/CMakeLists.txt index a25e271922..ffbdb09031 100644 --- a/src/sunlinsol/onemkldense/CMakeLists.txt +++ b/src/sunlinsol/onemkldense/CMakeLists.txt @@ -22,8 +22,9 @@ sundials_add_library(sundials_sunlinsolonemkldense ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_onemkldense.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj COMPILE_FEATURES PUBLIC cxx_std_17 INCLUDE_DIRECTORIES diff --git a/src/sunlinsol/pcg/CMakeLists.txt b/src/sunlinsol/pcg/CMakeLists.txt index 9094ba0e45..3ff6d12105 100644 --- a/src/sunlinsol/pcg/CMakeLists.txt +++ b/src/sunlinsol/pcg/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunlinsolpcg ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_pcg.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunlinsolpcg VERSION diff --git a/src/sunlinsol/pcg/fmod/CMakeLists.txt b/src/sunlinsol/pcg/fmod/CMakeLists.txt index 10b5537c75..75ff23abe5 100644 --- a/src/sunlinsol/pcg/fmod/CMakeLists.txt +++ b/src/sunlinsol/pcg/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolpcg_mod SOURCES fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunlinsolpcg_mod VERSION diff --git a/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 b/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 index 6334343b52..ddf9fb6d27 100644 --- a/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 +++ b/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_pcg_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spbcgs/CMakeLists.txt b/src/sunlinsol/spbcgs/CMakeLists.txt index e7446be084..48364cc60c 100644 --- a/src/sunlinsol/spbcgs/CMakeLists.txt +++ b/src/sunlinsol/spbcgs/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunlinsolspbcgs ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spbcgs.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunlinsolspbcgs VERSION diff --git a/src/sunlinsol/spbcgs/fmod/CMakeLists.txt b/src/sunlinsol/spbcgs/fmod/CMakeLists.txt index 7a5ed1b551..b59ecfc07c 100644 --- a/src/sunlinsol/spbcgs/fmod/CMakeLists.txt +++ b/src/sunlinsol/spbcgs/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolspbcgs_mod SOURCES fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunlinsolspbcgs_mod VERSION diff --git a/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 b/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 index 2159bfe002..feb7ee8b83 100644 --- a/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 +++ b/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spbcgs_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spfgmr/CMakeLists.txt b/src/sunlinsol/spfgmr/CMakeLists.txt index 817fbda37c..c376f83093 100644 --- a/src/sunlinsol/spfgmr/CMakeLists.txt +++ b/src/sunlinsol/spfgmr/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsolspfgmr ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spfgmr.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunlinsolspfgmr VERSION diff --git a/src/sunlinsol/spfgmr/fmod/CMakeLists.txt b/src/sunlinsol/spfgmr/fmod/CMakeLists.txt index bb669bd13f..154b6c12da 100644 --- a/src/sunlinsol/spfgmr/fmod/CMakeLists.txt +++ b/src/sunlinsol/spfgmr/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolspfgmr_mod SOURCES fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunlinsolspfgmr_mod VERSION diff --git a/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 b/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 index c6ed64bf5b..1b36e4b129 100644 --- a/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 +++ b/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spfgmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spgmr/CMakeLists.txt b/src/sunlinsol/spgmr/CMakeLists.txt index df03282a92..4c006101db 100644 --- a/src/sunlinsol/spgmr/CMakeLists.txt +++ b/src/sunlinsol/spgmr/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsolspgmr ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spgmr.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunlinsolspgmr VERSION diff --git a/src/sunlinsol/spgmr/fmod/CMakeLists.txt b/src/sunlinsol/spgmr/fmod/CMakeLists.txt index efdca22979..5c5e1da4d7 100644 --- a/src/sunlinsol/spgmr/fmod/CMakeLists.txt +++ b/src/sunlinsol/spgmr/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolspgmr_mod SOURCES fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunlinsolspgmr_mod VERSION diff --git a/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 b/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 index 77873a000a..5846a864af 100644 --- a/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 +++ b/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spgmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/sptfqmr/CMakeLists.txt b/src/sunlinsol/sptfqmr/CMakeLists.txt index 86f06b8b1b..3351440c43 100644 --- a/src/sunlinsol/sptfqmr/CMakeLists.txt +++ b/src/sunlinsol/sptfqmr/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsolsptfqmr ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_sptfqmr.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunlinsolsptfqmr VERSION diff --git a/src/sunlinsol/sptfqmr/fmod/CMakeLists.txt b/src/sunlinsol/sptfqmr/fmod/CMakeLists.txt index eaf67094cf..5b917fc5dc 100644 --- a/src/sunlinsol/sptfqmr/fmod/CMakeLists.txt +++ b/src/sunlinsol/sptfqmr/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunlinsolsptfqmr_mod SOURCES fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunlinsolsptfqmr_mod VERSION diff --git a/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 b/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 index c4d9abe539..0dc98dbcff 100644 --- a/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 +++ b/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_sptfqmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/superludist/CMakeLists.txt b/src/sunlinsol/superludist/CMakeLists.txt index 0d7ad0803f..73098474d2 100644 --- a/src/sunlinsol/superludist/CMakeLists.txt +++ b/src/sunlinsol/superludist/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunlinsolsuperludist ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superludist.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixslunrloc diff --git a/src/sunlinsol/superlumt/CMakeLists.txt b/src/sunlinsol/superlumt/CMakeLists.txt index f2a1e9ff66..01d96b63b9 100644 --- a/src/sunlinsol/superlumt/CMakeLists.txt +++ b/src/sunlinsol/superlumt/CMakeLists.txt @@ -32,8 +32,9 @@ sundials_add_library(sundials_sunlinsolsuperlumt ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superlumt.h INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse diff --git a/src/sunmatrix/CMakeLists.txt b/src/sunmatrix/CMakeLists.txt index 98d4048657..617adb3cda 100644 --- a/src/sunmatrix/CMakeLists.txt +++ b/src/sunmatrix/CMakeLists.txt @@ -28,6 +28,7 @@ if(BUILD_SUNMATRIX_GINKGO) install(CODE "MESSAGE(\"\nInstall SUNMATRIX_GINKGO\n\")") message(STATUS "Added BUILD_SUNMATRIX_GINKGO module") add_library(sundials_sunmatrixginkgo INTERFACE) + target_link_libraries(sundials_sunmatrixginkgo INTERFACE sundials_core) target_include_directories(sundials_sunmatrixginkgo INTERFACE $ $ @@ -43,7 +44,7 @@ if(BUILD_SUNMATRIX_KOKKOSDENSE) message(STATUS "Added BUILD_SUNMATRIX_KOKKOSDENSE module") add_library(sundials_sunmatrixkokkosdense INTERFACE) target_link_libraries(sundials_sunmatrixkokkosdense INTERFACE - Kokkos::kokkos Kokkos::kokkoskernels) + sundials_core Kokkos::kokkos Kokkos::kokkoskernels) target_include_directories(sundials_sunmatrixkokkosdense INTERFACE $ $ diff --git a/src/sunmatrix/band/CMakeLists.txt b/src/sunmatrix/band/CMakeLists.txt index 8f046b7273..f4397a5453 100644 --- a/src/sunmatrix/band/CMakeLists.txt +++ b/src/sunmatrix/band/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunmatrixband ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_band.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunmatrixband VERSION diff --git a/src/sunmatrix/band/fmod/CMakeLists.txt b/src/sunmatrix/band/fmod/CMakeLists.txt index 475e1b5e98..291dd05a1d 100644 --- a/src/sunmatrix/band/fmod/CMakeLists.txt +++ b/src/sunmatrix/band/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunmatrixband_mod SOURCES fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunmatrixband_mod VERSION diff --git a/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 b/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 index 409f136608..359e2dc6df 100644 --- a/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 +++ b/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_band_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmatrix/cusparse/CMakeLists.txt b/src/sunmatrix/cusparse/CMakeLists.txt index 2efa8a8f7a..48088ac339 100644 --- a/src/sunmatrix/cusparse/CMakeLists.txt +++ b/src/sunmatrix/cusparse/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunmatrixcusparse ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_cusparse.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemcuda_obj LINK_LIBRARIES PUBLIC CUDA::cusparse CUDA::cusolver diff --git a/src/sunmatrix/dense/CMakeLists.txt b/src/sunmatrix/dense/CMakeLists.txt index 3b816c0b6d..1d2a835d3f 100644 --- a/src/sunmatrix/dense/CMakeLists.txt +++ b/src/sunmatrix/dense/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunmatrixdense ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_dense.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunmatrixdense VERSION diff --git a/src/sunmatrix/dense/fmod/CMakeLists.txt b/src/sunmatrix/dense/fmod/CMakeLists.txt index 7867798de5..fd1143523e 100644 --- a/src/sunmatrix/dense/fmod/CMakeLists.txt +++ b/src/sunmatrix/dense/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunmatrixdense_mod SOURCES fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunmatrixdense_mod VERSION diff --git a/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 b/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 index 4db62d8eef..ab91b59e15 100644 --- a/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 +++ b/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_dense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmatrix/magmadense/CMakeLists.txt b/src/sunmatrix/magmadense/CMakeLists.txt index 91968550fb..c575d0709d 100644 --- a/src/sunmatrix/magmadense/CMakeLists.txt +++ b/src/sunmatrix/magmadense/CMakeLists.txt @@ -30,8 +30,9 @@ sundials_add_library(sundials_sunmatrixmagmadense ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_magmadense.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj INCLUDE_DIRECTORIES PUBLIC ${MAGMA_INCLUDE_DIR} LINK_LIBRARIES diff --git a/src/sunmatrix/onemkldense/CMakeLists.txt b/src/sunmatrix/onemkldense/CMakeLists.txt index 03accf34f5..2400484c35 100644 --- a/src/sunmatrix/onemkldense/CMakeLists.txt +++ b/src/sunmatrix/onemkldense/CMakeLists.txt @@ -22,8 +22,9 @@ sundials_add_library(sundials_sunmatrixonemkldense ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_onemkldense.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj sundials_sunmemsycl_obj COMPILE_FEATURES PUBLIC cxx_std_17 diff --git a/src/sunmatrix/slunrloc/CMakeLists.txt b/src/sunmatrix/slunrloc/CMakeLists.txt index 2b179e1355..5dda136fc9 100644 --- a/src/sunmatrix/slunrloc/CMakeLists.txt +++ b/src/sunmatrix/slunrloc/CMakeLists.txt @@ -28,8 +28,9 @@ sundials_add_library(sundials_sunmatrixslunrloc ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_slunrloc.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC SUNDIALS::SUPERLUDIST $,OpenMP::OpenMP_C,> diff --git a/src/sunmatrix/sparse/CMakeLists.txt b/src/sunmatrix/sparse/CMakeLists.txt index ce9889710f..5d644a63ae 100644 --- a/src/sunmatrix/sparse/CMakeLists.txt +++ b/src/sunmatrix/sparse/CMakeLists.txt @@ -25,8 +25,9 @@ sundials_add_library(sundials_sunmatrixsparse ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_sparse.h INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunmatrixsparse VERSION diff --git a/src/sunmatrix/sparse/fmod/CMakeLists.txt b/src/sunmatrix/sparse/fmod/CMakeLists.txt index 37cde5cdef..4584c2a50a 100644 --- a/src/sunmatrix/sparse/fmod/CMakeLists.txt +++ b/src/sunmatrix/sparse/fmod/CMakeLists.txt @@ -17,8 +17,9 @@ sundials_add_f2003_library(sundials_fsunmatrixsparse_mod SOURCES fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunmatrixsparse_mod VERSION diff --git a/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 b/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 index 3fd0722991..20e2e9e855 100644 --- a/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 +++ b/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_sparse_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmemory/cuda/CMakeLists.txt b/src/sunmemory/cuda/CMakeLists.txt index 7f1992ea6b..a3e6ae7f74 100644 --- a/src/sunmemory/cuda/CMakeLists.txt +++ b/src/sunmemory/cuda/CMakeLists.txt @@ -18,6 +18,8 @@ sundials_add_library(sundials_sunmemcuda sundials_cuda_memory.cu HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_cuda.h + LINK_LIBRARIES + PUBLIC sundials_core INCLUDE_SUBDIR sunmemory OBJECT_LIB_ONLY diff --git a/src/sunmemory/hip/CMakeLists.txt b/src/sunmemory/hip/CMakeLists.txt index b8d59605fc..6f63cc4ce8 100644 --- a/src/sunmemory/hip/CMakeLists.txt +++ b/src/sunmemory/hip/CMakeLists.txt @@ -21,6 +21,7 @@ sundials_add_library(sundials_sunmemhip INCLUDE_SUBDIR sunmemory LINK_LIBRARIES + PUBLIC sundials_core PRIVATE hip::device OBJECT_LIB_ONLY ) diff --git a/src/sunmemory/sycl/CMakeLists.txt b/src/sunmemory/sycl/CMakeLists.txt index fce6fafc91..b3ca6d3146 100644 --- a/src/sunmemory/sycl/CMakeLists.txt +++ b/src/sunmemory/sycl/CMakeLists.txt @@ -20,5 +20,7 @@ sundials_add_library(sundials_sunmemsycl ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_sycl.h INCLUDE_SUBDIR sunmemory + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIB_ONLY ) diff --git a/src/sunmemory/system/CMakeLists.txt b/src/sunmemory/system/CMakeLists.txt index 84b7ef02be..f169e287f5 100644 --- a/src/sunmemory/system/CMakeLists.txt +++ b/src/sunmemory/system/CMakeLists.txt @@ -20,5 +20,7 @@ sundials_add_library(sundials_sunmemsys ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_system.h INCLUDE_SUBDIR sunmemory + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIB_ONLY ) diff --git a/src/sunnonlinsol/fixedpoint/CMakeLists.txt b/src/sunnonlinsol/fixedpoint/CMakeLists.txt index 50d520be5e..654cae5596 100644 --- a/src/sunnonlinsol/fixedpoint/CMakeLists.txt +++ b/src/sunnonlinsol/fixedpoint/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunnonlinsolfixedpoint ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_fixedpoint.h INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunnonlinsolfixedpoint VERSION diff --git a/src/sunnonlinsol/fixedpoint/fmod/CMakeLists.txt b/src/sunnonlinsol/fixedpoint/fmod/CMakeLists.txt index 6072142348..8f676246b5 100644 --- a/src/sunnonlinsol/fixedpoint/fmod/CMakeLists.txt +++ b/src/sunnonlinsol/fixedpoint/fmod/CMakeLists.txt @@ -18,8 +18,9 @@ sundials_add_f2003_library(sundials_fsunnonlinsolfixedpoint_mod SOURCES fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunnonlinsolfixedpoint_mod VERSION diff --git a/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 b/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 index a1b693a285..7ac874f459 100644 --- a/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 +++ b/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 @@ -20,6 +20,7 @@ module fsunnonlinsol_fixedpoint_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunnonlinsol/newton/CMakeLists.txt b/src/sunnonlinsol/newton/CMakeLists.txt index 54856d2d55..6f7592cfa2 100644 --- a/src/sunnonlinsol/newton/CMakeLists.txt +++ b/src/sunnonlinsol/newton/CMakeLists.txt @@ -24,8 +24,9 @@ sundials_add_library(sundials_sunnonlinsolnewton ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_newton.h INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj OUTPUT_NAME sundials_sunnonlinsolnewton VERSION diff --git a/src/sunnonlinsol/newton/fmod/CMakeLists.txt b/src/sunnonlinsol/newton/fmod/CMakeLists.txt index 4fdadbca70..4f3ab14ddd 100644 --- a/src/sunnonlinsol/newton/fmod/CMakeLists.txt +++ b/src/sunnonlinsol/newton/fmod/CMakeLists.txt @@ -18,8 +18,9 @@ sundials_add_f2003_library(sundials_fsunnonlinsolnewton_mod SOURCES fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c + LINK_LIBRARIES + PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - sundials_fgeneric_mod_obj OUTPUT_NAME sundials_fsunnonlinsolnewton_mod VERSION diff --git a/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 b/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 index 634bc969c0..5b4eafb678 100644 --- a/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 +++ b/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 @@ -20,6 +20,7 @@ module fsunnonlinsol_newton_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunnonlinsol/petscsnes/CMakeLists.txt b/src/sunnonlinsol/petscsnes/CMakeLists.txt index cd7444303c..34c3c8c8f0 100644 --- a/src/sunnonlinsol/petscsnes/CMakeLists.txt +++ b/src/sunnonlinsol/petscsnes/CMakeLists.txt @@ -31,8 +31,9 @@ sundials_add_library(sundials_sunnonlinsolpetscsnes ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_petscsnes.h INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES + PUBLIC sundials_core OBJECT_LIBRARIES - sundials_generic_obj LINK_LIBRARIES PUBLIC sundials_nvecpetsc SUNDIALS::PETSC OUTPUT_NAME diff --git a/swig/arkode/farkode_mod.i b/swig/arkode/farkode_mod.i index 926f895ab8..f5869f6a02 100644 --- a/swig/arkode/farkode_mod.i +++ b/swig/arkode/farkode_mod.i @@ -35,7 +35,6 @@ %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" %import "../sundials/fsundials_adaptcontroller_mod.i" -%import "../sundials/fsundials_types_mod.i" // Treat ARKodeButcherTable as an opaque pointer %apply void* { ARKodeButcherTable }; diff --git a/swig/cvode/fcvode_mod.i b/swig/cvode/fcvode_mod.i index 74afd3acf5..91cc6e2d50 100644 --- a/swig/cvode/fcvode_mod.i +++ b/swig/cvode/fcvode_mod.i @@ -32,7 +32,7 @@ %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" -%import "../sundials/fsundials_types_mod.i" + // Process definitions from these files %include "cvode/cvode.h" diff --git a/swig/cvodes/fcvodes_mod.i b/swig/cvodes/fcvodes_mod.i index b498175b74..b8a5745807 100644 --- a/swig/cvodes/fcvodes_mod.i +++ b/swig/cvodes/fcvodes_mod.i @@ -31,7 +31,7 @@ %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" -%import "../sundials/fsundials_types_mod.i" + // Process definitions from these files %include "cvodes/cvodes.h" diff --git a/swig/ida/fida_mod.i b/swig/ida/fida_mod.i index e5a0c74684..db0727e753 100644 --- a/swig/ida/fida_mod.i +++ b/swig/ida/fida_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/idas/fidas_mod.i b/swig/idas/fidas_mod.i index 09fe7710b7..a214991975 100644 --- a/swig/idas/fidas_mod.i +++ b/swig/idas/fidas_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/kinsol/fkinsol_mod.i b/swig/kinsol/fkinsol_mod.i index 0e2507789b..1642350655 100644 --- a/swig/kinsol/fkinsol_mod.i +++ b/swig/kinsol/fkinsol_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/nvector/fnvector_mpimanyvector_mod.i b/swig/nvector/fnvector_mpimanyvector_mod.i index 7c2a355f5a..31ca4f8db3 100644 --- a/swig/nvector/fnvector_mpimanyvector_mod.i +++ b/swig/nvector/fnvector_mpimanyvector_mod.i @@ -27,34 +27,6 @@ // nvector_impl macro defines some ignore and inserts with the vector name appended %nvector_impl(MPIManyVector) -// handle MPI comm -%include - -%apply int { MPI_Comm }; -%typemap(ftype) MPI_Comm - "integer" -%typemap(fin, noblock=1) MPI_Comm { - $1 = int($input, C_INT) -} -%typemap(fout, noblock=1) MPI_Comm { - $result = int($1) -} - -%typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); -%#else - $1 = *$input; -%#endif -} -%typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $result = %static_cast(MPI_Comm_c2f($1), int); -%#else - $result = $1; -%#endif -} - // Process and wrap functions in the following files %include "nvector/nvector_mpimanyvector.h" diff --git a/swig/nvector/fnvector_mpiplusx_mod.i b/swig/nvector/fnvector_mpiplusx_mod.i index 14f3a45c73..7e9360f1e2 100644 --- a/swig/nvector/fnvector_mpiplusx_mod.i +++ b/swig/nvector/fnvector_mpiplusx_mod.i @@ -27,34 +27,6 @@ // nvector_impl macro defines some ignore and inserts with the vector name appended %nvector_impl(MPIPlusX) -// handle MPI comm -%include - -%apply int { MPI_Comm }; -%typemap(ftype) MPI_Comm - "integer" -%typemap(fin, noblock=1) MPI_Comm { - $1 = int($input, C_INT) -} -%typemap(fout, noblock=1) MPI_Comm { - $result = int($1) -} - -%typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); -%#else - $1 = *$input; -%#endif -} -%typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $result = %static_cast(MPI_Comm_c2f($1), int); -%#else - $result = $1; -%#endif -} - // Process and wrap functions in the following files %include "nvector/nvector_mpiplusx.h" diff --git a/swig/nvector/fnvector_parallel_mod.i b/swig/nvector/fnvector_parallel_mod.i index 1501186b6e..90376b7fd2 100644 --- a/swig/nvector/fnvector_parallel_mod.i +++ b/swig/nvector/fnvector_parallel_mod.i @@ -27,34 +27,6 @@ // nvector_impl macro defines some ignore and inserts with the vector name appended %nvector_impl(Parallel) -// handle MPI comm -%include - -%apply int { MPI_Comm }; -%typemap(ftype) MPI_Comm - "integer" -%typemap(fin, noblock=1) MPI_Comm { - $1 = int($input, C_INT) -} -%typemap(fout, noblock=1) MPI_Comm { - $result = int($1) -} - -%typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); -%#else - $1 = *$input; -%#endif -} -%typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $result = %static_cast(MPI_Comm_c2f($1), int); -%#else - $result = $1; -%#endif -} - // Process and wrap functions in the following files %include "nvector/nvector_parallel.h" diff --git a/swig/sundials/fsundials.i b/swig/sundials/fsundials.i index 9988d8ab29..d3846f09b1 100644 --- a/swig/sundials/fsundials.i +++ b/swig/sundials/fsundials.i @@ -18,6 +18,15 @@ // By default, wrap all constants as native fortran PARAMETERs %fortranconst; +// Inform SWIG of the SUNDIALS_EXPORT macro +#define SUNDIALS_EXPORT +#define SUNDIALS_DEPRECATED_EXPORT +#define SUNDIALS_DEPRECATED_EXPORT_MSG(msg) +#define SUNDIALS_STATIC_INLINE + +// All modules need sundials_types +%import "../sundials/fsundials_types_mod.i" + // Prefix all functions with F // E.g. CVodeCreate -> FCVodeCreate %rename("F%s", %$isfunction) ""; @@ -60,14 +69,6 @@ // Treat all ** as an opaque pointer %apply void** { SWIGTYPE ** }; - -// Inform SWIG of the SUNDIALS_EXPORT macro -#define SUNDIALS_EXPORT -#define SUNDIALS_DEPRECATED_EXPORT -#define SUNDIALS_DEPRECATED_EXPORT_MSG(msg) -#define SUNDIALS_STATIC_INLINE - - // Insert SUNDIALS copyright into generated C files. %insert(begin) %{ diff --git a/swig/sundials/fsundials_context_mod.i b/swig/sundials/fsundials_context_mod.i index 485c173e2e..3b1dc940b4 100644 --- a/swig/sundials/fsundials_context_mod.i +++ b/swig/sundials/fsundials_context_mod.i @@ -29,115 +29,5 @@ %apply void* { SUNLogger }; %apply void** { SUNLogger* }; -// We have to manually insert the wrapper code for SUNContext_Create, -// and SUNContext_Free to handle the Fortran to MPI MPI_Comm translation. -%ignore SUNContext_Create; -%ignore SUNContext_Free; - // Process and wrap functions in the following files %include "sundials/sundials_context.h" - -%insert("wrapper") %{ -SWIGEXPORT int _wrap_FSUNContext_Free(void *farg1) { - int fresult ; - SUNContext *arg1 = (SUNContext *) 0 ; - int result; -#ifdef SUNDIALS_BUILD_WITH_PROFILING - SUNProfiler profiler; -#endif - - arg1 = (SUNContext *)(farg1); -#ifdef SUNDIALS_BUILD_WITH_PROFILING - result = (int)SUNContext_GetProfiler(*arg1,&profiler); - result = (int)SUNContext_Free(arg1); - result = (int)SUNProfiler_Free(&profiler); -#else - result = (int)SUNContext_Free(arg1); -#endif - fresult = (int)(result); - return fresult; -} - -SWIGEXPORT int _wrap_FSUNContext_Create(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNContext *arg2 = (SUNContext *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNContext *)(farg2); - result = (int)SUNContext_Create(arg1,arg2); - fresult = (int)(result); - return fresult; -} -%} - -%insert("fbegin") %{ -#include "sundials/sundials_config.h" -%} - -%insert("fdecl") %{ -public :: FSUNContext_Free -public :: FSUNContext_Create -%} - -%insert("finterfaces") %{ -function swigc_FSUNContext_Free(farg1) & -bind(C, name="_wrap_FSUNContext_Free") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT) :: fresult -end function - -function swigc_FSUNContext_Create(farg1, farg2) & -bind(C, name="_wrap_FSUNContext_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -integer(C_INT) :: fresult -end function - -%} - -%insert("fsubprograms") %{ -function FSUNContext_Free(ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 - -farg1 = c_loc(ctx) -fresult = swigc_FSUNContext_Free(farg1) -swig_result = fresult -end function - -function FSUNContext_Create(comm, ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -#ifdef SUNDIALS_BUILD_WITH_PROFILING -use fsundials_profiler_mod, only : FSUNProfiler_Create -#endif -integer(C_INT) :: swig_result -type(C_PTR) :: comm -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 -#ifdef SUNDIALS_BUILD_WITH_PROFILING -type(C_PTR) :: profiler -#endif - -farg1 = comm -farg2 = c_loc(ctx) -fresult = swigc_FSUNContext_Create(c_null_ptr, farg2) -#ifdef SUNDIALS_BUILD_WITH_PROFILING -fresult = FSUNProfiler_Create(farg1, "FSUNContext Default", profiler) -fresult = swigc_FSUNContext_SetProfiler(ctx, profiler) -#endif -swig_result = fresult -end function -%} diff --git a/swig/sundials/fsundials_linearsolver_mod.i b/swig/sundials/fsundials_linearsolver_mod.i index fcb095c61d..cf80453f8c 100644 --- a/swig/sundials/fsundials_linearsolver_mod.i +++ b/swig/sundials/fsundials_linearsolver_mod.i @@ -17,7 +17,7 @@ %module fsundials_linearsolver_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" diff --git a/swig/sundials/fsundials_logger_mod.i b/swig/sundials/fsundials_logger_mod.i index 84a576cb67..8df6fa2094 100644 --- a/swig/sundials/fsundials_logger_mod.i +++ b/swig/sundials/fsundials_logger_mod.i @@ -21,7 +21,7 @@ // insert the include into the swig wrapper %{ #include "sundials/sundials_logger.h" -#ifdef SUNDIALS_LOGGING_ENABLE_MPI +#if SUNDIALS_MPI_ENABLED #include #endif %} @@ -29,78 +29,5 @@ %apply void* { SUNLogger }; %apply void** { SUNLogger* }; - -// We have to manually insert the wrapper code for SUNLogger_Create -// to handle the Fortran to MPI MPI_Comm translation. -%ignore SUNLogger_Create; -// %ignore SUNLogger_Destroy; - // Process and wrap functions in the following files %include "sundials/sundials_logger.h" - -%insert("wrapper") %{ -SWIGEXPORT int _wrap_FSUNLogger_Create(void *farg1, int const *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - SUNLogger *arg3 = (SUNLogger *) 0 ; - int result; -#ifdef SUNDIALS_LOGGING_ENABLE_MPI - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - arg3 = (SUNLogger *)(farg3); -#ifdef SUNDIALS_LOGGING_ENABLE_MPI - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNLogger_Create((void*)&comm,arg2,arg3); - } - else { - result = (int)SUNLogger_Create(arg1,arg2,arg3); - } -#else - result = (int)SUNLogger_Create(arg1,arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} -%} - -%insert("fdecl") %{ - public :: FSUNLogger_Create -%} - -%insert("finterfaces") %{ -function swigc_FSUNLogger_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNLogger_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function -%} - -%insert("fsubprograms") %{ -function FSUNLogger_Create(comm, output_rank, logger) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -integer(C_INT), intent(in) :: output_rank -type(C_PTR), target, intent(inout) :: logger -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -farg2 = output_rank -farg3 = c_loc(logger) -fresult = swigc_FSUNLogger_Create(farg1, farg2, farg3) -swig_result = fresult -end function -%} diff --git a/swig/sundials/fsundials_matrix_mod.i b/swig/sundials/fsundials_matrix_mod.i index 8c4947f7d5..1af0682e8e 100644 --- a/swig/sundials/fsundials_matrix_mod.i +++ b/swig/sundials/fsundials_matrix_mod.i @@ -17,7 +17,7 @@ %module fsundials_matrix_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" diff --git a/swig/sundials/fsundials_nonlinearsolver_mod.i b/swig/sundials/fsundials_nonlinearsolver_mod.i index 54e462e54e..f6a4762b7d 100644 --- a/swig/sundials/fsundials_nonlinearsolver_mod.i +++ b/swig/sundials/fsundials_nonlinearsolver_mod.i @@ -17,7 +17,7 @@ %module fsundials_nonlinearsolver_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" diff --git a/swig/sundials/fsundials_nvector_mod.i b/swig/sundials/fsundials_nvector_mod.i index b7bbce0130..44ef32bc3e 100644 --- a/swig/sundials/fsundials_nvector_mod.i +++ b/swig/sundials/fsundials_nvector_mod.i @@ -18,7 +18,7 @@ // Load the typedefs and generate a "use fsundials_types_mod" statement in the module %import "../sundials/fsundials_context_mod.i" -%import "../sundials/fsundials_types_mod.i" + // insert the include into the swig wrapper %{ diff --git a/swig/sundials/fsundials_profiler_mod.i b/swig/sundials/fsundials_profiler_mod.i index 1462343c95..06dc5bc079 100644 --- a/swig/sundials/fsundials_profiler_mod.i +++ b/swig/sundials/fsundials_profiler_mod.i @@ -32,78 +32,5 @@ // Utility class for C++ only. %ignore SUNProfilerMarkScope; -// We have to manually insert the wrapper code for SUNProfiler_Create -// to handle the Fortran to MPI MPI_Comm translation. -%ignore SUNProfiler_Create; - // Process and wrap functions in the following files %include "sundials/sundials_profiler.h" - -%insert("wrapper") %{ -SWIGEXPORT int _wrap_FSUNProfiler_Create(void *farg1, SwigArrayWrapper *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - char *arg2 = (char *) 0 ; - SUNProfiler *arg3 = (SUNProfiler *) 0 ; - int result; -#if SUNDIALS_MPI_ENABLED - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (char *)(farg2->data); - arg3 = (SUNProfiler *)(farg3); -#if SUNDIALS_MPI_ENABLED - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNProfiler_Create((void*)&comm,(char const *)arg2,arg3); - } - else { - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); - } -#else - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} -%} - -%insert("fdecl") %{ - public :: FSUNProfiler_Create -%} - -%insert("finterfaces") %{ -function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNProfiler_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(C_PTR), value :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function -%} - -%insert("fsubprograms") %{ -function FSUNProfiler_Create(comm, title, p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -character(kind=C_CHAR, len=*), target :: title -character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -call SWIG_string_to_chararray(title, farg2_chars, farg2) -farg3 = c_loc(p) -fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) -swig_result = fresult -end function -%} diff --git a/swig/sundials/fsundials_types_mod.i b/swig/sundials/fsundials_types_mod.i index 085b370c19..d45154be2d 100644 --- a/swig/sundials/fsundials_types_mod.i +++ b/swig/sundials/fsundials_types_mod.i @@ -17,7 +17,6 @@ %module fsundials_types_mod -%include "../sundials/fsundials.i" %include // Inform SWIG of the configure-provided types @@ -26,6 +25,50 @@ #define SUNDIALS_DOUBLE_PRECISION #define sunbooleantype int +// Handle MPI_Comm and SUNComm +%include + +%apply int { MPI_Comm }; + +%typemap(ftype) MPI_Comm + "integer" +%typemap(fin, noblock=1) MPI_Comm { + $1 = int($input, C_INT) +} +%typemap(fout, noblock=1) MPI_Comm { + $result = int($1) +} + +%typemap(in, noblock=1) MPI_Comm { +%#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); + } else { + $1 = SUN_COMM_NULL; + } +%#else + $1 = *$input; +%#endif +} +%typemap(out, noblock=1) MPI_Comm { +%#if SUNDIALS_MPI_ENABLED + int flag = 0; + MPI_Initialized(&flag); + if(flag) { + $result = %static_cast(MPI_Comm_c2f($1), int); + } else { + $result = 0; + } +%#else + $result = $1; +%#endif +} + +%apply MPI_Comm { SUNComm }; + + // Insert code into the C wrapper to check that the sizes match %{ #include "sundials/sundials_types.h" @@ -42,3 +85,37 @@ // Process and wrap functions in the following files %include "sundials/sundials_types.h" +// Insert SUNDIALS copyright into generated C files. +%insert(begin) +%{ +/* --------------------------------------------------------------- + * Programmer(s): Auto-generated by swig. + * --------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2023, Lawrence Livermore National Security + * and Southern Methodist University. + * All rights reserved. + * + * See the top-level LICENSE and NOTICE files for details. + * + * SPDX-License-Identifier: BSD-3-Clause + * SUNDIALS Copyright End + * -------------------------------------------------------------*/ +%} +// Insert SUNDIALS copyright into generated Fortran files +%insert(fbegin) +%{ +! --------------------------------------------------------------- +! Programmer(s): Auto-generated by swig. +! --------------------------------------------------------------- +! SUNDIALS Copyright Start +! Copyright (c) 2002-2023, Lawrence Livermore National Security +! and Southern Methodist University. +! All rights reserved. +! +! See the top-level LICENSE and NOTICE files for details. +! +! SPDX-License-Identifier: BSD-3-Clause +! SUNDIALS Copyright End +! --------------------------------------------------------------- +%} diff --git a/test/config_cmake.py b/test/config_cmake.py index 0eeac02068..65e0cec1e8 100644 --- a/test/config_cmake.py +++ b/test/config_cmake.py @@ -220,10 +220,6 @@ def main(): 'SUNDIALS_LOGGING_LEVEL', '0', 'STRING', 'logging', choices=['0', '1', '2', '3', '4', '5']) - add_arg(group, '--logging-mpi', 'SUNDIALS_LOGGING_ENABLE_MPI', - 'SUNDIALS_LOGGING_ENABLE_MPI', 'OFF', 'BOOL', - 'MPI-aware logging') - # fused kernels add_arg(group, '--fused-kernels', 'SUNDIALS_FUSED_KERNELS', 'SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS', 'OFF', 'BOOL', diff --git a/test/env/default.sh b/test/env/default.sh index be600a4c7a..928a2af6ca 100644 --- a/test/env/default.sh +++ b/test/env/default.sh @@ -104,11 +104,7 @@ spack load "${compiler}" # make sure spack knows about the compiler spack compiler find -if [ "$SUNDIALS_TPLS" == "ON" ]; then - spack load cmake@3.18.6 -else - spack load cmake@3.12.4 -fi +spack load cmake@3.18.6 # add CUDA if [[ ":${PATH}:" != *":/usr/local/cuda-11.5/bin:"* ]]; then @@ -212,7 +208,6 @@ export SUNDIALS_PROFILING=ON # Sundials logging export SUNDIALS_LOGGING_LEVEL=3 -export SUNDIALS_LOGGING_ENABLE_MPI=ON # Uncomment to override the default output file comparison precisions. The float # precision is number of digits to compare (0 = all digits) and the integer diff --git a/test/env/docker.sh b/test/env/docker.sh index 97c86b47f5..37a1c2bf16 100644 --- a/test/env/docker.sh +++ b/test/env/docker.sh @@ -158,7 +158,6 @@ export SUNDIALS_PROFILING=ON # Sundials logging export SUNDIALS_LOGGING_LEVEL=3 -export SUNDIALS_LOGGING_ENABLE_MPI=ON # Answer files if [ -z "${SUNDIALS_TEST_ANSWER_DIR}" ]; then diff --git a/test/env/setup_env.sh b/test/env/setup_env.sh index c74b7cd536..46569b514d 100644 --- a/test/env/setup_env.sh +++ b/test/env/setup_env.sh @@ -204,7 +204,6 @@ if [[ "${SUNDIALS_TPLS}" == "OFF" ]]; then # mpi export SUNDIALS_MPI=OFF - export SUNDIALS_LOGGING_ENABLE_MPI=OFF # gpu export SUNDIALS_CUDA=OFF diff --git a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp index 096c602bfb..6a33df4255 100644 --- a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp +++ b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp @@ -110,7 +110,7 @@ static bool Compare(long int a, long int b, sunrealtype tol); int main(int argc, char* argv[]) { /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx = NULL; - SUNContext_Create(NULL, &ctx); + SUNContext_Create(SUN_COMM_NULL, &ctx); // general problem parameters sunrealtype T0 = SUN_RCONST(0.0); // initial time diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp index ff9403d76f..0fa724bfcb 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp @@ -72,7 +72,7 @@ static SUNContext sunctx = NULL; int main(int argc, char* argv[]) { // Create the SUNDIALS context object for this simulation. - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); // general problem parameters sunrealtype T0 = SUN_RCONST(0.0); // initial time diff --git a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c index 08818856a4..6b15e3dd05 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c +++ b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) printf(" abstol = %.1"ESYM"\n\n", abstol); /* Create the SUNDIALS context object for this simulation. */ - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); /* Create solution vector and initialize to zero */ y = N_VNew_Serial(NEQ, sunctx); diff --git a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c index 14d027503d..d7447fb17b 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c +++ b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c b/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c index 330a2ed817..b0c07438b1 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c +++ b/test/unit_tests/arkode/C_serial/ark_test_innerstepper.c @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { return 1; } /* ----------------------- diff --git a/test/unit_tests/arkode/C_serial/ark_test_interp.c b/test/unit_tests/arkode/C_serial/ark_test_interp.c index cd79b34b07..182b14a680 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_interp.c +++ b/test/unit_tests/arkode/C_serial/ark_test_interp.c @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ SUNContext sunctx = NULL; - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); /* general problem parameters */ T0 = SUN_RCONST(0.0); /* initial time */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_reset.c b/test/unit_tests/arkode/C_serial/ark_test_reset.c index 3b191255c8..da2c483de7 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_reset.c +++ b/test/unit_tests/arkode/C_serial/ark_test_reset.c @@ -94,7 +94,7 @@ int main() printf("\nARKODE reset functionality tester:\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Initialize vector, matrix, and linaer solver data structures */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_tstop.c b/test/unit_tests/arkode/C_serial/ark_test_tstop.c index 66a17b5a46..b5e72c03bc 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_tstop.c +++ b/test/unit_tests/arkode/C_serial/ark_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c b/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c index 8b3a82ff88..2223ab19ba 100644 --- a/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c +++ b/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/cvode/C_serial/cv_test_tstop.c b/test/unit_tests/cvode/C_serial/cv_test_tstop.c index 50c7e053d6..eb877fbd20 100644 --- a/test/unit_tests/cvode/C_serial/cv_test_tstop.c +++ b/test/unit_tests/cvode/C_serial/cv_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c b/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c index f108822af8..00cfb8dcc2 100644 --- a/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c +++ b/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c b/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c index 5ce9c1c611..f9fd045ee6 100644 --- a/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c +++ b/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/ida/C_serial/ida_test_getuserdata.c b/test/unit_tests/ida/C_serial/ida_test_getuserdata.c index 31e664c189..3bdd23c53a 100644 --- a/test/unit_tests/ida/C_serial/ida_test_getuserdata.c +++ b/test/unit_tests/ida/C_serial/ida_test_getuserdata.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/ida/C_serial/ida_test_tstop.c b/test/unit_tests/ida/C_serial/ida_test_tstop.c index 491910ae1b..d0fdb10e06 100644 --- a/test/unit_tests/ida/C_serial/ida_test_tstop.c +++ b/test/unit_tests/ida/C_serial/ida_test_tstop.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/idas/C_serial/idas_test_getuserdata.c b/test/unit_tests/idas/C_serial/idas_test_getuserdata.c index d1a42fde65..2e5148dd3a 100644 --- a/test/unit_tests/idas/C_serial/idas_test_getuserdata.c +++ b/test/unit_tests/idas/C_serial/idas_test_getuserdata.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/idas/C_serial/idas_test_tstop.c b/test/unit_tests/idas/C_serial/idas_test_tstop.c index 6875fa4d79..7f73326dde 100644 --- a/test/unit_tests/idas/C_serial/idas_test_tstop.c +++ b/test/unit_tests/idas/C_serial/idas_test_tstop.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c b/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c index abe9491ca8..0cefda13e6 100644 --- a/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c +++ b/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/profiling/CMakeLists.txt b/test/unit_tests/profiling/CMakeLists.txt index 8c0ce56ea6..602ea4ece3 100644 --- a/test/unit_tests/profiling/CMakeLists.txt +++ b/test/unit_tests/profiling/CMakeLists.txt @@ -39,7 +39,7 @@ foreach(test_tuple ${unit_tests}) # libraries to link against target_link_libraries(${test} - sundials_generic + sundials_core ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/profiling/test_profiling.cpp b/test/unit_tests/profiling/test_profiling.cpp index 7228fd7c9c..35b1423d2c 100644 --- a/test/unit_tests/profiling/test_profiling.cpp +++ b/test/unit_tests/profiling/test_profiling.cpp @@ -21,6 +21,7 @@ #include "sundials/sundials_math.h" #include "sundials/sundials_profiler.h" +#include "sundials/sundials_types.h" int sleep(SUNProfiler prof, int sec, double* chrono) { @@ -67,7 +68,7 @@ int main() std::cout << "Testing SUNProfiler\n"; SUNProfiler prof = nullptr; - int flag = SUNProfiler_Create(nullptr, "SUNProfiler Test", &prof); + int flag = SUNProfiler_Create(SUN_COMM_NULL, "SUNProfiler Test", &prof); if (flag) { std::cerr << ">>> FAILURE: " diff --git a/test/unit_tests/sunmemory/cuda/CMakeLists.txt b/test/unit_tests/sunmemory/cuda/CMakeLists.txt index 81c0986797..8aa4b6a978 100644 --- a/test/unit_tests/sunmemory/cuda/CMakeLists.txt +++ b/test/unit_tests/sunmemory/cuda/CMakeLists.txt @@ -36,7 +36,7 @@ foreach(test_tuple ${unit_tests}) ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_generic_obj sundials_sunmemcuda_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemcuda_obj ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/sunmemory/hip/CMakeLists.txt b/test/unit_tests/sunmemory/hip/CMakeLists.txt index 46a8464253..92e78ecb7a 100644 --- a/test/unit_tests/sunmemory/hip/CMakeLists.txt +++ b/test/unit_tests/sunmemory/hip/CMakeLists.txt @@ -36,7 +36,7 @@ foreach(test_tuple ${unit_tests}) ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_generic_obj sundials_sunmemhip_obj hip::device ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemhip_obj hip::device ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/sunmemory/sycl/CMakeLists.txt b/test/unit_tests/sunmemory/sycl/CMakeLists.txt index 116db503cf..bee476b566 100644 --- a/test/unit_tests/sunmemory/sycl/CMakeLists.txt +++ b/test/unit_tests/sunmemory/sycl/CMakeLists.txt @@ -36,7 +36,7 @@ foreach(test_tuple ${unit_tests}) ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_generic_obj sundials_sunmemsycl_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsycl_obj ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/sunmemory/sys/CMakeLists.txt b/test/unit_tests/sunmemory/sys/CMakeLists.txt index fa741d710e..303a67d655 100644 --- a/test/unit_tests/sunmemory/sys/CMakeLists.txt +++ b/test/unit_tests/sunmemory/sys/CMakeLists.txt @@ -36,7 +36,7 @@ foreach(test_tuple ${unit_tests}) ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_generic_obj sundials_sunmemsys_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsys_obj ${EXE_EXTRA_LINK_LIBS}) endif()