Skip to content

Feature/float128 a#858

Open
wuzhiqiao-ninecube wants to merge 281 commits intollnl:developfrom
wuzhiqiao-ninecube:feature/float128_a
Open

Feature/float128 a#858
wuzhiqiao-ninecube wants to merge 281 commits intollnl:developfrom
wuzhiqiao-ninecube:feature/float128_a

Conversation

@wuzhiqiao-ninecube
Copy link

@wuzhiqiao-ninecube wuzhiqiao-ninecube commented Mar 6, 2026

  • Please target the develop branch not main.
  • Review our Contributing Guide, and ensure that you sign your last commit (at minimum) as per the guide.
  • Provide a concise description of what your pull request does, and why it is needed/benefical.
  • Add a note about your change to the CHANGELOG.md and docs/shared/RecentChanges.rst files. Notice that the former is a markdown file and the latter is reStructuredText, so the formatting is slightly different.
  • After your PR is opened, ensure that all of the tests are passing (a SUNDIALS developer will have to allow the testing to run).

Add comprehensive __float128 support with quadmath dependency and ostream integration

This commit implements full support for the __float128 data type across SUNDIALS:

  1. Core Implementation

    • Added dependency on libquadmath for quad-precision math operations
    • New CMake configuration options:
      • -D SUNDIALS_PRECISION=float128
      • -D SUNDIALS_MATH_LIBRARY=SUNDIALS_MATH_LIBRARY=/usr/lib/x86_64-linux-gnu/libm.so;/usr/lib/gcc/x86_64-linux-gnu/13/libquadmath.so
    • Automatic definition of SUNDIALS_FLOAT128_PRECISION macro when enabled
  2. Precision System Enhancements

    • Added SUN_DIGITS10 constant to sundials_type.h (avoiding std::numeric_limits::digits10)
    • Implemented complete set of quadmath math functions:
      • SUNRsqrt, SUNRabs, SUNRisnan, SUNRexp, SUNRlog
      • SUNRceil, SUNRcopysign, SUNRpowerR, SUNRround
      • SUNRsin, SUNRcos, SUNRsinh, SUNRcosh, SUNRasin, SUNRacos, SUNRatan
    • three macros — SUNRcosh, SUNRsinh, and SUNRlog — were moved from the src/arkode/arkode_lsrkstep_impl.h file to include/sundials/sundials_math.h
    • Increased precision of PI constant to 40+ digits:
      #define PI SUN_RCONST(3.141592653589793238462643383279502884)
      The output files (*.out) of the related examples have been changed as a result, and a corresponding commit was made.
  3. Code Unification

    • Replaced all local math macros (ABS, SIN, etc.) with unified SUNR* macros
    • Updated C/C++ examples to use precision-portable math operations:
      // Before
      #define ATAN(x) (atan((x)))
      
      // After
      y = SUNRatan(x);
    • Modified C++ examples to use SUNR* macros instead of std functions
  4. I/O System

    • Implemented printf formatting for __float128:

      • Defined GSYM="Qg", ESYM="Qe", FSYM="Qf" for float128
      • Added precision-specific format specifiers:
        #if defined(SUNDIALS_FLOAT128_PRECISION)
          printf("Value = %Qg", float128_val);
        #endif
        However, the compilation warning "warning: unknown conversion type character ‘Q’ in format [-Wformat=]" could not be eliminated.
    • Added std::ostream support for __float128:

      • Full stream state capture (width/precision/flags)
      • Dynamic quadmath_snprintf formatting
      • Scientific/fixed/general format detection
      • Example usage:
        __float128 q = 1.234q;
        std::cout << std::scientific << std::setprecision(15) << q;
  5. Environment Support Matrix

    Environment Support Status
    C ✓ Implemented
    C++ ✓ Implemented
    OpenMP ✓ Implemented
    Pthread ✓ Implemented
    MPI ✓ Implemented
    Fortran ✗ Not supported
    OpenMP Device ✗ Not supported
    CUDA ✗ Not supported
    HIP ✗ Not supported

Key Technical Decisions:

  • Avoided std::numeric_limits in favor of SUN_DIGITS10
  • Unified math operations through SUNR* macros
  • Maintained printf compatibility with quadmath specifiers
  • Implemented native C++ stream integration
  • Ensured precision constants meet float128 requirements

This implementation enables quad-precision computations while maintaining API consistency across all precision modes. The solution provides seamless integration with both C-style printf and C++ ostream interfaces, with special attention to cross-environment compatibility and precision portability.

Signed-off-by: Wu Zhiqiao wuzhiqiao79@gmail.com

gardner48 and others added 30 commits December 11, 2024 07:27
SUNDIALS Release v7.2.0
Updates to start the next release cycle on develop
Move vector, matrix, linear solver, and nonlinear solver tests to unit test directory

-----

Co-authored-by: David Gardner <gardner48@llnl.gov>
Create separate sections for documenting source code and documentation
in the developer guide
Remove mostly unused force_variable CMake macro
Remove wrappers that were originally part of a C90 workaround and
are no longer needed now that C99 is required
Fix a bug in ARKStep where an extra right-hand side evaluation occurs
each time step when enabling the ``ARKodeSetAutonomous`` option and
using an IMEX method where the DIRK table has an implicit first and is
not stiffly accurate. Fix a bug in counting the number of explicit RHS
evaluations in the ARKStep Dahlquist unit test.

---------

Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu>
* Always enable testing
* Consistent naming of CMake testing options
* Add warnings/errors for some testing option combinations
* Add documentation for testing options
* Move testing README into testing docs
* Cleanup using default testing options
* Enable running test in containers without enabling development tests
* Simplify setting pre and post executable run commands/options in
sundials_add_test
* Remove redundant Jenkins tests
* Remove precision dependent diff option in unit tests
SUNDIALS Release v7.2.1

---------

Co-authored-by: Cody Balos <cjbalos@gmail.com>
Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu>
Update recent changes for next release cycle
Update release checklist 

-----

Co-authored-by: David Gardner <gardner48@llnl.gov>
Adding a status badge for the workflow that tracks downloads in
https://github.com/sundials-codes/sundials-download-tracker. This will
make it readily apparent when there is an issue tracking downloads.

See sundials-codes/sundials-download-tracker#1.
Fix version numbers in the install guide 
Fix scripts to automatically update version numbers
Fix typo in version changed directive
Only zero yerr when compensated summation is enabled

-----

Co-authored-by: David J. Gardner <gardner48@llnl.gov>
…l#639)

Bumps
[docker/build-push-action](https://github.com/docker/build-push-action)
from 6.10.0 to 6.11.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/docker/build-push-action/releases">docker/build-push-action's
releases</a>.</em></p>
<blockquote>
<h2>v6.11.0</h2>
<ul>
<li>Handlebar <code>defaultContext</code> support for
<code>build-contexts</code> input by <a
href="https://github.com/crazy-max"><code>@​crazy-max</code></a> in <a
href="https://redirect.github.com/docker/build-push-action/pull/1283">docker/build-push-action#1283</a></li>
<li>Bump <code>@​docker/actions-toolkit</code> from 0.46.0 to 0.49.0 in
<a
href="https://redirect.github.com/docker/build-push-action/pull/1281">docker/build-push-action#1281</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/docker/build-push-action/compare/v6.10.0...v6.11.0">https://github.com/docker/build-push-action/compare/v6.10.0...v6.11.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/docker/build-push-action/commit/b32b51a8eda65d6793cd0494a773d4f6bcef32dc"><code>b32b51a</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1281">#1281</a>
from docker/dependabot/npm_and_yarn/docker/actions-t...</li>
<li><a
href="https://github.com/docker/build-push-action/commit/594bf46f0f6d32fd8bd98a553127950004165c96"><code>594bf46</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1294">#1294</a>
from crazy-max/fix-e2e</li>
<li><a
href="https://github.com/docker/build-push-action/commit/fd37bd55af0b8c458ea0ff376ce151a332fa7aed"><code>fd37bd5</code></a>
ci(e2e): fix setup docker config</li>
<li><a
href="https://github.com/docker/build-push-action/commit/e6478a2405f3527f33b93efb6857519c3ffd91f2"><code>e6478a2</code></a>
chore: update generated content</li>
<li><a
href="https://github.com/docker/build-push-action/commit/78785bddff35ca36f384e0c6a8a367584317df9f"><code>78785bd</code></a>
chore(deps): Bump <code>@​docker/actions-toolkit</code> from 0.46.0 to
0.49.0</li>
<li><a
href="https://github.com/docker/build-push-action/commit/128779fed7edb034b3f8006e9dac81a8593c040e"><code>128779f</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1283">#1283</a>
from crazy-max/named-context-handlebars</li>
<li><a
href="https://github.com/docker/build-push-action/commit/7e094594beda23fc8f21fa31049f4b203e51096b"><code>7e09459</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1282">#1282</a>
from crazy-max/remove-buildkit-5561</li>
<li><a
href="https://github.com/docker/build-push-action/commit/32ee877a58507615d974839965ef8e530d66362e"><code>32ee877</code></a>
Revert &quot;init buildkit-5561 workflow&quot;</li>
<li><a
href="https://github.com/docker/build-push-action/commit/d1a4129c41bb3f92b731b33dc29cfe5f6cd9298f"><code>d1a4129</code></a>
chore: update generated content</li>
<li><a
href="https://github.com/docker/build-push-action/commit/49c623eaf82513814393adabc13bf2535384d735"><code>49c623e</code></a>
handlebar defaultContext support for build-contexts input</li>
<li>Additional commits viewable in <a
href="https://github.com/docker/build-push-action/compare/v6.10.0...v6.11.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=docker/build-push-action&package-manager=github_actions&previous-version=6.10.0&new-version=6.11.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix the behavior of `SUNDIALS_ENABLE_ERROR_CHECKS` so additional runtime
error checks are disabled by default with all release build types.
Previously, `MinSizeRel` builds enabled additional error checking by
default.
This PR rectifies an omission from our last release, where we forgot to
update the lists of SUNDIALS contributors to include Mustafa Aggul (who
contributed the ARKODE LSRKStep module).
Add SUN_FORMAT_E, SUN_FORMAT_G, and SUN_FORMAT_SG macros

---------

Co-authored-by: David Gardner <gardner48@llnl.gov>
Add CI jobs to build PDFs for the user guides, example docs, and install
guide
Currently, our `/autofix` command does not work because the jobs don't
have the 'write' permission. This will fix it, but not until the change
ends up in `main`.

This permission can be set globally too, but this is more secure.
Add -Wunused-macros and -Wunused-local-typedefs with ENABLE_ALL_WARNINGS

--------

Co-authored-by: David Gardner <gardner48@llnl.gov>
* Separate sections for installing with Spack and CMake
* Co-locate Linux, Windows, and HPC install instructions in CMake
section
* Remove `ccmake` steps to focus on simpler `cmake` steps
* Create subsections for related CMake options 
* Combine TPL sections with related TPL options
* Add cross-references to corresponding TPL modules
* Add configuration examples for all TPLs
* Combine addons section with CMake option
* Create subsections for table of headers and libraries 
* Add CMake targets to tables
* Add missing headers and libraries
* Remove deprecated headers
* Remove duplicate text

---------

Co-authored-by: Steven Roberts <roberts115@llnl.gov>
…l#650)

Bumps
[docker/build-push-action](https://github.com/docker/build-push-action)
from 6.11.0 to 6.12.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/docker/build-push-action/releases">docker/build-push-action's
releases</a>.</em></p>
<blockquote>
<h2>v6.12.0</h2>
<ul>
<li>Bump <code>@​docker/actions-toolkit</code> from 0.49.0 to 0.51.0 in
<a
href="https://redirect.github.com/docker/build-push-action/pull/1300">docker/build-push-action#1300</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/docker/build-push-action/compare/v6.11.0...v6.12.0">https://github.com/docker/build-push-action/compare/v6.11.0...v6.12.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/docker/build-push-action/commit/67a2d409c0a876cbe6b11854e3e25193efe4e62d"><code>67a2d40</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1300">#1300</a>
from docker/dependabot/npm_and_yarn/docker/actions-t...</li>
<li><a
href="https://github.com/docker/build-push-action/commit/0b1b1c9c43ec788c199860037a0545356ea03d26"><code>0b1b1c9</code></a>
chore: update generated content</li>
<li><a
href="https://github.com/docker/build-push-action/commit/b6a7c2c4eec8151a4dbcd3823747fe1b77d5b280"><code>b6a7c2c</code></a>
chore(deps): Bump <code>@​docker/actions-toolkit</code> from 0.49.0 to
0.51.0</li>
<li><a
href="https://github.com/docker/build-push-action/commit/31ca4e5d51253d7e4a2317bfe74699cbe3a398a9"><code>31ca4e5</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1296">#1296</a>
from crazy-max/bake-v6</li>
<li><a
href="https://github.com/docker/build-push-action/commit/e613db9d5a93dda4d07aeb81991e80164577ae4a"><code>e613db9</code></a>
update bake-action to v6</li>
<li>See full diff in <a
href="https://github.com/docker/build-push-action/compare/v6.11.0...v6.12.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=docker/build-push-action&package-manager=github_actions&previous-version=6.11.0&new-version=6.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Update copyright year range for 2025
Add .sh suffix to tarscripts 
Fix spelling errors with new codespell version 

---------

Co-authored-by: David Gardner <gardner48@llnl.gov>
Clean up how ARKODE and its steppers check for required and optional
N_Vector routines. 

1. Stepper-specific N_Vector operation checks have been removed.
2. ARKODE performs an initial check on the supplied N_Vector for
operations that are always required.
3. Individual ARKODE utilities perform their own N_Vector checks when
they are configured.
4. ARKODE then performs a final check after user configuration is
complete to check any remaining N_Vector operation requirements.

---------

Co-authored-by: David Gardner <gardner48@llnl.gov>
Add sundials_add_executable macro to easily include/exclude
examples with complex values
…l#654)

Bumps
[docker/build-push-action](https://github.com/docker/build-push-action)
from 6.12.0 to 6.13.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/docker/build-push-action/releases">docker/build-push-action's
releases</a>.</em></p>
<blockquote>
<h2>v6.13.0</h2>
<ul>
<li>Bump <code>@​docker/actions-toolkit</code> from 0.51.0 to 0.53.0 in
<a
href="https://redirect.github.com/docker/build-push-action/pull/1308">docker/build-push-action#1308</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/docker/build-push-action/compare/v6.12.0...v6.13.0">https://github.com/docker/build-push-action/compare/v6.12.0...v6.13.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/docker/build-push-action/commit/ca877d9245402d1537745e0e356eab47c3520991"><code>ca877d9</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1308">#1308</a>
from docker/dependabot/npm_and_yarn/docker/actions-t...</li>
<li><a
href="https://github.com/docker/build-push-action/commit/d2fe919bb5012a6186426dc91c361c4980d10c2d"><code>d2fe919</code></a>
chore: update generated content</li>
<li><a
href="https://github.com/docker/build-push-action/commit/f0fc9ece82cf2ace13ec8f35687697ae511bdf74"><code>f0fc9ec</code></a>
chore(deps): Bump <code>@​docker/actions-toolkit</code> from 0.51.0 to
0.53.0</li>
<li>See full diff in <a
href="https://github.com/docker/build-push-action/compare/v6.12.0...v6.13.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=docker/build-push-action&package-manager=github_actions&previous-version=6.12.0&new-version=6.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix typo in Shu-Osher-3-2-3 ERK method table docs
Uniquely names artifacts for a matrix of jobs to so there's no conflicts
The changes will allow us to get out files across all logging levels and
precisions with one run rather than repeated runs and updates.
wuzhiqiao-ninecube added a commit to wuzhiqiao-ninecube/answers that referenced this pull request Mar 12, 2026
…e/sundials/actions/runs/22986226478/artifacts/5884255897.
…e/sundials/actions/runs/22986226478/artifacts/5884255897.
…/float128_a

# Conflicts:
#	benchmarks/diffusion_2D/diffusion_2D.cpp
#	examples/arkode/CXX_serial/ark_kpr_Mt.cpp
#	examples/ida/parallel/idaFoodWeb_kry_p.c
#	examples/ida/serial/idaFoodWeb_kry.c
#	examples/idas/parallel/idasFoodWeb_kry_p.c
#	include/sundials/sundials_types.h
…s_types.h to sundials_types.hpp, and modified header includes in several examples and tests accordingly.
…known conversion type character ‘Q’ in format;

In #define SUN_RCONST(x) x##Q, avoid excessive -Wpedantic warnings
@drreynolds
Copy link
Collaborator

drreynolds commented Mar 13, 2026

I could be mistaken, but I believe that __float128 is only supported by GCC, and even then, only on x86-64 and i386 targets. In other words, __float128 is not supported by other compilers (e.g., Clang, MSVC) or on other architectures (AArch64, most GPUs). One of our top goals with SUNDIALS is to ensure that it is portable, and not specifically tied to a small set of compilers/architectures.

Furthermore, the existing heuristic constants, and many of the method coefficients, throughout SUNDIALS have only been tested for at most long double, which generally has less precision (80-bit on many compilers/architectures), so it is unclear which of these would need to be adjusted for true 128-bit floating-point computations. If this is nontrivial, then our team will struggle to take on the level of "new work" that would be required to truly support __float128 throughout the SUNDIALS.

@wuzhiqiao-ninecube, can you provide a compelling reason why you think that SUNDIALS should add comprehensive __float128 support, including dependency on the [GCC-specific] libquadmath library? I realize that this implementation likely took considerable effort, and in perusing the changes it looks like you fixed a number of minor issues throughout the repository, so I hate to disregard it entirely, but without a very clear motivation we cannot accept a contribution that rules out so many modern computing systems and compilers, and that would significantly add so much unfunded effort onto our team.

Let me also point out half of the first paragraph from our Contributing Guide, where we say: "At this time, the SUNDIALS team does not have the resources to review and take in large additions to the code or significant new features. Larger additions can be contributed as a SUNDIALS "addon" which is a component that may be optionally downloaded by users and then compiled and installed with SUNDIALS."

@wuzhiqiao-ninecube
Copy link
Author

wuzhiqiao-ninecube commented Mar 16, 2026

I could be mistaken, but I believe that __float128 is only supported by GCC, and even then, only on x86-64 and i386 targets. In other words, __float128 is not supported by other compilers (e.g., Clang, MSVC) or on other architectures (AArch64, most GPUs). One of our top goals with SUNDIALS is to ensure that it is portable, and not specifically tied to a small set of compilers/architectures.

Furthermore, the existing heuristic constants, and many of the method coefficients, throughout SUNDIALS have only been tested for at most long double, which generally has less precision (80-bit on many compilers/architectures), so it is unclear which of these would need to be adjusted for true 128-bit floating-point computations. If this is nontrivial, then our team will struggle to take on the level of "new work" that would be required to truly support __float128 throughout the SUNDIALS.

@wuzhiqiao-ninecube, can you provide a compelling reason why you think that SUNDIALS should add comprehensive __float128 support, including dependency on the [GCC-specific] libquadmath library? I realize that this implementation likely took considerable effort, and in perusing the changes it looks like you fixed a number of minor issues throughout the repository, so I hate to disregard it entirely, but without a very clear motivation we cannot accept a contribution that rules out so many modern computing systems and compilers, and that would significantly add so much unfunded effort onto our team.

Let me also point out half of the first paragraph from our Contributing Guide, where we say: "At this time, the SUNDIALS team does not have the resources to review and take in large additions to the code or significant new features. Larger additions can be contributed as a SUNDIALS "addon" which is a component that may be optionally downloaded by users and then compiled and installed with SUNDIALS."

Thank you very much for your detailed and thoughtful feedback on my pull request. I truly appreciate the time you took to review the changes and to explain the portability and maintainability concerns.

I understand that __float128 and libquadmath are traditionally associated with GCC on x86-64/i386, and that portability is a top priority for SUNDIALS. However, I’d like to share a few additional observations and motivations that might help clarify the potential value of this feature.

  1. Compiler and Platform Support for __float128
    I have done some preliminary testing on Ubuntu with GCC, Clang, and Intel compilers, and all three successfully compiled the code using __float128 and libquadmath. While I fully acknowledge that this is not a guarantee for all platforms (e.g., MSVC, AArch64, GPUs), it does suggest that support may be broader than initially assumed. Still, I agree that any integration must be done in a way that does not break the build on unsupported platforms.

  2. Motivation for Adding __float128 Support
    My interest in this feature stems from several scientific computing needs:

High-precision reference solutions: In ODE/DAE problems, having a very accurate reference solution (computed with __float128) can help validate the correctness of lower-precision simulations and numerical methods.

Semiconductor device simulation: In my previous work on semiconductor physics and device simulation, extremely small quantities (e.g., carrier concentrations, tunneling probabilities) often require precision beyond double or even long double. __float128 provides a valuable tool for such problems.

Mixed-precision iterative solvers: In the context of linear system solvers, mixed-precision strategies (e.g., using __float128 for residuals or selective refinement) are an active research area. Having native __float128 support in SUNDIALS would enable experimentation and potential advances in this direction.

  1. Nature of the Modifications
    I should also note that the majority of changes in the pull request are concentrated in the examples directory. The core modifications are limited to two files: sundials_math.h and sundials_types.hpp. In the examples, I replaced locally-defined macros for mathematical functions (e.g., SUNRsqrt, SUNRabs, SUNRisnan, etc.) with the ones already provided by sundials_math.h, and similarly unified the printf format specifier macros (GSYM, ESYM, FSYM). These changes are not strictly tied to __float128—they improve code consistency and could be submitted as a separate, independent pull request. If that would make review easier, I’m happy to split the work and first contribute these cleanups.

  2. Exploring the Addon Approach
    Regarding the suggestion to implement this feature as an addon (as mentioned in the Contributing Guide), I agree that this could be a viable path. However, I’m not entirely sure how to structure an addon that would allow __float128 to be used as a basic sunrealtype option. Typically, addons are more self-contained components (e.g., new solvers or vector implementations). I’m open to discussing how we might design such an addon, or if there are alternative ways to integrate high-precision support without compromising the core’s portability. If the team has any guidance or examples, I would be glad to follow them.

In the meantime, I would be happy to:

Split off the non‑__float128 improvements into a separate PR for immediate inclusion.

Offer to help maintain any 128‑bit related code in the future, to reduce the burden on your team.

Please let me know what you think would be best. Again, thank you for your honest and constructive feedback—I really appreciate it, and I’m committed to aligning this contribution with SUNDIALS’ goals.

Best regards,
wuzhiqiao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants