Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Release mode the default build type so users automatically get the fastest configuration #422

Merged
merged 24 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fd0448e
make Release mode the default build type so users automatically get t…
balos1 Feb 15, 2024
73b0bc4
Apply suggestions from code review
balos1 Feb 15, 2024
c8e7415
Merge branch 'develop' into feature/default-to-release-build
gardner48 Feb 22, 2024
7cf3b9f
update recent changes
balos1 Feb 22, 2024
ecbe53c
Merge remote-tracking branch 'origin/feature/default-to-release-build…
balos1 Feb 22, 2024
6f6da5d
remove obsolete xsdk defaults setting for build type
balos1 Feb 22, 2024
a369cde
Update CHANGELOG.md
balos1 Feb 22, 2024
39e6f9a
fix uninitialized variable warning
balos1 Feb 22, 2024
d84eb01
address Steven's feedback about SUNContext_PushErrHandler function do…
balos1 Feb 22, 2024
04e0e64
further doc improvements to error handler section
balos1 Feb 22, 2024
0dcc4ed
Merge remote-tracking branch 'origin/feature/default-to-release-build…
balos1 Feb 22, 2024
b0fc181
fix uninitialized value error
balos1 Feb 22, 2024
797eedb
fix uninitialized error
balos1 Feb 26, 2024
cec5790
fix uninitialized error
gardner48 Feb 27, 2024
eff86e6
Merge branch 'develop' into feature/default-to-release-build
gardner48 Feb 27, 2024
dc16ab8
Merge branch 'develop' into feature/default-to-release-build
gardner48 Feb 27, 2024
0954046
fix compiler warnings
gardner48 Feb 27, 2024
7b25aa6
move SUNHint, SUNAssume macros to priv header
gardner48 Feb 27, 2024
b322d86
Merge remote-tracking branch 'origin/maintenance/relocate-private-mac…
balos1 Feb 27, 2024
0452080
dont expand SUNAssert to SUNAssume since it seems to cause some unexp…
balos1 Feb 27, 2024
d566c12
debug build on jenkins
balos1 Feb 28, 2024
6c44647
update default in config_cmake.py
gardner48 Feb 28, 2024
8503bea
Merge branch 'develop' into feature/default-to-release-build
gardner48 Feb 28, 2024
e9f10fd
Merge branch 'develop' into feature/default-to-release-build
gardner48 Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ Fixed [#329](https://github.com/LLNL/sundials/issues/329) so that C++20 aggregat

Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
[#409](https://github.com/LLNL/sundials/issues/409) and
[#249](https://github.com/LLNL/sundials/issues/249)
[#249](https://github.com/LLNL/sundials/issues/249).

The `CMAKE_BUILD_TYPE` defaults to `RelWithDebInfo` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from `SUNDIALS_F77_FUNC_CASE` and
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ set(_SHARED_LIB_SUFFIX
set(_SUNDIALS_ALIAS_TARGETS ""
CACHE INTERNAL "" FORCE)

# We default to release builds
balos1 marked this conversation as resolved.
Show resolved Hide resolved
set(_DEFAULT_CMAKE_BUILD_TYPE RelWithDebInfo)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Building SUNDIALS in '${_DEFAULT_CMAKE_BUILD_TYPE}' mode as CMAKE_BUILD_TYPE was not specified.")
set(CMAKE_BUILD_TYPE "${_DEFAULT_CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
else()
message(STATUS "Building SUNDIALS in '${CMAKE_BUILD_TYPE}' mode.")
endif()
gardner48 marked this conversation as resolved.
Show resolved Hide resolved

# ===============================================================
# Build options to be processed first
# ===============================================================
Expand Down
7 changes: 0 additions & 7 deletions cmake/SundialsBuildOptionsPre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ sundials_option(USE_XSDK_DEFAULTS BOOL "Enable default xSDK settings" OFF)

if(USE_XSDK_DEFAULTS)
message(STATUS "Enabling xSDK defaults:")

# set the CMake build type, SUNDIALS does not set a build type by default
if(NOT CMAKE_BUILD_TYPE)
message(STATUS " Setting build type to Debug")
set(DOCSTR "Choose the type of build: None Debug Release RelWithDebInfo MinSizeRel")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "${DOCSTR}" FORCE)
endif()
endif()

# ---------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions doc/arkode/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
5 changes: 5 additions & 0 deletions doc/cvode/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
5 changes: 5 additions & 0 deletions doc/cvodes/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
5 changes: 5 additions & 0 deletions doc/ida/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
5 changes: 5 additions & 0 deletions doc/idas/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
5 changes: 5 additions & 0 deletions doc/kinsol/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ Fixed integer overflow in the internal SUNDIALS hashmap. This resolves
`GitHub Issues #409 <https://github.com/LLNL/sundials/issues/409>`_ and
`#249 <https://github.com/LLNL/sundials/issues/249>`_.

The ``CMAKE_BUILD_TYPE`` defaults to ``RelWithDebInfo`` mode now i.e., SUNDIALS
will be built with optimizations and debugging symbols enabled by default.
Previously the build type was unset by default so no optimization or debugging
flags were set.

The advanced CMake options to override the inferred LAPACK name-mangling scheme
have been updated from ``SUNDIALS_F77_FUNC_CASE`` and
``SUNDIALS_F77_FUNC_UNDERSCORES`` to :cmakeop:`SUNDIALS_LAPACK_CASE` and
Expand Down
29 changes: 16 additions & 13 deletions doc/shared/sundials/Errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ SUNDIALS core API (i.e., ``SUN`` or ``N_V`` functions only) either return a :c:t
occurs) within the :c:type:`SUNContext` for the execution stream. This "last error" is accessible
via the :c:func:`SUNContext_GetLastError` or :c:func:`SUNContext_PeekLastError` functions.

.. c:type:: int SUNErrCode
.. c:type:: int SUNErrCode

Thus, in user code, SUNDIALS core API functions can be checked for errors in one of two ways:

.. code-block:: C

SUNContext sunctx;
SUNErrCode sunerr;
SUNErrCode sunerr;
N_Vector v;
int length;
sunrealtype dotprod;

// Every code that uses SUNDIALS must create a SUNContext.
sunctx = SUNContext_Create(...);

Expand All @@ -54,8 +54,8 @@ Thus, in user code, SUNDIALS core API functions can be checked for errors in one
// Another function that does not return a SUNErrCode.
dotprod = N_VDotProd(...);
SUNContext_GetLastError(sunctx);
if (sunerr) {
/* an error occured, do something */
if (sunerr) {
/* an error occured, do something */
} else {
print("dotprod = %.2f\n", dotprod);
}
Expand All @@ -80,18 +80,21 @@ The function :c:func:`SUNGetErrMsg` can be used to get a message describing the

.. warning::

If a function returns a :c:type:`SUNErrCode` then the return value is the only place the error is available
i.e., these functions do not store their error code as the "last error" so it is invalid to use
:c:func:`SUNContext_GetLastError` to check these functions for errors.
If a function returns a :c:type:`SUNErrCode` then the return value is the only place the error is available
i.e., these functions do not store their error code as the "last error" so it is invalid to use
:c:func:`SUNContext_GetLastError` to check these functions for errors.


.. _SUNDIALS.Errors.Handlers:

Error Handler Functions
-----------------------

Errors that occur internally to SUNDIALS result in an error handler function being called.
These error handler functions have the type
When an error occurs in SUNDIALS, it calls error handler functions that have
been pushed onto the error handler stack in last-in first-out order.
Specific error handlers can be enabled by pushing them onto the error handler stack
with the function :c:func:`SUNContext_PushErrHandler`. They may disabled by calling :c:func:`SUNContext_PopErrHandler` or :c:func:`SUNContext_ClearErrHandlers`.
A SUNDIALS error handler function has the type

.. c:type:: int (*SUNErrHandlerFn)(int line, const char* func, const char* file, \
const char* msg, SUNErrCode err_code, \
Expand All @@ -113,7 +116,7 @@ The error handlers provided in SUNDIALS are:

:param line: the line number at which the error occured
:param func: the function in which the error occured
:param file: the file in which the error occured
:param file: the file in which the error occured
:param msg: the message to log, if this is ``NULL`` then the default error message for the error code will be used
:param err_code: the error code for the error that occured
:param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler`
Expand All @@ -129,7 +132,7 @@ The error handlers provided in SUNDIALS are:

:param line: the line number at which the error occured
:param func: the function in which the error occured
:param file: the file in which the error occured
:param file: the file in which the error occured
:param msg: this parameter is ignored
:param err_code: the error code for the error that occured
:param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler`
Expand All @@ -146,7 +149,7 @@ The error handlers provided in SUNDIALS are:

:param line: the line number at which the error occured
:param func: the function in which the error occured
:param file: the file in which the error occured
:param file: the file in which the error occured
:param msg: this parameter is ignored
:param err_code: the error code for the error that occured
:param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler`
Expand Down
18 changes: 9 additions & 9 deletions doc/shared/sundials/Install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ source. One option is to use the `Spack HPC package manager <https://spack.io/>`
The second supported option for building and installing SUNDIALS is with CMake.
Before proceeding with CMake, the source code must be downloaded. This can be done
by cloning the `SUNDIALS GitHub repository <https://github.com/LLNL/sundials>`_
(run ``git clone https://github.com/LLNL/sundials``), or by downloading the
SUNDIALS release compressed archives (``.tar.gz``) from the SUNDIALS
(run ``git clone https://github.com/LLNL/sundials``), or by downloading the
SUNDIALS release compressed archives (``.tar.gz``) from the SUNDIALS
`website <https://computing.llnl.gov/projects/sundials/sundials-software>`_.

The compressed archives allow for downloading of indvidual SUNDIALS packages.
The name of the distribution archive is of the form
``SOLVER-X.Y.Z.tar.gz``, where ``SOLVER`` is one of: ``sundials``, ``cvode``,
``cvodes``, ``arkode``, ``ida``, ``idas``, or ``kinsol``, and ``X.Y.Z``
represents the version number (of the SUNDIALS suite or of the individual
solver). After downloading the relevant archives, uncompress and expand the sources,
solver). After downloading the relevant archives, uncompress and expand the sources,
by running

.. code-block:: bash
Expand Down Expand Up @@ -353,9 +353,9 @@ illustration only.
.. cmakeoption:: CMAKE_BUILD_TYPE

Choose the type of build, options are:
``None``, ``Debug``, ``Release``, ``RelWithDebInfo``, and ``MinSizeRel``
``Debug``, ``Release``, ``RelWithDebInfo``, and ``MinSizeRel``

Default:
Default: ``RelWithDebInfo``

.. note::

Expand Down Expand Up @@ -630,8 +630,8 @@ illustration only.

.. cmakeoption:: SUNDIALS_ENABLE_ERROR_CHECKS

Build SUNDIALS with more extensive checks for unrecoverable errors.
Build SUNDIALS with more extensive checks for unrecoverable errors.

Default: ``OFF`` when ``CMAKE_BUILD_TYPE=Release|RelWithDebInfo `` and ``ON`` otherwise.

.. warning::
Expand Down Expand Up @@ -1048,7 +1048,7 @@ illustration only.
Default: None

.. cmakeoption:: ENABLE_ADIAK

Enable Adiak support

Default: OFF
Expand Down Expand Up @@ -1675,7 +1675,7 @@ header files.
SUNDIALS installs some header files to ``INSTDIR/include/sundials/priv``.
All of the header files in this directory are private and **should not
be included in user code**. The private headers are subject to change
without any notice and relying on them may break your code.
without any notice and relying on them may break your code.


Using SUNDIALS in your prpject
Expand Down
5 changes: 3 additions & 2 deletions examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ program main
type(c_ptr) :: cvodes_mem
type(N_Vector), pointer :: u, uiS
type(c_ptr) :: uS
type(SUNNonlinearSolver), pointer :: NLS, NLSsens
type(SUNNonlinearSolver), pointer :: NLS
type(SUNNonlinearSolver), pointer :: NLSsens => null()
integer(c_int) :: iout, retval
real(c_double) :: reltol, abstol, tout, t(1)
integer(c_int) :: is
Expand Down Expand Up @@ -381,7 +382,7 @@ program main

call FCVodeFree(cvodes_mem)
retval = FSUNNonlinSolFree(NLS)
if (sensi /= 0) then
if (associated(NLSsens)) then
retval = FSUNNonlinSolFree(NLSsens)
endif

Expand Down
Loading
Loading