From f0acc1487ad4a487190c7f23b1fa88f222047040 Mon Sep 17 00:00:00 2001 From: Steven Roberts Date: Thu, 16 May 2024 07:23:57 -0700 Subject: [PATCH 1/7] Fix promotion of double to sunrealtype identified with -Wdouble-promotion (#483) --- src/arkode/arkode.c | 6 +++--- src/arkode/arkode_io.c | 2 +- src/arkode/arkode_sprk.c | 13 +++++++------ src/cvodes/cvodea.c | 2 +- src/sundials/sundials_band.c | 2 +- src/sundials/sundials_dense.c | 2 +- src/sunmatrix/sparse/sunmatrix_sparse.c | 6 +++--- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 098d0756c6..cddd647a34 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -2816,8 +2816,8 @@ int arkPredict_MaximumOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess) int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess) { int ord; - sunrealtype tau_tol = 0.5; - sunrealtype tau_tol2 = 0.75; + sunrealtype tau_tol = HALF; + sunrealtype tau_tol2 = SUN_RCONST(0.75); /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) @@ -2854,7 +2854,7 @@ int arkPredict_VariableOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess int arkPredict_CutoffOrder(ARKodeMem ark_mem, sunrealtype tau, N_Vector yguess) { int ord; - sunrealtype tau_tol = 0.5; + sunrealtype tau_tol = HALF; /* verify that ark_mem and interpolation structure are provided */ if (ark_mem == NULL) diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index 291a61ec35..c1d73c866c 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -1588,7 +1588,7 @@ int ARKodeSetErrorBias(void* arkode_mem, sunrealtype bias) /* set allowed value, otherwise set default */ if (bias < ONE) { - retval = SUNAdaptController_SetErrorBias(hadapt_mem->hcontroller, -1.0); + retval = SUNAdaptController_SetErrorBias(hadapt_mem->hcontroller, -ONE); } else { diff --git a/src/arkode/arkode_sprk.c b/src/arkode/arkode_sprk.c index 974228afd1..c5e17837ab 100644 --- a/src/arkode/arkode_sprk.c +++ b/src/arkode/arkode_sprk.c @@ -136,8 +136,8 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void) if (!sprk_table) { return NULL; } sprk_table->q = 2; sprk_table->stages = 2; - sprk_table->a[1] = SUN_RCONST(1.0) - - (SUN_RCONST(1.0) / SUN_RCONST(2.0)) * SUNRsqrt(2.0); + sprk_table->a[1] = SUN_RCONST(1.0) - (SUN_RCONST(1.0) / SUN_RCONST(2.0)) * + SUNRsqrt(SUN_RCONST(2.0)); sprk_table->a[0] = SUN_RCONST(1.0) - sprk_table->a[1]; sprk_table->ahat[1] = SUN_RCONST(1.0) / (SUN_RCONST(2.0) * (SUN_RCONST(1.0) - sprk_table->a[1])); @@ -147,9 +147,9 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void) ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void) { - sunrealtype w = 0.0; - sunrealtype y = 0.0; - sunrealtype z = 0.0; + sunrealtype w = SUN_RCONST(0.0); + sunrealtype y = SUN_RCONST(0.0); + sunrealtype z = SUN_RCONST(0.0); ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(3); if (!sprk_table) { return NULL; } @@ -157,7 +157,8 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void) sprk_table->stages = 3; z = -SUNRpowerR((SUN_RCONST(2.0) / SUN_RCONST(27.0)) - - SUN_RCONST(1.0) / (SUN_RCONST(9.0) * SUNRsqrt(3.0)), + SUN_RCONST(1.0) / + (SUN_RCONST(9.0) * SUNRsqrt(SUN_RCONST(3.0))), SUN_RCONST(1.0) / SUN_RCONST(3.0)); w = -SUN_RCONST(2.0) / SUN_RCONST(3.0) + SUN_RCONST(1.0) / (SUN_RCONST(9.0) * z) + z; diff --git a/src/cvodes/cvodea.c b/src/cvodes/cvodea.c index fd4ae06f97..2df97cf712 100644 --- a/src/cvodes/cvodea.c +++ b/src/cvodes/cvodea.c @@ -1793,7 +1793,7 @@ static CVckpntMem CVAckpntInit(CVodeMem cv_mem) ck_mem->ck_t0 = cv_mem->cv_tn; ck_mem->ck_nst = 0; ck_mem->ck_q = 1; - ck_mem->ck_h = 0.0; + ck_mem->ck_h = ZERO; /* Do we need to carry quadratures */ ck_mem->ck_quadr = cv_mem->cv_quadr && cv_mem->cv_errconQ; diff --git a/src/sundials/sundials_band.c b/src/sundials/sundials_band.c index e8051d80c1..4124c701ea 100644 --- a/src/sundials/sundials_band.c +++ b/src/sundials/sundials_band.c @@ -322,7 +322,7 @@ void SUNDlsMat_bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype i, j, is, ie; sunrealtype* col_j; - for (i = 0; i < n; i++) { y[i] = 0.0; } + for (i = 0; i < n; i++) { y[i] = ZERO; } for (j = 0; j < n; j++) { diff --git a/src/sundials/sundials_dense.c b/src/sundials/sundials_dense.c index f022212f9c..f037fefbdf 100644 --- a/src/sundials/sundials_dense.c +++ b/src/sundials/sundials_dense.c @@ -502,7 +502,7 @@ void SUNDlsMat_denseMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype i, j; sunrealtype* col_j; - for (i = 0; i < m; i++) { y[i] = 0.0; } + for (i = 0; i < m; i++) { y[i] = ZERO; } for (j = 0; j < n; j++) { diff --git a/src/sunmatrix/sparse/sunmatrix_sparse.c b/src/sunmatrix/sparse/sunmatrix_sparse.c index 96754afbd6..18d644dba5 100644 --- a/src/sunmatrix/sparse/sunmatrix_sparse.c +++ b/src/sunmatrix/sparse/sunmatrix_sparse.c @@ -1187,7 +1187,7 @@ SUNErrCode Matvec_SparseCSC(SUNMatrix A, N_Vector x, N_Vector y) SUNCheckLastErr(); /* initialize result */ - for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = 0.0; } + for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = ZERO; } /* iterate through matrix columns */ for (j = 0; j < SM_COLUMNS_S(A); j++) @@ -1230,7 +1230,7 @@ SUNErrCode Matvec_SparseCSR(SUNMatrix A, N_Vector x, N_Vector y) SUNAssert(yd, SUN_ERR_ARG_CORRUPT); SUNAssert(xd != yd, SUN_ERR_ARG_CORRUPT); /* initialize result */ - for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = 0.0; } + for (i = 0; i < SM_ROWS_S(A); i++) { yd[i] = ZERO; } /* iterate through matrix rows */ for (i = 0; i < SM_ROWS_S(A); i++) @@ -1298,7 +1298,7 @@ SUNErrCode format_convert(const SUNMatrix A, SUNMatrix B) sunindextype jj; for (jj = Ap[row]; jj < Ap[row + 1]; jj++) { - sunindextype col = Aj[jj]; + col = Aj[jj]; sunindextype dest = Bp[col]; Bi[dest] = row; From 8bdca734d2b86304f5f686dd1dc9e0e6ea15777d Mon Sep 17 00:00:00 2001 From: Steven Roberts Date: Thu, 16 May 2024 07:24:48 -0700 Subject: [PATCH 2/7] Fix casting warnings identified with -Wcast-qual flag (#482) --- src/sundials/sundials_hashmap.c | 12 +++++++----- src/sundials/sundials_hashmap_impl.h | 3 ++- src/sundials/sundials_profiler.c | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/sundials/sundials_hashmap.c b/src/sundials/sundials_hashmap.c index 55c786b34f..a2a2fc3764 100644 --- a/src/sundials/sundials_hashmap.c +++ b/src/sundials/sundials_hashmap.c @@ -140,7 +140,8 @@ SUNErrCode SUNHashMap_Destroy(SUNHashMap* map, void (*freevalue)(void* ptr)) * ``<-1`` -- an error occurred */ int SUNHashMap_Iterate(SUNHashMap map, int start, - int (*yieldfn)(int, SUNHashMapKeyValue, void*), void* ctx) + int (*yieldfn)(int, SUNHashMapKeyValue, const void*), + const void* ctx) { int i; @@ -159,7 +160,8 @@ int SUNHashMap_Iterate(SUNHashMap map, int start, return (map->max_size); } -static int sunHashMapLinearProbeInsert(int idx, SUNHashMapKeyValue kv, void* ctx) +static int sunHashMapLinearProbeInsert(int idx, SUNHashMapKeyValue kv, + const void* ctx) { /* find the next open spot */ if (kv == NULL) { return (idx); /* open spot found at idx */ } @@ -216,7 +218,8 @@ int SUNHashMap_Insert(SUNHashMap map, const char* key, void* value) return (0); } -static int sunHashMapLinearProbeGet(int idx, SUNHashMapKeyValue kv, void* key) +static int sunHashMapLinearProbeGet(int idx, SUNHashMapKeyValue kv, + const void* key) { /* target key cannot be NULL */ if (key == NULL) { return (-2); } @@ -260,8 +263,7 @@ int SUNHashMap_GetValue(SUNHashMap map, const char* key, void** value) if (strcmp(map->buckets[idx]->key, key)) { /* Keys did not match, so we have a collision and need to probe */ - retval = SUNHashMap_Iterate(map, idx + 1, sunHashMapLinearProbeGet, - (void*)key); + retval = SUNHashMap_Iterate(map, idx + 1, sunHashMapLinearProbeGet, key); if (retval < 0) { return (-1); /* error occurred */ } if (retval == map->max_size) { return (-2); /* not found */ } } diff --git a/src/sundials/sundials_hashmap_impl.h b/src/sundials/sundials_hashmap_impl.h index 7fc743a2f3..235947ed71 100644 --- a/src/sundials/sundials_hashmap_impl.h +++ b/src/sundials/sundials_hashmap_impl.h @@ -43,7 +43,8 @@ struct SUNHashMap_ SUNErrCode SUNHashMap_New(int max_size, SUNHashMap* map); SUNErrCode SUNHashMap_Destroy(SUNHashMap* map, void (*freevalue)(void* ptr)); int SUNHashMap_Iterate(SUNHashMap map, int start, - int (*yieldfn)(int, SUNHashMapKeyValue, void*), void* ctx); + int (*yieldfn)(int, SUNHashMapKeyValue, const void*), + const void* ctx); int SUNHashMap_Insert(SUNHashMap map, const char* key, void* value); int SUNHashMap_GetValue(SUNHashMap map, const char* key, void** value); SUNErrCode SUNHashMap_Sort(SUNHashMap map, SUNHashMapKeyValue** sorted, diff --git a/src/sundials/sundials_profiler.c b/src/sundials/sundials_profiler.c index 4a2e12e783..1ac2b30aee 100644 --- a/src/sundials/sundials_profiler.c +++ b/src/sundials/sundials_profiler.c @@ -543,8 +543,8 @@ int sunCompareTimes(const void* l, const void* r) double left_max; double right_max; - const SUNHashMapKeyValue left = *((SUNHashMapKeyValue*)l); - const SUNHashMapKeyValue right = *((SUNHashMapKeyValue*)r); + const SUNHashMapKeyValue left = *((const SUNHashMapKeyValue*)l); + const SUNHashMapKeyValue right = *((const SUNHashMapKeyValue*)r); if (left == NULL && right == NULL) { return 0; } if (left == NULL) { return 1; } From 9e3b4300b494b41f227b8c4e670fbe126df5b5f3 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 16 May 2024 12:44:41 -0700 Subject: [PATCH 3/7] CI: Combine actions (#486) Combine some actions so it's easier to trigger all the tests manually --- .github/workflows/extended-precision.yml | 52 ------------------- .github/workflows/single-precision.yml | 52 ------------------- ...double-precision.yml => ubuntu-latest.yml} | 19 +++++-- 3 files changed, 16 insertions(+), 107 deletions(-) delete mode 100644 .github/workflows/extended-precision.yml delete mode 100644 .github/workflows/single-precision.yml rename .github/workflows/{double-precision.yml => ubuntu-latest.yml} (71%) diff --git a/.github/workflows/extended-precision.yml b/.github/workflows/extended-precision.yml deleted file mode 100644 index 2c521b2fad..0000000000 --- a/.github/workflows/extended-precision.yml +++ /dev/null @@ -1,52 +0,0 @@ -# -name: Build and Test - Ubuntu/gcc extended precision (TPLs, no GPUs) - -on: - push: - branches: - - main - - develop - pull_request: - merge_group: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - -jobs: - build_and_test: - runs-on: ubuntu-latest - container: - image: ghcr.io/llnl/sundials-ci-int${{ matrix.indexsize }}-${{ matrix.precision }}:latest - options: --user root - strategy: - matrix: - indexsize: [32, 64] - precision: ['extended'] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: true - - name: Run test_driver.sh - uses: ./.github/actions/test-driver - with: - indexsize: ${{ matrix.indexsize }} - precision: ${{ matrix.precision }} - - name: Archive build files from failed build - uses: actions/upload-artifact@v3 - if: failure() - with: - name: build_files - path: | - ${{ github.workspace }}/test/build_* - !${{ github.workspace }}/test/build_*/Testing/output - - name: Archive output files from failed build - uses: actions/upload-artifact@v3 - if: failure() - with: - name: output_files - path: | - ${{ github.workspace }}/test/build_*/Testing/ - \ No newline at end of file diff --git a/.github/workflows/single-precision.yml b/.github/workflows/single-precision.yml deleted file mode 100644 index d986643256..0000000000 --- a/.github/workflows/single-precision.yml +++ /dev/null @@ -1,52 +0,0 @@ -# -name: Build and Test - Ubuntu/gcc single precision (TPLs, no GPUs) - -on: - push: - branches: - - main - - develop - pull_request: - merge_group: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - -jobs: - build_and_test: - runs-on: ubuntu-latest - container: - image: ghcr.io/llnl/sundials-ci-int${{ matrix.indexsize }}-${{ matrix.precision }}:latest - options: --user root - strategy: - matrix: - indexsize: [32, 64] - precision: ['single'] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: true - - name: Run test_driver.sh - uses: ./.github/actions/test-driver - with: - indexsize: ${{ matrix.indexsize }} - precision: ${{ matrix.precision }} - - name: Archive build files from failed build - uses: actions/upload-artifact@v3 - if: failure() - with: - name: build_files - path: | - ${{ github.workspace }}/test/build_* - !${{ github.workspace }}/test/build_*/Testing/output - - name: Archive output files from failed build - uses: actions/upload-artifact@v3 - if: failure() - with: - name: output_files - path: | - ${{ github.workspace }}/test/build_*/Testing/ - \ No newline at end of file diff --git a/.github/workflows/double-precision.yml b/.github/workflows/ubuntu-latest.yml similarity index 71% rename from .github/workflows/double-precision.yml rename to .github/workflows/ubuntu-latest.yml index cda708a4a9..f9f24a5dd0 100644 --- a/.github/workflows/double-precision.yml +++ b/.github/workflows/ubuntu-latest.yml @@ -1,5 +1,5 @@ # -name: Build and Test - Ubuntu/gcc double precision (TPLs, no GPUs) +name: Build and Test - Ubuntu/gcc (TPLs, no GPUs) on: push: @@ -24,8 +24,21 @@ jobs: max-parallel: 2 matrix: indexsize: [32, 64] - precision: ['double'] - buildtype: ['Debug', 'Release'] + # Disable extended tests until compiler warnings are addressed + precision: ['single', 'double'] + buildtype: ['Debug', 'Release', 'RelWithDebInfo'] + exclude: + - buildtype: Debug + precision: single + # - buildtype: Debug + # precision: extended + - buildtype: Release + precision: single + # - buildtype: Release + # precision: extended + - buildtype: RelWithDebInfo + precision: double + steps: - name: Checkout repository uses: actions/checkout@v3 From 9ebc406a2d373e2fae8716c8016e1d31725c3641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Thu, 16 May 2024 21:45:23 +0200 Subject: [PATCH 4/7] CI (mingw): Install and build with SuiteSparse library (#432) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSYS2 follows a rolling release model. I.e., most of its packages are quite new most of the time. Adding the SuiteSparse libraries in the CI tests for MSYS2 might help to detect potentially API changes early. Signed-off-by: Markus Mützel Co-authored-by: Cody Balos Co-authored-by: David Gardner --- .github/workflows/windows-latest-mingw.yml | 37 ++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/windows-latest-mingw.yml b/.github/workflows/windows-latest-mingw.yml index beb55d1efe..52cacd8504 100644 --- a/.github/workflows/windows-latest-mingw.yml +++ b/.github/workflows/windows-latest-mingw.yml @@ -14,27 +14,46 @@ env: BUILD_TYPE: Release jobs: - buil_and_test: + build_and_test: runs-on: windows-latest + defaults: + run: + # Use MSYS2 as default shell + shell: msys2 {0} + steps: - uses: actions/checkout@v3 - uses: msys2/setup-msys2@v2 with: msystem: mingw64 + update: true + release: false + install: >- + base-devel + mingw-w64-x86_64-cmake + mingw-w64-x86_64-cc + mingw-w64-x86_64-openblas + mingw-w64-x86_64-suitesparse - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -G "MinGW Makefiles" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_LOGGING_LEVEL=2 -DSUNDIALS_TEST_UNITTESTS=OFF -DEXAMPLES_ENABLE_CXX=ON + # Configure CMake in a 'build' subdirectory + run: | + cmake \ + -B ${GITHUB_WORKSPACE}/build \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DSUNDIALS_BUILD_WITH_PROFILING=ON \ + -DSUNDIALS_LOGGING_LEVEL=2 \ + -DSUNDIALS_TEST_UNITTESTS=OFF \ + -DEXAMPLES_ENABLE_CXX=ON \ + -DENABLE_KLU=ON - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + # Build your program + run: cmake --build ${GITHUB_WORKSPACE}/build - name: Test working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} + # Execute tests + run: ctest From 83c3e66c060c9044540100734ecf0dbc06ab285f Mon Sep 17 00:00:00 2001 From: Adrien Delsalle Date: Fri, 17 May 2024 00:50:27 +0200 Subject: [PATCH 5/7] Disambiguate shared and static libs `.lib` files on Windows using MSVC (#455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description --- Disambiguate shared and static libs `.lib` files on Windows using MSVC Suffix library output name with `_static` when building both static and shared libs on Windows Closes #454 --------- Co-authored-by: Markus Mützel Co-authored-by: Cody Balos --- CHANGELOG.md | 4 ++++ cmake/macros/SundialsAddLibrary.cmake | 19 +++++++++++++------ doc/shared/RecentChanges.rst | 4 ++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40706c1649..fcf9091a19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Changes to SUNDIALS in release X.Y.Z +Fixed conflicting `.lib` files between shared and static libs when using `MSVC` on Windows + +Fixed invalid `SUNDIALS_EXPORT` generated macro when building both shared and static libs + Created shared user interface for ARKODE user-callable routines, to allow more uniform control over time-stepping algorithms, improved extensibility, and simplified code maintenance. Marked the corresponding stepper-specific diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake index ca0d226191..3c66bbe7e3 100644 --- a/cmake/macros/SundialsAddLibrary.cmake +++ b/cmake/macros/SundialsAddLibrary.cmake @@ -200,7 +200,7 @@ macro(sundials_add_library target) # add compile definitions to object library for SUNDIALS_EXPORT if(${_libtype} MATCHES "STATIC") - target_compile_definitions(${obj_target} PRIVATE SUNDIALS_STATIC_DEFINE) + target_compile_definitions(${obj_target} PUBLIC SUNDIALS_STATIC_DEFINE) else() target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS) endif() @@ -296,7 +296,7 @@ macro(sundials_add_library target) # add compile definitions for SUNDIALS_EXPORT if(${_libtype} MATCHES "STATIC") - target_compile_definitions(${_actual_target_name} PRIVATE SUNDIALS_STATIC_DEFINE) + target_compile_definitions(${_actual_target_name} PUBLIC SUNDIALS_STATIC_DEFINE) else() target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS) endif() @@ -325,10 +325,17 @@ macro(sundials_add_library target) # set the correct output name if(sundials_add_library_OUTPUT_NAME) - set_target_properties(${_actual_target_name} PROPERTIES - OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME} - CLEAN_DIRECT_OUTPUT 1 - ) + if((MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) AND ${_libtype} MATCHES "STATIC") + set_target_properties(${_actual_target_name} PROPERTIES + OUTPUT_NAME "${sundials_add_library_OUTPUT_NAME}_static" + CLEAN_DIRECT_OUTPUT 1 + ) + else() + set_target_properties(${_actual_target_name} PROPERTIES + OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME} + CLEAN_DIRECT_OUTPUT 1 + ) + endif() else() set_target_properties(${_actual_target_name} PROPERTIES OUTPUT_NAME ${target} diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 4f1e6dbe92..6b3cb4f270 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -37,6 +37,10 @@ Added the following MRI coupling tables **Bug Fixes** +Fixed conflicting ``.lib`` files between shared and static libs when using ``MSVC`` on Windows + +Fixed invalid ``SUNDIALS_EXPORT`` generated macro when building both shared and static libs + Updated the CMake variable ``HIP_PLATFORM`` default to ``amd`` as the previous default, ``hcc``, is no longer recognized in ROCm 5.7.0 or newer. The new default is also valid in older version of ROCm (at least back to version 4.3.1). From 2febbc710506536d94d923311786ac14936f381c Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Fri, 17 May 2024 05:57:11 +0200 Subject: [PATCH 6/7] CMake: Fix dll install location (#475) This fixes dll search on conda where dlls are expected to be installed in prefix/bin (pretty standard layout) static or import libs still go to prefix/lib Signed-off-by: Julien Schueller Co-authored-by: Cody Balos --- CHANGELOG.md | 8 ++++++-- cmake/macros/SundialsAddLibrary.cmake | 2 +- doc/shared/RecentChanges.rst | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf9091a19..03754be282 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,13 @@ ## Changes to SUNDIALS in release X.Y.Z -Fixed conflicting `.lib` files between shared and static libs when using `MSVC` on Windows +Fixed the runtime library installation path for windows systems. This fix changes the +default library installation path from `CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_LIBDIR` to +`CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_BINDIR`. -Fixed invalid `SUNDIALS_EXPORT` generated macro when building both shared and static libs +Fixed conflicting `.lib` files between shared and static libs when using `MSVC` on Windows. + +Fixed invalid `SUNDIALS_EXPORT` generated macro when building both shared and static libs. Created shared user interface for ARKODE user-callable routines, to allow more uniform control over time-stepping algorithms, improved extensibility, and diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake index 3c66bbe7e3..84505e4f12 100644 --- a/cmake/macros/SundialsAddLibrary.cmake +++ b/cmake/macros/SundialsAddLibrary.cmake @@ -362,7 +362,7 @@ macro(sundials_add_library target) endif() # install phase - install(TARGETS ${_actual_target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT sundials-targets) + install(TARGETS ${_actual_target_name} EXPORT sundials-targets) endif() diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 6b3cb4f270..3d7025d7ac 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -1,5 +1,9 @@ **New Features** +Fixed the runtime library installation path for windows systems. This fix changes the +default library installation path from ``CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_LIBDIR`` to +``CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_BINDIR``. + Created shared user interface for ARKODE user-callable routines, to allow more uniform control over time-stepping algorithms, improved extensibility, and simplified code maintenance. Marked the corresponding stepper-specific From 48bbc241fe9512345d323477190d593c5eaa9350 Mon Sep 17 00:00:00 2001 From: Steven Roberts Date: Fri, 17 May 2024 05:54:25 -0700 Subject: [PATCH 7/7] Fix missing statics and dead code identified with -Wmissing-declarations (#481) Co-authored-by: David Gardner Co-authored-by: Cody Balos --- .../SUNAdaptController_Description.rst | 17 +++ .../C_serial/ark_damped_harmonic_symplectic.c | 4 +- .../arkode/C_serial/ark_harmonic_symplectic.h | 6 +- examples/arkode/C_serial/ark_kepler.h | 11 +- include/sundials/sundials_adaptcontroller.h | 4 + src/arkode/arkode_relaxation.c | 4 +- src/arkode/arkode_sprk.c | 72 ++++++------- src/arkode/arkode_sprkstep_io.c | 15 --- src/ida/ida_ic.c | 2 - src/idas/idas_ic.c | 7 -- src/nvector/manyvector/nvector_manyvector.c | 3 - src/sundials/sundials_band.c | 61 ----------- src/sundials/sundials_dense.c | 100 ------------------ src/sundials/sundials_direct.c | 59 ----------- 14 files changed, 70 insertions(+), 295 deletions(-) diff --git a/doc/shared/sunadaptcontroller/SUNAdaptController_Description.rst b/doc/shared/sunadaptcontroller/SUNAdaptController_Description.rst index c5c02ceb44..9c6e791a7f 100644 --- a/doc/shared/sunadaptcontroller/SUNAdaptController_Description.rst +++ b/doc/shared/sunadaptcontroller/SUNAdaptController_Description.rst @@ -123,6 +123,23 @@ implementation, however some may be required based on the implementation's :c:type:`SUNAdaptController_Type` (see Section :numref:`SUNAdaptController.Description.controllerTypes`). We note these requirements below. Additionally, we note the behavior of the base SUNAdaptController methods when they perform an action other than only a successful return. +.. c:function:: void SUNAdaptController_DestroyEmpty(SUNAdaptController C) + + This routine frees the generic ``SUNAdaptController`` object, under the + assumption that any implementation-specific data that was allocated within the + underlying content structure has already been freed. It will additionally test + whether the ops pointer is ``NULL``, and, if it is not, it will free it as + well. + + :param C: the :c:type:`SUNAdaptController` object. + :return: :c:type:`SUNErrCode` indicating success or failure. + + Usage: + + .. code-block:: c + + retval = SUNAdaptController_DestroyEmpty(C); + .. c:function:: SUNAdaptController_Type SUNAdaptController_GetType(SUNAdaptController C) Returns the type identifier for the controller *C*. Returned values diff --git a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c index 8bfca224ed..ec3b797928 100644 --- a/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c +++ b/examples/arkode/C_serial/ark_damped_harmonic_symplectic.c @@ -157,9 +157,9 @@ int main(int argc, char* argv[]) return 0; } -sunrealtype omega(sunrealtype t) { return cos(t / SUN_RCONST(2.0)); } +static sunrealtype omega(sunrealtype t) { return cos(t / SUN_RCONST(2.0)); } -sunrealtype F(sunrealtype t) { return SUN_RCONST(0.018) * sin(t / PI); } +static sunrealtype F(sunrealtype t) { return SUN_RCONST(0.018) * sin(t / PI); } sunrealtype Hamiltonian(N_Vector yvec, sunrealtype t) { diff --git a/examples/arkode/C_serial/ark_harmonic_symplectic.h b/examples/arkode/C_serial/ark_harmonic_symplectic.h index 816961e6e5..498c4eb0d1 100644 --- a/examples/arkode/C_serial/ark_harmonic_symplectic.h +++ b/examples/arkode/C_serial/ark_harmonic_symplectic.h @@ -34,7 +34,7 @@ typedef struct sunrealtype dt; } ProgramArgs; -void PrintHelp(void) +static void PrintHelp(void) { fprintf(stderr, "ark_harmonic_symplectic: an ARKODE example demonstrating " "the SPRKStep time-stepping module solving a simple harmonic " @@ -48,7 +48,7 @@ void PrintHelp(void) /* clang-format on */ } -int ParseArgs(int argc, char* argv[], ProgramArgs* args) +static int ParseArgs(int argc, char* argv[], ProgramArgs* args) { int argi = 0; @@ -110,7 +110,7 @@ int ParseArgs(int argc, char* argv[], ProgramArgs* args) opt == 2 means function allocates memory so check if returned NULL pointer */ -int check_retval(void* returnvalue, const char* funcname, int opt) +static int check_retval(void* returnvalue, const char* funcname, int opt) { int* retval; diff --git a/examples/arkode/C_serial/ark_kepler.h b/examples/arkode/C_serial/ark_kepler.h index 01f40f26b5..d487347466 100644 --- a/examples/arkode/C_serial/ark_kepler.h +++ b/examples/arkode/C_serial/ark_kepler.h @@ -37,11 +37,12 @@ typedef struct const char* method_name; } ProgramArgs; -int ComputeConvergence(int num_dt, sunrealtype* orders, - sunrealtype expected_order, sunrealtype a11, - sunrealtype a12, sunrealtype a21, sunrealtype a22, - sunrealtype b1, sunrealtype b2, sunrealtype* ord_avg, - sunrealtype* ord_max, sunrealtype* ord_est) +static int ComputeConvergence(int num_dt, sunrealtype* orders, + sunrealtype expected_order, sunrealtype a11, + sunrealtype a12, sunrealtype a21, sunrealtype a22, + sunrealtype b1, sunrealtype b2, + sunrealtype* ord_avg, sunrealtype* ord_max, + sunrealtype* ord_est) { /* Compute/print overall estimated convergence rate */ int i = 0; diff --git a/include/sundials/sundials_adaptcontroller.h b/include/sundials/sundials_adaptcontroller.h index 9cde03bfa4..b27d7c73c8 100644 --- a/include/sundials/sundials_adaptcontroller.h +++ b/include/sundials/sundials_adaptcontroller.h @@ -91,6 +91,10 @@ struct _generic_SUNAdaptController SUNDIALS_EXPORT SUNAdaptController SUNAdaptController_NewEmpty(SUNContext sunctx); +/* Function to free a generic SUNAdaptController (assumes content is already empty) */ +SUNDIALS_EXPORT +void SUNAdaptController_DestroyEmpty(SUNAdaptController C); + /* Function to report the type of a SUNAdaptController object. */ SUNDIALS_EXPORT SUNAdaptController_Type SUNAdaptController_GetType(SUNAdaptController C); diff --git a/src/arkode/arkode_relaxation.c b/src/arkode/arkode_relaxation.c index 451fa6711a..b824bbfb9c 100644 --- a/src/arkode/arkode_relaxation.c +++ b/src/arkode/arkode_relaxation.c @@ -336,8 +336,8 @@ static int arkRelaxBrentSolve(ARKodeMem ark_mem) } /* Compute and apply relaxation parameter */ -int arkRelaxSolve(ARKodeMem ark_mem, ARKodeRelaxMem relax_mem, - sunrealtype* relax_val_out) +static int arkRelaxSolve(ARKodeMem ark_mem, ARKodeRelaxMem relax_mem, + sunrealtype* relax_val_out) { int retval; diff --git a/src/arkode/arkode_sprk.c b/src/arkode/arkode_sprk.c index c5e17837ab..a7d0349416 100644 --- a/src/arkode/arkode_sprk.c +++ b/src/arkode/arkode_sprk.c @@ -23,7 +23,7 @@ #include "arkode/arkode_butcher.h" #include "arkode_impl.h" -ARKodeSPRKTable ARKodeSymplecticEuler(void) +static ARKodeSPRKTable arkodeSymplecticEuler(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(1); if (!sprk_table) { return NULL; } @@ -43,7 +43,7 @@ ARKodeSPRKTable ARKodeSymplecticEuler(void) https://doi.org/10.1016/0021-9991(91)90299-Z. */ -ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void) +static ARKodeSPRKTable arkodeSymplecticLeapfrog2(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2); if (!sprk_table) { return NULL; } @@ -56,7 +56,7 @@ ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void) return sprk_table; } -ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void) +static ARKodeSPRKTable arkodeSymplecticPseudoLeapfrog2(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2); if (!sprk_table) { return NULL; } @@ -69,7 +69,7 @@ ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void) return sprk_table; } -ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void) +static ARKodeSPRKTable arkodeSymplecticCandyRozmus4(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4); if (!sprk_table) { return NULL; } @@ -108,7 +108,7 @@ ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void) https://accelconf.web.cern.ch/p83/PDF/PAC1983_2669.PDF */ -ARKodeSPRKTable ARKodeSymplecticRuth3(void) +static ARKodeSPRKTable arkodeSymplecticRuth3(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(3); if (!sprk_table) { return NULL; } @@ -130,7 +130,7 @@ ARKodeSPRKTable ARKodeSymplecticRuth3(void) Nonlinearity. 5, 541–562 (1992). https://doi.org/10.1088/0951-7715/5/2/011 */ -ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void) +static ARKodeSPRKTable arkodeSymplecticMcLachlan2(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2); if (!sprk_table) { return NULL; } @@ -145,7 +145,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void) return sprk_table; } -ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void) +static ARKodeSPRKTable arkodeSymplecticMcLachlan3(void) { sunrealtype w = SUN_RCONST(0.0); sunrealtype y = SUN_RCONST(0.0); @@ -175,7 +175,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void) return sprk_table; } -ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void) +static ARKodeSPRKTable arkodeSymplecticMcLachlan4(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4); if (!sprk_table) { return NULL; } @@ -192,7 +192,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void) return sprk_table; } -ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void) +static ARKodeSPRKTable arkodeSymplecticMcLachlan5(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(6); if (!sprk_table) { return NULL; } @@ -222,7 +222,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void) */ -ARKodeSPRKTable ARKodeSymplecticYoshida6(void) +static ARKodeSPRKTable arkodeSymplecticYoshida6(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(8); if (!sprk_table) { return NULL; } @@ -261,7 +261,7 @@ ARKodeSPRKTable ARKodeSymplecticYoshida6(void) */ -ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void) +static ARKodeSPRKTable arkodeSymplecticSuzukiUmeno816(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(16); if (!sprk_table) { return NULL; } @@ -311,7 +311,7 @@ ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void) */ -ARKodeSPRKTable ARKodeSymplecticSofroniou10(void) +static ARKodeSPRKTable arkodeSymplecticSofroniou10(void) { ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(36); if (!sprk_table) { return NULL; } @@ -453,19 +453,19 @@ ARKodeSPRKTable ARKodeSPRKTable_Load(ARKODE_SPRKMethodID id) { switch (id) { - case ARKODE_SPRK_EULER_1_1: return ARKodeSymplecticEuler(); - case ARKODE_SPRK_LEAPFROG_2_2: return ARKodeSymplecticLeapfrog2(); + case ARKODE_SPRK_EULER_1_1: return arkodeSymplecticEuler(); + case ARKODE_SPRK_LEAPFROG_2_2: return arkodeSymplecticLeapfrog2(); case ARKODE_SPRK_PSEUDO_LEAPFROG_2_2: - return ARKodeSymplecticPseudoLeapfrog2(); - case ARKODE_SPRK_RUTH_3_3: return ARKodeSymplecticRuth3(); - case ARKODE_SPRK_MCLACHLAN_2_2: return ARKodeSymplecticMcLachlan2(); - case ARKODE_SPRK_MCLACHLAN_3_3: return ARKodeSymplecticMcLachlan3(); - case ARKODE_SPRK_MCLACHLAN_4_4: return ARKodeSymplecticMcLachlan4(); - case ARKODE_SPRK_CANDY_ROZMUS_4_4: return ARKodeSymplecticCandyRozmus4(); - case ARKODE_SPRK_MCLACHLAN_5_6: return ARKodeSymplecticMcLachlan5(); - case ARKODE_SPRK_YOSHIDA_6_8: return ARKodeSymplecticYoshida6(); - case ARKODE_SPRK_SUZUKI_UMENO_8_16: return ARKodeSymplecticSuzukiUmeno816(); - case ARKODE_SPRK_SOFRONIOU_10_36: return ARKodeSymplecticSofroniou10(); + return arkodeSymplecticPseudoLeapfrog2(); + case ARKODE_SPRK_RUTH_3_3: return arkodeSymplecticRuth3(); + case ARKODE_SPRK_MCLACHLAN_2_2: return arkodeSymplecticMcLachlan2(); + case ARKODE_SPRK_MCLACHLAN_3_3: return arkodeSymplecticMcLachlan3(); + case ARKODE_SPRK_MCLACHLAN_4_4: return arkodeSymplecticMcLachlan4(); + case ARKODE_SPRK_CANDY_ROZMUS_4_4: return arkodeSymplecticCandyRozmus4(); + case ARKODE_SPRK_MCLACHLAN_5_6: return arkodeSymplecticMcLachlan5(); + case ARKODE_SPRK_YOSHIDA_6_8: return arkodeSymplecticYoshida6(); + case ARKODE_SPRK_SUZUKI_UMENO_8_16: return arkodeSymplecticSuzukiUmeno816(); + case ARKODE_SPRK_SOFRONIOU_10_36: return arkodeSymplecticSofroniou10(); default: return NULL; } } @@ -474,51 +474,51 @@ ARKodeSPRKTable ARKodeSPRKTable_LoadByName(const char* method) { if (!strcmp(method, "ARKODE_SPRK_EULER_1_1")) { - return ARKodeSymplecticEuler(); + return arkodeSymplecticEuler(); } if (!strcmp(method, "ARKODE_SPRK_LEAPFROG_2_2")) { - return ARKodeSymplecticLeapfrog2(); + return arkodeSymplecticLeapfrog2(); } if (!strcmp(method, "ARKODE_SPRK_PSEUDO_LEAPFROG_2_2")) { - return ARKodeSymplecticPseudoLeapfrog2(); + return arkodeSymplecticPseudoLeapfrog2(); } if (!strcmp(method, "ARKODE_SPRK_RUTH_3_3")) { - return ARKodeSymplecticRuth3(); + return arkodeSymplecticRuth3(); } if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_2_2")) { - return ARKodeSymplecticMcLachlan2(); + return arkodeSymplecticMcLachlan2(); } if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_3_3")) { - return ARKodeSymplecticMcLachlan3(); + return arkodeSymplecticMcLachlan3(); } if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_4_4")) { - return ARKodeSymplecticMcLachlan4(); + return arkodeSymplecticMcLachlan4(); } if (!strcmp(method, "ARKODE_SPRK_CANDY_ROZMUS_4_4")) { - return ARKodeSymplecticCandyRozmus4(); + return arkodeSymplecticCandyRozmus4(); } if (!strcmp(method, "ARKODE_SPRK_MCLACHLAN_5_6")) { - return ARKodeSymplecticMcLachlan5(); + return arkodeSymplecticMcLachlan5(); } if (!strcmp(method, "ARKODE_SPRK_YOSHIDA_6_8")) { - return ARKodeSymplecticYoshida6(); + return arkodeSymplecticYoshida6(); } if (!strcmp(method, "ARKODE_SPRK_SUZUKI_UMENO_8_16")) { - return ARKodeSymplecticSuzukiUmeno816(); + return arkodeSymplecticSuzukiUmeno816(); } if (!strcmp(method, "ARKODE_SPRK_SOFRONIOU_10_36")) { - return ARKodeSymplecticSofroniou10(); + return arkodeSymplecticSofroniou10(); } return NULL; } diff --git a/src/arkode/arkode_sprkstep_io.c b/src/arkode/arkode_sprkstep_io.c index f8ccd8bfb2..88378f14ca 100644 --- a/src/arkode/arkode_sprkstep_io.c +++ b/src/arkode/arkode_sprkstep_io.c @@ -414,16 +414,6 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt) return (ARKodePrintAllStats(arkode_mem, outfile, fmt)); } -void SPRKStepPrintMem(void* arkode_mem, FILE* outfile) -{ - ARKodePrintMem(arkode_mem, outfile); -} - -int SPRKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails) -{ - return (ARKodeSetMaxNumConstrFails(arkode_mem, maxfails)); -} - int SPRKStepWriteParameters(void* arkode_mem, FILE* fp) { return (ARKodeWriteParameters(arkode_mem, fp)); @@ -436,11 +426,6 @@ int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, return (ARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur)); } -int SPRKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails) -{ - return (ARKodeGetNumConstrFails(arkode_mem, nconstrfails)); -} - void SPRKStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); } /*=============================================================== diff --git a/src/ida/ida_ic.c b/src/ida/ida_ic.c index f1a0dacaf0..2d44eab573 100644 --- a/src/ida/ida_ic.c +++ b/src/ida/ida_ic.c @@ -58,8 +58,6 @@ */ extern int IDAInitialSetup(IDAMem IDA_mem); -extern sunrealtype IDAWrmsNorm(IDAMem IDA_mem, N_Vector x, N_Vector w, - sunbooleantype mask); static int IDAnlsIC(IDAMem IDA_mem); static int IDANewtonIC(IDAMem IDA_mem); diff --git a/src/idas/idas_ic.c b/src/idas/idas_ic.c index 783a75a3bb..c2f4d030ba 100644 --- a/src/idas/idas_ic.c +++ b/src/idas/idas_ic.c @@ -58,13 +58,6 @@ */ extern int IDAInitialSetup(IDAMem IDA_mem); -extern sunrealtype IDAWrmsNorm(IDAMem IDA_mem, N_Vector x, N_Vector w, - sunbooleantype mask); -extern sunrealtype IDASensWrmsNorm(IDAMem IDA_mem, N_Vector* xS, N_Vector* wS, - sunbooleantype mask); -extern sunrealtype IDASensWrmsNormUpdate(IDAMem IDA_mem, sunrealtype old_nrm, - N_Vector* xS, N_Vector* wS, - sunbooleantype mask); extern int IDASensEwtSet(IDAMem IDA_mem, N_Vector* yScur, N_Vector* weightS); diff --git a/src/nvector/manyvector/nvector_manyvector.c b/src/nvector/manyvector/nvector_manyvector.c index 2785ee7b91..d52cc4fee7 100644 --- a/src/nvector/manyvector/nvector_manyvector.c +++ b/src/nvector/manyvector/nvector_manyvector.c @@ -595,9 +595,6 @@ MPI_Comm N_VGetCommunicator_MPIManyVector(N_Vector v) { return (MANYVECTOR_COMM(v)); } -#else -/* This function retrieves the MPI Communicator from a ManyVector object. */ -SUNComm N_VGetCommunicator_ManyVector(N_Vector v) { return SUN_COMM_NULL; } #endif /* This function retrieves the global length of a ManyVector object. */ diff --git a/src/sundials/sundials_band.c b/src/sundials/sundials_band.c index 4124c701ea..d5fbcbb6a6 100644 --- a/src/sundials/sundials_band.c +++ b/src/sundials/sundials_band.c @@ -38,64 +38,33 @@ sunindextype SUNDlsMat_BandGBTRF(SUNDlsMat A, sunindextype* p) return (SUNDlsMat_bandGBTRF(A->cols, A->M, A->mu, A->ml, A->s_mu, p)); } -sunindextype BandGBTRF(SUNDlsMat A, sunindextype* p) -{ - return (SUNDlsMat_bandGBTRF(A->cols, A->M, A->mu, A->ml, A->s_mu, p)); -} - void SUNDlsMat_BandGBTRS(SUNDlsMat A, sunindextype* p, sunrealtype* b) { SUNDlsMat_bandGBTRS(A->cols, A->M, A->s_mu, A->ml, p, b); } -void BandGBTRS(SUNDlsMat A, sunindextype* p, sunrealtype* b) -{ - SUNDlsMat_bandGBTRS(A->cols, A->M, A->s_mu, A->ml, p, b); -} - void SUNDlsMat_BandCopy(SUNDlsMat A, SUNDlsMat B, sunindextype copymu, sunindextype copyml) { SUNDlsMat_bandCopy(A->cols, B->cols, A->M, A->s_mu, B->s_mu, copymu, copyml); } -void BandCopy(SUNDlsMat A, SUNDlsMat B, sunindextype copymu, sunindextype copyml) -{ - SUNDlsMat_bandCopy(A->cols, B->cols, A->M, A->s_mu, B->s_mu, copymu, copyml); -} - void SUNDlsMat_BandScale(sunrealtype c, SUNDlsMat A) { SUNDlsMat_bandScale(c, A->cols, A->M, A->mu, A->ml, A->s_mu); } -void BandScale(sunrealtype c, SUNDlsMat A) -{ - SUNDlsMat_bandScale(c, A->cols, A->M, A->mu, A->ml, A->s_mu); -} - void SUNDlsMat_BandMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y) { SUNDlsMat_bandMatvec(A->cols, x, y, A->M, A->mu, A->ml, A->s_mu); } -void BandMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y) -{ - SUNDlsMat_bandMatvec(A->cols, x, y, A->M, A->mu, A->ml, A->s_mu); -} - /* * ----------------------------------------------------- * Functions working on sunrealtype** * ----------------------------------------------------- */ -sunindextype bandGBTRF(sunrealtype** a, sunindextype n, sunindextype mu, - sunindextype ml, sunindextype smu, sunindextype* p) -{ - return (SUNDlsMat_bandGBTRF(a, n, mu, ml, smu, p)); -} - sunindextype SUNDlsMat_bandGBTRF(sunrealtype** a, sunindextype n, sunindextype mu, sunindextype ml, sunindextype smu, sunindextype* p) @@ -212,12 +181,6 @@ sunindextype SUNDlsMat_bandGBTRF(sunrealtype** a, sunindextype n, return (0); } -void bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu, - sunindextype ml, sunindextype* p, sunrealtype* b) -{ - SUNDlsMat_bandGBTRS(a, n, smu, ml, p, b); -} - void SUNDlsMat_bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu, sunindextype ml, sunindextype* p, sunrealtype* b) { @@ -252,13 +215,6 @@ void SUNDlsMat_bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu, } } -void bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n, - sunindextype a_smu, sunindextype b_smu, sunindextype copymu, - sunindextype copyml) -{ - SUNDlsMat_bandCopy(a, b, n, a_smu, b_smu, copymu, copyml); -} - void SUNDlsMat_bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n, sunindextype a_smu, sunindextype b_smu, sunindextype copymu, sunindextype copyml) @@ -276,12 +232,6 @@ void SUNDlsMat_bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n, } } -void bandScale(sunrealtype c, sunrealtype** a, sunindextype n, sunindextype mu, - sunindextype ml, sunindextype smu) -{ - SUNDlsMat_bandScale(c, a, n, mu, ml, smu); -} - void SUNDlsMat_bandScale(sunrealtype c, sunrealtype** a, sunindextype n, sunindextype mu, sunindextype ml, sunindextype smu) { @@ -297,11 +247,6 @@ void SUNDlsMat_bandScale(sunrealtype c, sunrealtype** a, sunindextype n, } } -void bandAddIdentity(sunrealtype** a, sunindextype n, sunindextype smu) -{ - SUNDlsMat_bandAddIdentity(a, n, smu); -} - void SUNDlsMat_bandAddIdentity(sunrealtype** a, sunindextype n, sunindextype smu) { sunindextype j; @@ -309,12 +254,6 @@ void SUNDlsMat_bandAddIdentity(sunrealtype** a, sunindextype n, sunindextype smu for (j = 0; j < n; j++) { a[j][smu] += ONE; } } -void bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype n, - sunindextype mu, sunindextype ml, sunindextype smu) -{ - SUNDlsMat_bandMatvec(a, x, y, n, mu, ml, smu); -} - void SUNDlsMat_bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype n, sunindextype mu, sunindextype ml, sunindextype smu) diff --git a/src/sundials/sundials_dense.c b/src/sundials/sundials_dense.c index f037fefbdf..ce420fca0f 100644 --- a/src/sundials/sundials_dense.c +++ b/src/sundials/sundials_dense.c @@ -38,99 +38,47 @@ sunindextype SUNDlsMat_DenseGETRF(SUNDlsMat A, sunindextype* p) return (SUNDlsMat_denseGETRF(A->cols, A->M, A->N, p)); } -sunindextype DenseGETRF(SUNDlsMat A, sunindextype* p) -{ - return (SUNDlsMat_denseGETRF(A->cols, A->M, A->N, p)); -} - void SUNDlsMat_DenseGETRS(SUNDlsMat A, sunindextype* p, sunrealtype* b) { SUNDlsMat_denseGETRS(A->cols, A->N, p, b); } -void DenseGETRS(SUNDlsMat A, sunindextype* p, sunrealtype* b) -{ - SUNDlsMat_denseGETRS(A->cols, A->N, p, b); -} - sunindextype SUNDlsMat_DensePOTRF(SUNDlsMat A) { return (SUNDlsMat_densePOTRF(A->cols, A->M)); } -sunindextype DensePOTRF(SUNDlsMat A) -{ - return (SUNDlsMat_densePOTRF(A->cols, A->M)); -} - void SUNDlsMat_DensePOTRS(SUNDlsMat A, sunrealtype* b) { SUNDlsMat_densePOTRS(A->cols, A->M, b); } -void DensePOTRS(SUNDlsMat A, sunrealtype* b) -{ - SUNDlsMat_densePOTRS(A->cols, A->M, b); -} - int SUNDlsMat_DenseGEQRF(SUNDlsMat A, sunrealtype* beta, sunrealtype* wrk) { return (SUNDlsMat_denseGEQRF(A->cols, A->M, A->N, beta, wrk)); } -int DenseGEQRF(SUNDlsMat A, sunrealtype* beta, sunrealtype* wrk) -{ - return (SUNDlsMat_denseGEQRF(A->cols, A->M, A->N, beta, wrk)); -} - int SUNDlsMat_DenseORMQR(SUNDlsMat A, sunrealtype* beta, sunrealtype* vn, sunrealtype* vm, sunrealtype* wrk) { return (SUNDlsMat_denseORMQR(A->cols, A->M, A->N, beta, vn, vm, wrk)); } -int DenseORMQR(SUNDlsMat A, sunrealtype* beta, sunrealtype* vn, sunrealtype* vm, - sunrealtype* wrk) -{ - return (SUNDlsMat_denseORMQR(A->cols, A->M, A->N, beta, vn, vm, wrk)); -} - void SUNDlsMat_DenseCopy(SUNDlsMat A, SUNDlsMat B) { SUNDlsMat_denseCopy(A->cols, B->cols, A->M, A->N); } -void DenseCopy(SUNDlsMat A, SUNDlsMat B) -{ - SUNDlsMat_denseCopy(A->cols, B->cols, A->M, A->N); -} - void SUNDlsMat_DenseScale(sunrealtype c, SUNDlsMat A) { SUNDlsMat_denseScale(c, A->cols, A->M, A->N); } -void DenseScale(sunrealtype c, SUNDlsMat A) -{ - SUNDlsMat_denseScale(c, A->cols, A->M, A->N); -} - void SUNDlsMat_DenseMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y) { SUNDlsMat_denseMatvec(A->cols, x, y, A->M, A->N); } -void DenseMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y) -{ - SUNDlsMat_denseMatvec(A->cols, x, y, A->M, A->N); -} - -sunindextype denseGETRF(sunrealtype** a, sunindextype m, sunindextype n, - sunindextype* p) -{ - return (SUNDlsMat_denseGETRF(a, m, n, p)); -} - sunindextype SUNDlsMat_denseGETRF(sunrealtype** a, sunindextype m, sunindextype n, sunindextype* p) { @@ -199,11 +147,6 @@ sunindextype SUNDlsMat_denseGETRF(sunrealtype** a, sunindextype m, return (0); } -void denseGETRS(sunrealtype** a, sunindextype n, sunindextype* p, sunrealtype* b) -{ - SUNDlsMat_denseGETRS(a, n, p, b); -} - void SUNDlsMat_denseGETRS(sunrealtype** a, sunindextype n, sunindextype* p, sunrealtype* b) { @@ -246,11 +189,6 @@ void SUNDlsMat_denseGETRS(sunrealtype** a, sunindextype n, sunindextype* p, * the lower triangle of C. */ -sunindextype densePOTRF(sunrealtype** a, sunindextype m) -{ - return (SUNDlsMat_densePOTRF(a, m)); -} - sunindextype SUNDlsMat_densePOTRF(sunrealtype** a, sunindextype m) { sunrealtype *a_col_j, *a_col_k; @@ -289,11 +227,6 @@ sunindextype SUNDlsMat_densePOTRF(sunrealtype** a, sunindextype m) * */ -void densePOTRS(sunrealtype** a, sunindextype m, sunrealtype* b) -{ - SUNDlsMat_densePOTRS(a, m, b); -} - void SUNDlsMat_densePOTRS(sunrealtype** a, sunindextype m, sunrealtype* b) { sunrealtype *col_j, *col_i; @@ -334,12 +267,6 @@ void SUNDlsMat_densePOTRS(sunrealtype** a, sunindextype m, sunrealtype* b) * */ -int denseGEQRF(sunrealtype** a, sunindextype m, sunindextype n, - sunrealtype* beta, sunrealtype* v) -{ - return (SUNDlsMat_denseGEQRF(a, m, n, beta, v)); -} - int SUNDlsMat_denseGEQRF(sunrealtype** a, sunindextype m, sunindextype n, sunrealtype* beta, sunrealtype* v) { @@ -404,12 +331,6 @@ int SUNDlsMat_denseGEQRF(sunrealtype** a, sunindextype m, sunindextype n, * v (of length m) must be provided as workspace. */ -int denseORMQR(sunrealtype** a, sunindextype m, sunindextype n, sunrealtype* beta, - sunrealtype* vn, sunrealtype* vm, sunrealtype* v) -{ - return (SUNDlsMat_denseORMQR(a, m, n, beta, vn, vm, v)); -} - int SUNDlsMat_denseORMQR(sunrealtype** a, sunindextype m, sunindextype n, sunrealtype* beta, sunrealtype* vn, sunrealtype* vm, sunrealtype* v) @@ -441,11 +362,6 @@ int SUNDlsMat_denseORMQR(sunrealtype** a, sunindextype m, sunindextype n, return (0); } -void denseCopy(sunrealtype** a, sunrealtype** b, sunindextype m, sunindextype n) -{ - SUNDlsMat_denseCopy(a, b, m, n); -} - void SUNDlsMat_denseCopy(sunrealtype** a, sunrealtype** b, sunindextype m, sunindextype n) { @@ -460,11 +376,6 @@ void SUNDlsMat_denseCopy(sunrealtype** a, sunrealtype** b, sunindextype m, } } -void denseScale(sunrealtype c, sunrealtype** a, sunindextype m, sunindextype n) -{ - SUNDlsMat_denseScale(c, a, m, n); -} - void SUNDlsMat_denseScale(sunrealtype c, sunrealtype** a, sunindextype m, sunindextype n) { @@ -478,11 +389,6 @@ void SUNDlsMat_denseScale(sunrealtype c, sunrealtype** a, sunindextype m, } } -void denseAddIdentity(sunrealtype** a, sunindextype n) -{ - SUNDlsMat_denseAddIdentity(a, n); -} - void SUNDlsMat_denseAddIdentity(sunrealtype** a, sunindextype n) { sunindextype i; @@ -490,12 +396,6 @@ void SUNDlsMat_denseAddIdentity(sunrealtype** a, sunindextype n) for (i = 0; i < n; i++) { a[i][i] += ONE; } } -void denseMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, - sunindextype m, sunindextype n) -{ - SUNDlsMat_denseMatvec(a, x, y, m, n); -} - void SUNDlsMat_denseMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype m, sunindextype n) { diff --git a/src/sundials/sundials_direct.c b/src/sundials/sundials_direct.c index 2bf135b9d3..02ff31d96c 100644 --- a/src/sundials/sundials_direct.c +++ b/src/sundials/sundials_direct.c @@ -23,11 +23,6 @@ #define ZERO SUN_RCONST(0.0) #define ONE SUN_RCONST(1.0) -SUNDlsMat NewDenseMat(sunindextype M, sunindextype N) -{ - return (SUNDlsMat_NewDenseMat(M, N)); -} - SUNDlsMat SUNDlsMat_NewDenseMat(sunindextype M, sunindextype N) { SUNDlsMat A; @@ -68,11 +63,6 @@ SUNDlsMat SUNDlsMat_NewDenseMat(sunindextype M, sunindextype N) return (A); } -sunrealtype** newDenseMat(sunindextype m, sunindextype n) -{ - return (SUNDlsMat_newDenseMat(m, n)); -} - sunrealtype** SUNDlsMat_newDenseMat(sunindextype m, sunindextype n) { sunindextype j; @@ -98,12 +88,6 @@ sunrealtype** SUNDlsMat_newDenseMat(sunindextype m, sunindextype n) return (a); } -SUNDlsMat NewBandMat(sunindextype N, sunindextype mu, sunindextype ml, - sunindextype smu) -{ - return (SUNDlsMat_NewBandMat(N, mu, ml, smu)); -} - SUNDlsMat SUNDlsMat_NewBandMat(sunindextype N, sunindextype mu, sunindextype ml, sunindextype smu) { @@ -151,11 +135,6 @@ SUNDlsMat SUNDlsMat_NewBandMat(sunindextype N, sunindextype mu, sunindextype ml, return (A); } -sunrealtype** newBandMat(sunindextype n, sunindextype smu, sunindextype ml) -{ - return (SUNDlsMat_newBandMat(n, smu, ml)); -} - sunrealtype** SUNDlsMat_newBandMat(sunindextype n, sunindextype smu, sunindextype ml) { @@ -183,8 +162,6 @@ sunrealtype** SUNDlsMat_newBandMat(sunindextype n, sunindextype smu, return (a); } -void DestroyMat(SUNDlsMat A) { SUNDlsMat_DestroyMat(A); } - void SUNDlsMat_DestroyMat(SUNDlsMat A) { free(A->data); @@ -194,8 +171,6 @@ void SUNDlsMat_DestroyMat(SUNDlsMat A) A = NULL; } -void destroyMat(sunrealtype** a) { SUNDlsMat_destroyMat(a); } - void SUNDlsMat_destroyMat(sunrealtype** a) { free(a[0]); @@ -204,8 +179,6 @@ void SUNDlsMat_destroyMat(sunrealtype** a) a = NULL; } -int* NewIntArray(int N) { return (SUNDlsMat_NewIntArray(N)); } - int* SUNDlsMat_NewIntArray(int N) { int* vec; @@ -218,8 +191,6 @@ int* SUNDlsMat_NewIntArray(int N) return (vec); } -int* newIntArray(int N) { return (SUNDlsMat_newIntArray(N)); } - int* SUNDlsMat_newIntArray(int n) { int* v; @@ -232,11 +203,6 @@ int* SUNDlsMat_newIntArray(int n) return (v); } -sunindextype* NewIndexArray(sunindextype N) -{ - return (SUNDlsMat_NewIndexArray(N)); -} - sunindextype* SUNDlsMat_NewIndexArray(sunindextype N) { sunindextype* vec; @@ -249,11 +215,6 @@ sunindextype* SUNDlsMat_NewIndexArray(sunindextype N) return (vec); } -sunindextype* newIndexArray(sunindextype n) -{ - return (SUNDlsMat_newIndexArray(n)); -} - sunindextype* SUNDlsMat_newIndexArray(sunindextype n) { sunindextype* v; @@ -266,11 +227,6 @@ sunindextype* SUNDlsMat_newIndexArray(sunindextype n) return (v); } -sunrealtype* NewRealArray(sunindextype N) -{ - return (SUNDlsMat_NewRealArray(N)); -} - sunrealtype* SUNDlsMat_NewRealArray(sunindextype N) { sunrealtype* vec; @@ -283,11 +239,6 @@ sunrealtype* SUNDlsMat_NewRealArray(sunindextype N) return (vec); } -sunrealtype* newRealArray(sunindextype N) -{ - return (SUNDlsMat_newRealArray(N)); -} - sunrealtype* SUNDlsMat_newRealArray(sunindextype m) { sunrealtype* v; @@ -300,24 +251,18 @@ sunrealtype* SUNDlsMat_newRealArray(sunindextype m) return (v); } -void DestroyArray(void* p) { SUNDlsMat_DestroyArray(p); } - void SUNDlsMat_DestroyArray(void* V) { free(V); V = NULL; } -void destroyArray(void* p) { SUNDlsMat_destroyArray(p); } - void SUNDlsMat_destroyArray(void* v) { free(v); v = NULL; } -void AddIdentity(SUNDlsMat A) { SUNDlsMat_AddIdentity(A); } - void SUNDlsMat_AddIdentity(SUNDlsMat A) { sunindextype i; @@ -334,8 +279,6 @@ void SUNDlsMat_AddIdentity(SUNDlsMat A) } } -void SetToZero(SUNDlsMat A) { SUNDlsMat_SetToZero(A); } - void SUNDlsMat_SetToZero(SUNDlsMat A) { sunindextype i, j, colSize; @@ -366,8 +309,6 @@ void SUNDlsMat_SetToZero(SUNDlsMat A) } } -void PrintMat(SUNDlsMat A, FILE* outfile) { SUNDlsMat_PrintMat(A, outfile); } - void SUNDlsMat_PrintMat(SUNDlsMat A, FILE* outfile) { sunindextype i, j, start, finish;