Skip to content

Commit

Permalink
Merged upstream changes from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
drreynolds committed Sep 5, 2024
2 parents 4c8e887 + 7f8c35b commit eb2c41b
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 50 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@

### New Features and Enhancements

Added Multirate time step adaptivity controllers, based on the recently introduced
`SUNAdaptController` base class, to ARKODE's MRIStep module.
The default value of `CMAKE_CUDA_ARCHITECTURES` is no longer set to `70` and is
now determined automatically by CMake. The previous default was only valid for
Volta GPUs while the automatically selected value will vary across compilers and
compiler versions. As such, users are encouraged to override this value with the
architecture for their system.

Added support for multirate time step adaptivity controllers, based on the
recently introduced `SUNAdaptController` base class, to ARKODE's MRIStep module.

Added functionality to ARKODE to accumulate a temporal error
estimate over multiple time steps. See the routines `ARKodeSetAccumulatedErrorType`,
Expand All @@ -17,6 +23,9 @@ estimate over multiple time steps. See the routines `ARKodeSetAccumulatedErrorT

Fixed the loading of ARKStep's default first order explicit method.

Fixed a CMake bug regarding usage of missing "print_warning" macro
that was only triggered when the deprecated `CUDA_ARCH` option was used.

### Deprecation Notices

## Changes to SUNDIALS in release 7.1.1
Expand Down
47 changes: 30 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,62 @@ equation (ODE) systems, differential-algebraic equation (DAE) systems, and
nonlinear algebraic systems:

* ARKODE - for integrating stiff, nonstiff, and multirate ODEs of the form

$$M(t) \\, y' = f_1(t,y) + f_2(t,y), \quad y(t_0) = y_0$$

* CVODE - for integrating stiff and nonstiff ODEs of the form

$$y' = f(t,y), \quad y(t_0) = y_0$$

* CVODES - for integrating and sensitivity analysis (forward and adjoint) of
ODEs of the form

$$y' = f(t,y,p), \quad y(t_0) = y_0(p)$$

* IDA - for integrating DAEs of the form

$$F(t,y,y') = 0, \quad y(t_0) = y_0, \quad y'(t_0) = y_0'$$

* IDAS - for integrating and sensitivity analysis (forward and adjoint) of DAEs
of the form

$$F(t,y,y',p) = 0, \quad y(t_0) = y_0(p), \quad y'(t_0) = y_0'(p)$$

* KINSOL - for solving nonlinear algebraic systems of the form

$$F(u) = 0 \quad \text{or} \quad G(u) = u$$

## Installation ##

For installation directions see the [online install guide](https://sundials.readthedocs.io/en/latest/Install_link.html),
the installation chapter in any of the package user guides, or INSTALL_GUIDE.pdf.
For installation directions, see the [getting started](https://sundials.readthedocs.io/en/latest/sundials/index.html#getting-started)
section in the online documentation. In the [released tarballs](https://github.com/LLNL/sundials/releases),
installation directions are also available in `INSTALL_GUIDE.pdf` and the
installation chapter of the user guides in the `doc` directory.

Warning to users who receive more than one of the individual packages at
different times: Mixing old and new versions of SUNDIALS may fail. To avoid
such failures, obtain all desired package at the same time.
different times: Mixing old and new versions of SUNDIALS may fail. To avoid such
failures, obtain all desired package at the same time.

## Support ##

Full user guides for all of the SUNDIALS packages are available [online](https://sundials.readthedocs.io)
and in the [doc](./doc) directory. Additionally, the [doc](./doc) directory
contains documentation for the package example programs.
Full user guides for all of the SUNDIALS packages are available [online](https://sundials.readthedocs.io).
In the [released tarballs](https://github.com/LLNL/sundials/releases), the `doc`
directory includes PDFs of the user guides and documentation for the example
programs. The example program documentation PDFs are also available on the
[releases page](https://github.com/LLNL/sundials/releases).

For information on recent changes to SUNDIALS see the [CHANGELOG](./CHANGELOG.md)
or the introduction chapter of any package user guide.

A list of Frequently Asked Questions on build and installation procedures as
well as common usage issues is available on the SUNDIALS [FAQ](https://computing.llnl.gov/projects/sundials/faq).
For dealing with systems with unphysical solutions or discontinuities see the
SUNDIALS [usage notes](https://computing.llnl.gov/projects/sundials/usage-notes).
well as common usage issues is available on the SUNDIALS
[FAQ](https://computing.llnl.gov/projects/sundials/faq). For dealing with
systems with nonphysical solutions or discontinuities see the SUNDIALS
[usage notes](https://computing.llnl.gov/projects/sundials/usage-notes).

If you have a question not covered in the FAQ or usage notes, please submit
your question to the SUNDIALS [mailing list](https://computing.llnl.gov/projects/sundials/mailing-list).
If you have a question not covered in the FAQ or usage notes, please submit your
question as a [GitHub issue](https://github.com/LLNL/sundials/issues) or to the
SUNDIALS [mailing list](https://computing.llnl.gov/projects/sundials/mailing-list).

## Contributing ##

Expand All @@ -76,14 +88,15 @@ any publications reporting work done using SUNDIALS packages.

The SUNDIALS library has been developed over many years by a number of
contributors. The current SUNDIALS team consists of Cody J. Balos,
David J. Gardner, Alan C. Hindmarsh, Daniel R. Reynolds, and Carol S. Woodward.
We thank Radu Serban for significant and critical past contributions.
David J. Gardner, Alan C. Hindmarsh, Daniel R. Reynolds, Steven B. Roberts, and
Carol S. Woodward. We thank Radu Serban for significant and critical past
contributions.

Other contributors to SUNDIALS include: James Almgren-Bell, Lawrence E. Banks,
Peter N. Brown, George Byrne, Rujeko Chinomona, Scott D. Cohen, Aaron Collier,
Keith E. Grant, Steven L. Lee, Shelby L. Lockhart, John Loffeld, Daniel McGreer,
Yu Pan, Slaven Peles, Cosmin Petra, Steven B. Roberts, H. Hunter Schwartz,
Jean M. Sexton, Dan Shumaker, Steve G. Smith, Shahbaj Sohal, Allan G. Taylor,
Yu Pan, Slaven Peles, Cosmin Petra, H. Hunter Schwartz, Jean M. Sexton,
Dan Shumaker, Steve G. Smith, Shahbaj Sohal, Allan G. Taylor,
Hilari C. Tiedeman, Chris White, Ting Yan, and Ulrike M. Yang.

## License ##
Expand All @@ -93,7 +106,7 @@ and [NOTICE](./NOTICE) files for details. All new contributions must be made
under the BSD 3-clause license.

**Please Note** If you are using SUNDIALS with any third party libraries linked
in (e.g., LAPACK, KLU, SuperLU_MT, PETSc, or *hypre*), be sure to review the
in (e.g., LAPACK, KLU, SuperLU_MT, PETSc, *hypre*, etc.), be sure to review the
respective license of the package as that license may have more restrictive
terms than the SUNDIALS license.

Expand Down
4 changes: 2 additions & 2 deletions cmake/SundialsDeprecated.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ endif()
#

if(DEFINED CUDA_ARCH)
print_warning("The CMake option CUDA_ARCH is deprecated. "
"Use CMAKE_CUDA_ARCHITECTURES instead.")
message(DEPRECATION "The CMake option CUDA_ARCH is deprecated. "
"Use CMAKE_CUDA_ARCHITECTURES instead.")
# convert sm_** to just **
string(REGEX MATCH "[0-9]+" arch_name "${CUDA_ARCH}")
set(CMAKE_CUDA_ARCHITECTURES
Expand Down
4 changes: 0 additions & 4 deletions cmake/SundialsTPLOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ sundials_option(ENABLE_PTHREAD BOOL "Enable Pthreads support" OFF)
# -------------------------------------------------------------
sundials_option(ENABLE_CUDA BOOL "Enable CUDA support" OFF)

# CMake 3.18 adds this option.
sundials_option(CMAKE_CUDA_ARCHITECTURES STRING "Target CUDA architecture" "70"
DEPENDS_ON ENABLE_CUDA)

# -------------------------------------------------------------
# Enable HIP support?
# -------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/arkode/guide/source/Usage/MRIStep/User_callable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ Optional inputs for IVP method selection
Select the default MRI method of a given order.
The default order is 3. An order less than 3 or greater than 4 will result in
The default order is 3. An order less than 1 or greater than 4 will result in
using the default.
:param arkode_mem: pointer to the MRIStep memory block.
Expand Down
2 changes: 1 addition & 1 deletion doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ by the user to setup and then solve an IVP using the SPRKStep time-stepping
module. The large majority of these routines merely wrap :ref:`underlying
ARKODE functions <ARKODE.Usage.UserCallable>`, and are now deprecated
-- each of these are clearly marked. However, some
of these user-callable functions are specific to ERKStep, as explained
of these user-callable functions are specific to SPRKStep, as explained
below.

As discussed in the main :ref:`ARKODE user-callable function introduction
Expand Down
18 changes: 14 additions & 4 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

**New Features and Enhancements**

Added Multirate time step adaptivity controllers, based on the recently introduced
`SUNAdaptController` base class, to ARKODE's MRIStep module.
The default value of :cmakeop:`CMAKE_CUDA_ARCHITECTURES` is no longer set to
``70`` and is now determined automatically by CMake. The previous default was
only valid for Volta GPUs while the automatically selected value will vary
across compilers and compiler versions. As such, users are encouraged to
override this value with the architecture for their system.

Added support for multirate time step adaptivity controllers, based on the
recently introduced `SUNAdaptController` base class, to ARKODE's MRIStep module.

Added functionality to ARKODE to accumulate a temporal error
estimate over multiple time steps. See the routines :c:func:`ARKodeSetAccumulatedErrorType`,
:c:func:`ARKodeResetAccumulatedError`, and :c:func:`ARKodeGetAccumulatedError` for details.
estimate over multiple time steps. See the routines
:c:func:`ARKodeSetAccumulatedErrorType`, :c:func:`ARKodeResetAccumulatedError`,
and :c:func:`ARKodeGetAccumulatedError` for details.

**Bug Fixes**

Fixed the loading of ARKStep's default first order explicit method.

Fixed a CMake bug regarding usage of missing "print_warning" macro
that was only triggered when the deprecated ``CUDA_ARCH`` option was used.

**Deprecation Notices**
14 changes: 12 additions & 2 deletions doc/shared/sundials/Install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,19 @@ illustration only.

.. cmakeoption:: CMAKE_CUDA_ARCHITECTURES

Specifies the CUDA architecture to compile for.
Specifies the CUDA architecture to compile for i.e., ``60`` for Pascal,
``70`` Volta, ``80`` for Ampere, ``90`` for Hopper, etc. See the `GPU compute
capability tables <https://developer.nvidia.com/cuda-gpus>`_ on the NVIDIA
webpage and the `GPU Compilation <https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-compilation>`_
section of the CUDA documentation for more information.

Default: ``sm_30``
Default: Determined automatically by CMake. Users are encouraged to override
this value with the architecture for their system as the default varies
across compilers and compiler versions.

.. versionchanged:: x.y.z

In prior versions ``CMAKE_CUDA_ARCHITECTURES`` defaulted to ``70``.

.. cmakeoption:: EXAMPLES_ENABLE_C

Expand Down
6 changes: 4 additions & 2 deletions include/sundials/priv/sundials_errors_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ static inline void SUNHandleErrWithFmtMsg(int line, const char* func,
msglen = (size_t)vsnprintf(NULL, (size_t)0, msgfmt, values); /* determine size
of buffer
needed */
msg = (char*)malloc(msglen + 1);
va_end(values);
msg = (char*)malloc(msglen + 1);
va_start(values, sunctx);
vsnprintf(msg, msglen + 1, msgfmt, values);
SUNHandleErrWithMsg(line, func, file, msg, code, sunctx);
va_end(values);
SUNHandleErrWithMsg(line, func, file, msg, code, sunctx);
free(msg);
}

Expand Down
8 changes: 4 additions & 4 deletions src/sundials/sundials_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ void SUNGlobalFallbackErrHandler(int line, const char* func, const char* file,
char* log_msg = NULL;
char* file_and_line = NULL;

va_start(ap, err_code);

file_and_line = sunCombineFileAndLine(__LINE__, __FILE__);
va_start(ap, err_code);
sunCreateLogMessage(SUN_LOGLEVEL_ERROR, 0, file_and_line,
__func__, "The SUNDIALS SUNContext was corrupt or NULL when an error occurred. As such, error messages have been printed to stderr.",
ap, &log_msg);
va_end(ap);
fprintf(stderr, "%s", log_msg);
free(log_msg);
free(file_and_line);

file_and_line = sunCombineFileAndLine(line, file);
if (msgfmt == NULL) { msgfmt = SUNGetErrMsg(err_code); }
va_start(ap, err_code);
sunCreateLogMessage(SUN_LOGLEVEL_ERROR, 0, file_and_line, func, msgfmt, ap,
&log_msg);
va_end(ap);
fprintf(stderr, "%s", log_msg);
free(log_msg);
free(file_and_line);

va_end(ap);
}
11 changes: 6 additions & 5 deletions src/sundials/sundials_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ SUNErrCode SUNLogger_QueueMsg(SUNLogger logger, SUNLogLevel lvl,
return retval;
}

va_list args;
va_start(args, msg_txt);

if (logger->queuemsg)
{
va_list args;
va_start(args, msg_txt);
retval = logger->queuemsg(logger, lvl, scope, label, msg_txt, args);
va_end(args);
}
else
{
Expand All @@ -347,7 +347,10 @@ SUNErrCode SUNLogger_QueueMsg(SUNLogger logger, SUNLogLevel lvl,
if (sunLoggerIsOutputRank(logger, &rank))
{
char* log_msg = NULL;
va_list args;
va_start(args, msg_txt);
sunCreateLogMessage(lvl, rank, scope, label, msg_txt, args, &log_msg);
va_end(args);

switch (lvl)
{
Expand All @@ -372,8 +375,6 @@ SUNErrCode SUNLogger_QueueMsg(SUNLogger logger, SUNLogLevel lvl,
free(log_msg);
}
}

va_end(args);
}
#else
/* silence warnings when all logging is disabled */
Expand Down
15 changes: 9 additions & 6 deletions test/unit_tests/sundials/test_sundials_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,25 @@ class SUNContextErrFunctionTests : public testing::Test
SUNContext sunctx;
};

void firstHandler(int line, const char* func, const char* file, const char* msg,
SUNErrCode err_code, void* err_user_data, SUNContext sunctx)
static void firstHandler(int line, const char* func, const char* file,
const char* msg, SUNErrCode err_code,
void* err_user_data, SUNContext sunctx)
{
std::vector<int>* order = static_cast<std::vector<int>*>(err_user_data);
order->push_back(0);
}

void secondHandler(int line, const char* func, const char* file, const char* msg,
SUNErrCode err_code, void* err_user_data, SUNContext sunctx)
static void secondHandler(int line, const char* func, const char* file,
const char* msg, SUNErrCode err_code,
void* err_user_data, SUNContext sunctx)
{
std::vector<int>* order = static_cast<std::vector<int>*>(err_user_data);
order->push_back(1);
}

void thirdHandler(int line, const char* func, const char* file, const char* msg,
SUNErrCode err_code, void* err_user_data, SUNContext sunctx)
static void thirdHandler(int line, const char* func, const char* file,
const char* msg, SUNErrCode err_code,
void* err_user_data, SUNContext sunctx)
{
std::vector<int>* order = static_cast<std::vector<int>*>(err_user_data);
order->push_back(2);
Expand Down

0 comments on commit eb2c41b

Please sign in to comment.