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

Enable Fortran interface for 32-bit sunindextype #447

Merged
merged 87 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
57688aa
change space functions to use long int
balos1 Feb 17, 2024
4489fc2
fix use of Space functions in iterative solvers
balos1 Feb 26, 2024
4bef213
fix nvector space op
balos1 Feb 26, 2024
37875a7
regen fortran
balos1 Feb 26, 2024
b6c67fb
update places where Space is called and wrong type of args is used
balos1 Feb 26, 2024
ead7727
more places where liw lrw dont match
balos1 Feb 26, 2024
63b11da
update swig generation to be able to produce int32 or int64 sunindext…
balos1 Mar 26, 2024
469071e
fix make
balos1 Mar 26, 2024
489210c
fix typo
balos1 Mar 26, 2024
41cd23e
fix up swig and swig makefile
balos1 Mar 26, 2024
ab73c56
generate 32-bit sunindextype fortran
balos1 Mar 26, 2024
878933f
regenerate 32-bit sunindextype and 64, setup separate directories for…
balos1 Mar 26, 2024
febfd6c
test fortran with both sunindextype sizes
balos1 Mar 26, 2024
32e80b7
Merge branch 'develop' into feature/fortran-32index-build
gardner48 Mar 27, 2024
0db5a5a
Merge branch 'develop' into feature/fortran-32index-build
gardner48 Mar 28, 2024
68fad59
Merge branch 'feature/sunindextype-long-int-fixes' into feature/fortr…
balos1 Mar 29, 2024
ed97953
update examples
balos1 Mar 29, 2024
6f55e27
revert headers of space functions
balos1 Mar 29, 2024
4d518cb
regen swig
balos1 Mar 29, 2024
70fdadf
revert all source for space functions
balos1 Mar 29, 2024
3ab78ff
revert arkode impl
balos1 Mar 29, 2024
0e315f2
more fixes for consistency - promote int to sunindextype
balos1 Mar 29, 2024
7db6c2c
fix more examples and definitions with wrong int type
balos1 Mar 29, 2024
4ca1877
use long long
balos1 Mar 29, 2024
8c93b9d
remove old fmod directories
balos1 Mar 29, 2024
a07187a
revert files that should not have been changed
balos1 Mar 29, 2024
63ad76a
format
balos1 Mar 29, 2024
004d33c
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 Mar 29, 2024
7edab46
change sunindextype to myindextype in examples
balos1 Apr 2, 2024
bda9016
fix sparse sunmatrix custom fortran functions
balos1 Apr 2, 2024
da44cea
missed kind sunindextype --> myindextype
balos1 Apr 2, 2024
29caae4
Merge branch 'develop' into feature/fortran-32index-build
balos1 Apr 2, 2024
226dd22
fix mismatched integer size
balos1 Apr 3, 2024
f418e5a
fix another integer mismatch
balos1 Apr 4, 2024
41dd601
fix trilinos vector
balos1 Apr 4, 2024
7f3187b
update parallel examples to use proper integer kind
balos1 Apr 25, 2024
d0b3497
a few more fixes to make consistent use of myindextype
balos1 Apr 25, 2024
79c7f1c
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 Apr 25, 2024
5343266
fixes in openmp and pthreads vectors
balos1 Apr 25, 2024
540f7eb
fix klu example
balos1 Apr 25, 2024
60697cf
fix index size in check_ans
balos1 Apr 25, 2024
179e512
fix parallel vector too
balos1 Apr 25, 2024
35dc697
fix fortran make and cmake templates
balos1 Apr 29, 2024
18a0351
Merge branch 'develop' into feature/fortran-32index-build
balos1 Apr 29, 2024
1416670
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 6, 2024
db69de0
add a swig workflow
balos1 May 6, 2024
678cbdd
rename job
balos1 May 6, 2024
c21eb5a
remove containers line, only run on prs
balos1 May 6, 2024
a5a6423
remove git install line
balos1 May 6, 2024
045ac4d
only run clang format on PRs and by request
balos1 May 6, 2024
1d7a808
fix swig build
balos1 May 6, 2024
1e404f4
a couple doc notes
balos1 May 6, 2024
5560026
fix swig version command
balos1 May 6, 2024
7a0241c
change CVodeSetSensParams back
balos1 May 6, 2024
5fa2eb1
plist must be int of size 4
balos1 May 6, 2024
febac51
werror fixes
balos1 May 6, 2024
bc8207d
regen swig
balos1 May 6, 2024
a1d2e5c
bump answers
balos1 May 6, 2024
6aa852f
bump answers
balos1 May 6, 2024
02128f8
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 7, 2024
6ab3a0d
swig update
balos1 May 7, 2024
5f500ad
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 9, 2024
467b08c
fix warnings
balos1 May 9, 2024
11f8ab3
update missed cmake template
balos1 May 9, 2024
e03d8d3
correct / add answer files for examples that were not enabled before
balos1 May 9, 2024
106cfe7
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 13, 2024
5f2fbf5
fix cmake templates
balos1 May 13, 2024
2e82769
update fortran interface
balos1 May 13, 2024
5873dd7
update out
balos1 May 13, 2024
36e9514
Update doc/superbuild/source/developers/getting_started/Checklist.rst
balos1 May 13, 2024
d6af78b
change back vector array indexes to int
balos1 May 23, 2024
5054639
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 23, 2024
5b35907
regen fortran
balos1 May 23, 2024
f454537
Apply suggestions from code review
balos1 May 23, 2024
fb4f259
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 23, 2024
46ebae5
Merge branch 'develop' into feature/fortran-32index-build
gardner48 May 24, 2024
9978f60
Merge branch 'develop' into feature/fortran-32index-build
gardner48 May 24, 2024
158a5ba
update swig
balos1 May 24, 2024
fe2e1bf
fix answers commit
balos1 May 24, 2024
ebf3ff5
make requested changes in PR review
balos1 May 30, 2024
240a563
enable other examples that may work with 32-bit indices
balos1 May 30, 2024
88bfe93
Merge remote-tracking branch 'origin/develop' into feature/fortran-32…
balos1 May 30, 2024
eeb5e0f
Merge branch 'develop' into feature/fortran-32index-build
gardner48 Jun 11, 2024
2566b4d
fix index type in two examples
balos1 Jun 12, 2024
6368aa8
fix warning
balos1 Jun 12, 2024
d6fa0de
fix more warnings
balos1 Jun 12, 2024
ddf5e2a
update answers commit
gardner48 Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 4 additions & 5 deletions .github/workflows/check-clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Checks - clang-format

on:
push:
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -36,12 +35,12 @@ jobs:

- name: Run git diff if we failed
if: failure()
run: /usr/bin/git diff > diff
run: /usr/bin/git diff > clang_format.patch

- name: Archive diff if we failed
- name: Archive diff as a patch if we failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: diff
name: clang_format.patch
path: |
${{ github.workspace }}/diff
${{ github.workspace }}/clang_format.patch
49 changes: 49 additions & 0 deletions .github/workflows/check-swig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Checks - swig

on:
pull_request:
workflow_dispatch:

jobs:
swig:
runs-on: ubuntu-latest

steps:
- name: Install swig
run: |
git clone https://github.com/sundials-codes/swig
cd swig
./autogen.sh
./configure --prefix=/usr/
make
sudo make install
swig -version

- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true

- name: Add safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Run swig on code
run: |
cd swig
make all32
make all64

- name: Run git diff to see if anything changed
run: /usr/bin/git diff --name-only --exit-code

- name: Run git diff if we failed
if: failure()
run: /usr/bin/git diff > swig.patch

- name: Archive diff as a patch if we failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: swig.patch
path: |
${{ github.workspace }}/swig.patch
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Fixed a bug in some Fortran examples where `c_null_ptr` was passed as an argumen
to a function pointer instead of `c_null_funptr`. This caused compilation issues
with the Cray Fortran compiler.

Enabled the Fortran interfaces to build with 32-bit `sunindextype`.
balos1 marked this conversation as resolved.
Show resolved Hide resolved

Fixed a bug where `MRIStepEvolve` would not handle a recoverable error produced
from evolving the inner stepper.

Expand Down
5 changes: 0 additions & 5 deletions cmake/SundialsBuildOptionsPre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ if(BUILD_FORTRAN_MODULE_INTERFACE)
print_error("F2003 interface is not compatible with ${SUNDIALS_PRECISION} precision")
endif()

# F2003 interface only supports 64-bit indices
if(NOT (SUNDIALS_INDEX_SIZE MATCHES "64"))
print_error("F2003 interface is not compatible with ${SUNDIALS_INDEX_SIZE}-bit indicies")
endif()

# Allow a user to set where the Fortran modules will be installed
set(DOCSTR "Directory where Fortran module files are installed")
sundials_option(Fortran_INSTALL_MODDIR STRING "${DOCSTR}" "fortran")
Expand Down
11 changes: 1 addition & 10 deletions cmake/SundialsExampleOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,14 @@ endif()
# Fortran 2003 interface is enabled.
set(DOCSTR "Build SUNDIALS Fortran 2003 examples")
if(BUILD_FORTRAN_MODULE_INTERFACE)
balos1 marked this conversation as resolved.
Show resolved Hide resolved

sundials_option(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" ON)
set(EXAMPLES_ENABLE_F2003 ON CACHE BOOL "${DOCSTR}")

# Fortran 2003 examples only support double precision
if(EXAMPLES_ENABLE_F2003 AND (NOT (SUNDIALS_PRECISION MATCHES "DOUBLE")))
print_warning("F2003 examples are not compatible with ${SUNDIALS_PRECISION} precision. "
"Setting EXAMPLES_ENABLE_F2003 to OFF.")
force_variable(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" OFF)
endif()

# Fortran 2003 examples only support 64-bit indices
if(EXAMPLES_ENABLE_F2003 AND (NOT (SUNDIALS_INDEX_SIZE MATCHES "64")))
print_warning("F2003 examples are not compatible with ${SUNDIALS_INDEX_SIZE}-bit indices. "
"Setting EXAMPLES_ENABLE_F2003 to OFF.")
force_variable(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" OFF)
endif()

else()

# set back to OFF (in case it was ON)
Expand Down
1 change: 1 addition & 0 deletions cmake/macros/SundialsAddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ macro(sundials_add_f2003_library target)
${sundials_add_f2003_library_INCLUDE_DIRECTORIES}
${_includes}
COMPILE_DEFINITIONS ${sundials_add_f2003_library_COMPILE_DEFINITIONS}
PUBLIC "SUNDIALS_INT${SUNDIALS_INDEX_SIZE}_T"
COMPILE_OPTIONS ${sundials_add_f2003_library_COMPILE_OPTIONS}
PROPERTIES ${sundials_add_f2003_library_PROPERTIES} ${_properties}
OUTPUT_NAME ${sundials_add_f2003_library_OUTPUT_NAME}
Expand Down
4 changes: 4 additions & 0 deletions cmake/tpl/FindKLU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
if (NOT (KLU_INCLUDE_DIR OR KLU_LIBRARY_DIR OR KLU_LIBRARY))
# Prefer the import target from upstream SuiteSparse if it is available
# and the user didn't point to a specific (different) version.
find_package(AMD CONFIG)
find_package(BTF CONFIG)
find_package(COLAMD CONFIG)
find_package(KLU CONFIG)
find_package(SuiteSparse_config CONFIG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I tried using a newer KLU these other dependencies got picked up by the KLU target, did you have issues with it not finding them? I think I did have to up date the CMAKE_MODULE_PATH though rather than just setting KLU_ROOT or KLU_DIR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if you set CMAKE_MODULE_PATH it will find them, but if you don't you need these other lines.

Copy link
Contributor

@mmuetzel mmuetzel May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please show in which case you need to add these lines? It definitely wasn't intended that downstream projects would need to manually include dependencies of a SuiteSparse library.
Is this an issue with the CMake Config files installed by SuiteSparse?

Copy link
Member

@gardner48 gardner48 May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmuetzel The issue seems to be with using -DKLU_DIR=<suite_sparse_install_path>/lib64/cmake/KLU alone to provide the config file location. Using either -DKLU_ROOT=<suite_sparse_install_path> or -DCMAKE_PREFIX_PATH=<suite_sparse_install_path> works without the above additions.

@balos1 are you also setting -D<dependency>_DIR variables for the other packages? Using -DKLU_DIR alone didn't work for me with the above additions. I had add -D<dependency>_DIR variables for each dependency which also makes the config work without the above additions.

This issue is tangential to the topic of this PR so I suggest these changes get broken out into a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the changes in this file made it into the final version that was merged.

Should the changes to this file be reverted?
(Iiuc, it is unclear which issue they are addressing.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balos1 in my testing it seemed like these updates were not needed could you check if setting -D<dependency>_DIR without these changes is sufficient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant replicate what I had seen before, so I think we can roll this back in a separate PR.


if(TARGET SuiteSparse::KLU)
if(NOT TARGET SUNDIALS::KLU)
Expand Down
2 changes: 2 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Fixed a bug in some Fortran examples where ``c_null_ptr`` was passed as an argum
to a function pointer instead of ``c_null_funptr``. This caused compilation issues
with the Cray Fortran compiler.

Enabled the Fortran interfaces to build with 32-bit ``sunindextype``.
balos1 marked this conversation as resolved.
Show resolved Hide resolved

Fixed a bug where :c:func:`MRIStepEvolve` would not handle a recoverable error
produced from evolving the inner stepper.

Expand Down
12 changes: 6 additions & 6 deletions doc/shared/nvectors/NVector_Description.rst
gardner48 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ The functions :c:func:`N_VCloneVectorArray` and
variables of type :c:type:`N_Vector`, each of the same type as an existing
``N_Vector`` input:

.. c:function:: N_Vector *N_VCloneVectorArray(int count, N_Vector w)
.. c:function:: N_Vector *N_VCloneVectorArray(sunindextype count, N_Vector w)
balos1 marked this conversation as resolved.
Show resolved Hide resolved
Clones an array of ``count`` ``N_Vector`` objects, allocating their data arrays (similar to :c:func:`N_VClone`).
Expand All @@ -198,7 +198,7 @@ variables of type :c:type:`N_Vector`, each of the same type as an existing
* ``NULL`` pointer on failure.
.. c:function:: N_Vector *N_VCloneVectorArrayEmpty(int count, N_Vector w)
.. c:function:: N_Vector *N_VCloneVectorArrayEmpty(sunindextype count, N_Vector w)
Clones an array of ``count`` ``N_Vector`` objects, leaving their data arrays unallocated (similar to :c:func:`N_VCloneEmpty`).
Expand All @@ -215,7 +215,7 @@ An array of variables of type :c:type:`N_Vector` can be destroyed
by calling :c:func:`N_VDestroyVectorArray`:
.. c:function:: void N_VDestroyVectorArray(N_Vector *vs, int count)
.. c:function:: void N_VDestroyVectorArray(N_Vector *vs, sunindextype count)
Destroys an array of ``count`` ``N_Vector`` objects.
Expand Down Expand Up @@ -243,7 +243,7 @@ that are wrapped as ``FN_NewVectorArray``, ``FN_VGetVecAtIndexVectorArray``, and
set a vector within this array:
.. c:function:: N_Vector *N_VNewVectorArray(int count, SUNContext sunctx)
.. c:function:: N_Vector *N_VNewVectorArray(sunindextype count, SUNContext sunctx)
Creates an array of ``count`` ``N_Vector`` objects, the pointers to each
are initialized as ``NULL``.
Expand All @@ -261,7 +261,7 @@ set a vector within this array:
The function signature was updated to add the ``SUNContext`` argument.
.. c:function:: N_Vector *N_VGetVecAtIndexVectorArray(N_Vector* vs, int index)
.. c:function:: N_Vector *N_VGetVecAtIndexVectorArray(N_Vector* vs, sunindextype index)
Accesses the ``N_Vector`` at the location ``index`` within the ``N_Vector`` array ``vs``.
Expand All @@ -279,7 +279,7 @@ set a vector within this array:
internally store its allocated length.
.. c:function:: void N_VSetVecAtIndexVectorArray(N_Vector* vs, int index, N_Vector w)
.. c:function:: void N_VSetVecAtIndexVectorArray(N_Vector* vs, sunindextype index, N_Vector w)
Sets a pointer to ``w`` at the location ``index`` within the vector array ``vs``.
Expand Down
9 changes: 7 additions & 2 deletions doc/shared/sundials/Fortran.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ equivalencies with the parameter direction in mind.
.. warning::

Currently, the Fortran 2003 interfaces are only compatible with SUNDIALS
builds where the ``sunrealtype`` is double-precision the ``sunindextype`` size
is 64-bits.
builds where the ``sunrealtype`` is double-precision.

.. versionchanged:: x.y.z

The Fortran interfaces can now be built with 32-bit ``sunindextype`` in
addition to 64-bit ``sunindextype``.


.. _SUNDIALS.Fortran.DataTypes.Table:
.. table:: C/Fortran-2003 Equivalent Types
Expand Down
26 changes: 12 additions & 14 deletions doc/superbuild/source/developers/getting_started/Checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ system, etc. developers should adhere to the following checklist.
third party libraries to ensure that these files are only included when
SUNDIALS is configured to use that library.

#. Configure SUNDIALS using the C flags ``-Wall -ansi -pedantic``, to aid in
catching compatibility issues on other platforms (Windows). When building,
modify your file to remove any error/warning messages output during
compilation of your code.
#. It can be helpful to configure SUNDIALS using the C flags ``-Wall -Werror``.
When building, modify your file to remove any error/warning messages output
during compilation of your code.
balos1 marked this conversation as resolved.
Show resolved Hide resolved

#. Configure your build with a minimal set of configuration options enabled
(serial). Run ``make``, ``make test``, ``make install``, and
Expand All @@ -52,8 +51,7 @@ system, etc. developers should adhere to the following checklist.

#. When adding new solvers or new solver options:

* Update the documentation to include descriptions of your work. Ensure that
the documentation also compiles (``make ug`` in the relevant directory).
* Update the documentation to include descriptions of your work.
* Add a new example problem (or multiple problems) to the ``examples/``
directory to demonstrate how to use your solver/option, and to include in
SUNDIALS' automated nightly tests.
Expand All @@ -68,20 +66,20 @@ system, etc. developers should adhere to the following checklist.
directory and ensure that ``make`` succeeds, since the CMake-generated
Makefile system differs from how the examples are built within SUNDIALS.
* Ensure that the reference output is included e.g., if a file ``foo.c`` is
added, also add ``foo.out``.
added, also add ``foo.out``.
* Update the example problem documentation for to include a description of
the new problem.

#. When adding any new files, update the corresponding package script in the
``scripts/`` directory to include your file(s) within the distribution.

#. Use the debugging macros defined in ``src/sundials/sundials_debug.h`` where
relevant and internal to SUNDIALS. Use the ``SUNDIALS_DEBUG`` macro to
``#ifdef`` out calls the sections of code which are for debugging purposes
only. Additionally, the ``SUNDIALS_DEBUG_PRINTVEC`` macro should be used to
``#ifdef`` out calls to the generic vector print functions ``N_VPrint`` and
``N_VPrintFile`` used for debugging purposes.

#. If answer files changed, and it is expected/desired, then update the `.out` files
that are embedded in the `examples/` directory AND the
`"answers" repository <https://github.com/sundials-codes/answers>`_.

#. If you changed any header files, re-run SWIG to generate updated fortran interfaces.
This is done by navigating to the `swig/` directory and running `make all32 all64`.
If you do not have `swig` installed on your system, you can obtain a git patch file
from the Swig GitHub action that we run on all pull requests. The patch can be found
balos1 marked this conversation as resolved.
Show resolved Hide resolved
under the job artifacts (if there were in fact changes that required updates
to the Fortran).
1 change: 1 addition & 0 deletions doc/superbuild/source/developers/releases/Checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ web pages.
that they are deprecated).

#. Regenerate the Fortran 2003 interfaces. It is possible nothing will be updated.
This is done by running ``make all32 all64`` in the ``swig/`` directory.
drreynolds marked this conversation as resolved.
Show resolved Hide resolved

#. Update the "Changes in ..." sections in all user guides. The changes should be
sorted so that major new features are above bug fixes.
Expand Down
25 changes: 25 additions & 0 deletions doc/superbuild/source/developers/style_guide/SourceCode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ C++ private class members should use snake case with a trailing underscore
Coding Conventions and Rules
============================

These rules should be followed for all new code. Unfortunately, old code might
not adhere to all of these rules.

#. Do not use language features that are not compatible with C99, C++14,
and MSVC v1900+ (Visual Studio 2015). Examples of such features include
variable-length arrays. Exceptions are allowed when interfacing with a
Expand Down Expand Up @@ -338,6 +341,17 @@ Coding Conventions and Rules
x;`` to ``return(x);``. Note, however, lots of older SUNDIALS source code
uses ``return(x);``.

#. Always use ``sunindextype`` for variables that are related to problem dimensions.
E.g., use it for the length of a vector, dimensions of a matrix, or for the number of vectors.
balos1 marked this conversation as resolved.
Show resolved Hide resolved
The only exception is when interfacing with a third party library requires a different
variable type.

#. Conversely, never use ``sunindextype`` for variables that are not specifically related to
the dimensions of a vector, matrix, etc.. E.g., if you have a variable that
represents the number of integer "words" allocated in a workspace do not use
``sunindextype`` for it. Instead use the appropriate integer type (e.g., ``uint64_t``) directly.
Do not use ``sunindextype`` for counters either.


.. _Style.Formatting:

Expand All @@ -353,6 +367,16 @@ for the tools respectively. To apply clang-format you can run:

./scripts/format.sh <path to directories to format>


.. warning::

The output of ``clang-format`` is sensitive to the ``clang-format`` version. We recommend
that you use version ``17.0.4``, which can be installed from source or with Spack. Alternatively,
when you open a pull request on GitHub, an action will run ``clang-format`` on the code. If any
formatting is required, the action will fail and produce a git patch artifact that you can download
(from the job artifacts section) and apply with `git apply`.


If clang-format breaks lines in a way that is unreadable, use ``//`` to break the line. For example,
sometimes (mostly in C++ code) you may have code like this:

Expand Down Expand Up @@ -408,3 +432,4 @@ There are other scenarios (e.g., a function call with a lot of parameters) where
.. };

.. See the clang-tidy documentation for more details.

26 changes: 15 additions & 11 deletions examples/arkode/F2003_custom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@
# Example lists are tuples "name\;type" where the type is
# 'develop' for examples excluded from 'make test' in releases

# Examples using SUNDIALS linear solvers
set(FARKODE_examples
"ark_brusselator1D_f2003\;develop"
"ark_analytic_complex_f2003\;develop"
)
if(SUNDIALS_INDEX_SIZE MATCHES "64")
balos1 marked this conversation as resolved.
Show resolved Hide resolved

set(FARKODE_tests
"test_fnvector_complex_mod\;develop"
"test_fnvector_fortran_mod\;develop"
"test_fsunmatrix_fortran_mod\;develop"
"test_fsunlinsol_fortran_mod\;develop"
)
# Examples using SUNDIALS linear solvers
set(FARKODE_examples
"ark_brusselator1D_f2003\;develop"
"ark_analytic_complex_f2003\;develop"
)

set(FARKODE_tests
"test_fnvector_complex_mod\;develop"
"test_fnvector_fortran_mod\;develop"
"test_fsunmatrix_fortran_mod\;develop"
"test_fsunlinsol_fortran_mod\;develop"
)

endif()

# note the order matters when auto-generating the installed Makefile
set(FARKODEsources
Expand Down
17 changes: 10 additions & 7 deletions examples/arkode/F2003_parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

# Example lists are tuples "name\;nodes\;tasks\;type" where the
# type is develop for examples excluded from 'make test' in releases
set(FARKODE_examples
"ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2"
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")

if(SUNDIALS_INDEX_SIZE MATCHES "64")
set(FARKODE_examples
"ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2"
balos1 marked this conversation as resolved.
Show resolved Hide resolved
"ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2"
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")
endif()

# Set-up linker flags and link libraries
set(SUNDIALS_LIBS sundials_arkode
Expand Down
Loading
Loading