-
Notifications
You must be signed in to change notification settings - Fork 130
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
Feature/sunadjoint #559
Open
balos1
wants to merge
343
commits into
develop
Choose a base branch
from
feature/sunadjoint
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+20,957
−375
Open
Feature/sunadjoint #559
Changes from all commits
Commits
Show all changes
343 commits
Select commit
Hold shift + click to select a range
96503a8
Merge branch 'feature/sunstepper' into feature/sunadjoint
balos1 3c3a406
move trystep flahs
balos1 cbfbd79
cleanup
balos1 e6815d6
add yp arg
balos1 c7d3f39
add setstoptime
balos1 fa21304
rename SUNAdjointSolver
balos1 32832c1
Merge branch 'feature/sunstepper' into feature/sunadjoint
balos1 f9a2c49
store time with state data
balos1 9676a70
add reinit function
balos1 1e5eac7
rename local variables called adj_solver to adj_stepper
balos1 0b17693
rename adjoint stepper functions to match sunstepper
balos1 10d9370
add comment
balos1 532dd48
minor cleanup
balos1 27fe770
more cleanup
balos1 b7d7e08
minor fixes
balos1 b95404b
Merge branch 'feature/sunstepper' into feature/sunadjoint
balos1 491765f
add missing SetForcing declaration
balos1 5229e68
Merge branch 'feature/sunstepper' into feature/sunadjoint
balos1 bc58f0c
Update src/sundials/sundials_stepper.c
balos1 14be3e5
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 8e7e08a
wip
balos1 d80ef7a
wip
balos1 151a271
fix checkpoint throwaway
balos1 acdaef3
add missing arkode functions
balos1 dbc0207
Apply suggestions from code review
balos1 c7a47b4
Apply suggestions from code review
balos1 f20affe
remove unused constants
balos1 b797a1a
rename function
balos1 d3f8bad
add missing function in docs
balos1 a0348a2
update function names
balos1 53c9bcc
add docs for the generic classes from other branch and update
balos1 75d3d66
add matvec transpose docs
balos1 e262fb6
Revert y prime argument
Steven-Roberts 7881ddc
Fix compilation warnings
Steven-Roberts 5e03e95
Apply formatter
Steven-Roberts 483a53c
add other missing adjoint docs
balos1 300f8dc
document new sunmemory function
balos1 25b366d
clarify
balos1 7d3274d
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 a5c4b32
fix unit test for checkpoint scheme
balos1 19827f5
copy test to examples
balos1 ac0adec
add cvodes example
balos1 0416868
doc clarifications
balos1 e5af802
get cost at just T
balos1 e8d0634
add param sensitivites to cvodes example
balos1 bdcf634
fix comment
balos1 40ee734
Merge remote-tracking branch 'origin/develop' into feature/sunstepper
balos1 2c4d1a7
Merge branch 'feature/sunstepper' into feature/sunadjoint
balos1 a082c34
Fix freeing of fused vectors
Steven-Roberts 3da5408
cleanup headers
balos1 806774c
remove unused functions
balos1 f8b19cc
remove unused functions
balos1 822bb71
remove unused error code
balos1 4446183
make sundials_datanode private
balos1 f9c42b2
remove unused header
balos1 cb6b0fd
Fix unset variable when creating inner stepper
Steven-Roberts 4e0784a
Merge branch 'develop' into feature/sunstepper
Steven-Roberts 7ba3a87
Merge branch 'develop' into feature/sunstepper
gardner48 5a110e3
apply formatting
gardner48 32d6f3d
update f2003 interface
gardner48 5b2b84e
Merge remote-tracking branch 'origin/develop' into feature/sunadjoint
balos1 97be184
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 df504e1
apply patches
balos1 9750b43
remove patch files accidentally committed
balos1 9eb463e
fix all warnings
balos1 29f698e
update docs
balos1 986e782
cast int64_t to long long in printf for portability
balos1 80e9b84
more long long casts
balos1 b8ba85a
make them unsigned
balos1 663cdd1
move declaration
balos1 1d75d3f
no need to check against 0 with size_t
balos1 4fd8f4a
link sundials_adjoint in unit tests
balos1 51763f7
link object files
balos1 5ea7869
cast capacity
balos1 dad3fbd
fix integer sizes in hashmap
balos1 1a9c84f
format and spelling
balos1 8fb60be
remove comparisons to 0
balos1 9980090
Changelog
Steven-Roberts b928595
Merge branch 'develop' into feature/sunstepper
Steven-Roberts d3ca3b8
Doc fixes
Steven-Roberts 1672e09
Reorder implementation specific methods
Steven-Roberts 12e1c2b
fix typo
balos1 abf37fb
Merge remote-tracking branch 'origin/develop' into feature/sunadjoint
balos1 08343ce
fix compiler warnings
balos1 20b6731
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 319d899
ARKstepCreateSUNStepper -> ARKodeCreateSUNStepper
Steven-Roberts da6e773
Add missing file
Steven-Roberts a4fc856
Add missing SUNStepper_SetForcing
Steven-Roberts cd12b43
swig
Steven-Roberts c7b6cde
Add missing swig file
Steven-Roberts 0c1b84c
Merge branch 'develop' into feature/sunstepper
Steven-Roberts d43d59a
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 19621a6
post-merge compile fixes
balos1 cd1891a
add constant for recompute fail
balos1 9d32e88
Finish updating docs after ARKodeCreateSUNStepper refactor
Steven-Roberts 01eba9e
Merge branch 'develop' into feature/sunstepper
Steven-Roberts 13e444e
Reference ARKodeCreateSUNStepper in the SUNStepper docs
Steven-Roberts 53f30c2
fix hashmap
balos1 03e26d6
Revert ops check change
Steven-Roberts 9f6baab
Mention MRIStepInnerStepper_CreateFromSUNStepper in changelog
Steven-Roberts b1a3dad
Typo fixes
Steven-Roberts 50cb5a1
Remove extra include
Steven-Roberts 905f98f
flush logging queues before aborting
balos1 ec8bbde
more cleanup
Steven-Roberts 2a05e5d
Move function to make diff nicer
Steven-Roberts 92a7f17
Improve error handling for MRI inner stepper wrapping SUNStepper
Steven-Roberts 1461d63
fix problem from reset change
balos1 fc47959
a couple pr comments addressed
balos1 7cd59d6
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 d4228ea
merge
balos1 24114fe
document constant that was added
balos1 ef116d5
Merge branch 'feature/sunstepper' of github.com:LLNL/sundials into fe…
Steven-Roberts eadc5ea
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 68e1d1e
Remove SUNStepper_TryStep
Steven-Roberts e24ed27
Revert trystep changes for xbraid
Steven-Roberts aa7ccc1
Apply formatter
Steven-Roberts ec41dfa
Typo fix
Steven-Roberts 106022a
Add missing period
Steven-Roberts 81fa70f
Make return consistent
Steven-Roberts f00e158
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 173a1cc
format
balos1 0e85269
run swig
balos1 9e95184
Update swig/sundials/fsundials_stepper.i
Steven-Roberts 7158562
Doc style fixes
Steven-Roberts f9dc452
Merge branch 'feature/sunstepper' of github.com:LLNL/sundials into fe…
Steven-Roberts 9cd7450
generate proper swig interface
balos1 9d332b4
change uint to int
balos1 e7e25ab
update reset call
balos1 ca1bc17
fix compiler warnings
balos1 43e9be0
add profiler statements
balos1 01515c4
format
balos1 766c222
remove uses of size_t that were not needed
balos1 9041421
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 dcb5e7a
fix some more warnings
balos1 ac20d73
format
balos1 e8d65b6
fix warning
balos1 11220bb
more warnings fixed
balos1 41c468c
Apply suggestions from code review
balos1 926caa0
Merge branch 'develop' into feature/sunstepper
Steven-Roberts ef224be
remove .clangd and add it to gitignore
balos1 ffb0d25
Apply suggestions from code review
balos1 2d431e4
Apply suggestions from code review
balos1 93700d3
swig and format
balos1 09d0fe1
update docs
balos1 86e388d
use x.y.z
balos1 d88dc73
use SUN_RCONST
balos1 e628c68
fix commented out timer code
balos1 ec024dc
document naming convention for stlvector
balos1 57b74d2
fixing linking errors on windows
balos1 8ef4e82
add obj back sunmemsys
balos1 a17092a
Apply suggestions from code review
Steven-Roberts 13c7c63
Fix copy paste error in MRIStepInnerStepper_CreateFromSUNStepper example
Steven-Roberts c333f57
Only call SUNStepper_SetForcingFn if stepper provides setforcing func…
Steven-Roberts d4846b3
Document support for forcing
Steven-Roberts cb495dc
Merge branch 'develop' into feature/sunstepper
Steven-Roberts 9641457
Apply formatter
Steven-Roberts 6d7c459
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 c52f9dc
comment out no-stages
balos1 f9b48ad
doc fixes
balos1 794327b
spelling
balos1 f62a1a8
simplify indexing
balos1 cfaab51
define ASA
balos1 d00e769
uncomment fsal code
balos1 5210ca7
guard subvector access
balos1 2c196f6
clarify subvector size
balos1 6d62b97
fix inconsistent notation
balos1 3a8920b
fix missing declaration
balos1 77abed5
update checkpoint_start_idx to int64_t
balos1 02aa271
fix param description
balos1 bba7343
couple of small doc fixes
balos1 9a8d422
Merge branch 'develop' into feature/sunstepper
Steven-Roberts 0549afd
Apply suggestions from code review
Steven-Roberts 5c3cbf6
Add missing header
Steven-Roberts 06e6875
Remove step_supports_forcing
Steven-Roberts d29b95e
Revert formatting change
Steven-Roberts cb456e2
Add public SUNStepper_FullRhs function
Steven-Roberts 65eafd4
Apply suggestions from code review for evolve and one step functions
Steven-Roberts dcc74c8
Use backticks for arguments
Steven-Roberts e3a9a42
Remove unused SUNStepper_OneStep
Steven-Roberts 127ff2d
Remove t0 arg from SUNStepper_Evolve
Steven-Roberts 9f483e0
Formatter and swig
Steven-Roberts 51406bc
Moved duplicated SUNStepper overview to shared folder
Steven-Roberts 3c6844b
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 f6b7866
Allow users to specify custom destroy function
Steven-Roberts 10869c6
Add missing SUNStepper_SetDestroyFn definition
Steven-Roberts ae18e60
NULL destroy operation on creation
Steven-Roberts 4893e19
Make argument names consistent in docs and header
Steven-Roberts 4d238f0
Fix anonymous type linking error
Steven-Roberts 42b1f59
Fix copy paste error
Steven-Roberts fb6a34e
address documentation issues from review
balos1 8d42749
remove commented out code
balos1 91900f5
Add arkProcessError calls to ARKodeCreateSUNStepper
Steven-Roberts 3a26598
Rename SUNStepper Jacobian typedefs
Steven-Roberts ad41aa0
Add mode argument back to SUNStepper full RHS
Steven-Roberts 76e4537
Update docs for full RHS mode
Steven-Roberts 2e7859e
Swig and format
Steven-Roberts b72dc5a
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 15b0b7c
add onestep function back
balos1 3f175d0
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 b71fd0a
post merge fixes
balos1 da261e7
fix unit tests
balos1 c84f8d1
apply swig and format
balos1 aecc502
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 068fbd7
Merge branch 'develop' into feature/sunstepper
balos1 697e870
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 9973277
move arkInit and ARKodePrintMem back
balos1 015fc55
typo
balos1 b31a678
remove TTYPE undef from header
balos1 44e331e
checck node data in unit test
balos1 633062b
remove stop_reason in favor of last_flag
balos1 762dc3f
SUNAdjointCheckpointScheme doc clarification
balos1 c77132f
add generic ASA overview in ASA section
balos1 7d17534
rename matvectranspose
balos1 b7f4794
fix find/replace errors from changing 'basic' to 'fixed'
balos1 5481820
add band matrix transpose
balos1 e144a9a
format
balos1 23d2cb0
format
balos1 9785909
destroy AT
balos1 a8811d5
add mattransposevec for sparse matrix
balos1 758287c
fix more basic/fixed find-replace errors
balos1 cc49a54
update swig readme to remove reference to old commit
balos1 80bb41d
format
balos1 c0a0783
Apply suggestions from code review
balos1 e0ecd2c
fix spelling
balos1 4acf8ca
rerun swig
balos1 164933a
format
balos1 7237b2c
fix fsal indexing
balos1 1b18e8c
check error codes
balos1 f2a9b0d
swig
balos1 a8ab522
Merge branch 'develop' into feature/sunstepper
balos1 06e99e3
format
balos1 eba5765
Basic --> Fixed
balos1 d386417
reorder tests
balos1 6cf811a
switch order
balos1 3b7e733
Merge remote-tracking branch 'origin/feature/sunstepper' into feature…
balos1 6ff3a78
remove unnecessary if do_adjoint
balos1 59ea02e
fix matrix compatability check
balos1 5a5fd64
bump answers
balos1 b2b8254
loosen tolerances for single precision
balos1 0be20be
support integration in both directions
balos1 0e2ae77
fix comments
balos1 2560fa7
factor out lotka volterra functions into their own header
balos1 059046b
rename test file
balos1 3b7d7f3
rename test file
balos1 bd36a0f
bump answers
balos1 5526f03
make unit test pass/fail
balos1 93a9957
format
balos1 5a78a2a
check backwards answer
balos1 066fc3c
update output files for new cost function
balos1 abe96c2
comment out backwards adjoint check
balos1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. _ARKODE.Usage.ARKStep.ASA: | ||
|
||
Adjoint Sensitivity Analysis | ||
============================ | ||
|
||
The previous sections discuss using ARKStep for the integration of forward ODE models. | ||
This section discusses how to use ARKStep for adjoint sensitivity analysis as introduced | ||
in :numref:`ARKODE.Mathematics.ASA`. To use ARKStep for adjoint sensitivity analysis (ASA), users simply setup the forward | ||
integration as usual (following :numref:`ARKODE.Usage.Skeleton`) with one exception: | ||
a :c:type:`SUNAdjointCheckpointScheme` object must be created and passed to | ||
:c:func:`ARKodeSetAdjointCheckpointScheme` before the call to the :c:func:`ARKodeEvolve` | ||
function. After the forward model integration code, a :c:type:`SUNAdjointStepper` object | ||
can be created for the adjoint model integration by calling :c:func:`ARKStepCreateAdjointStepper`. | ||
The code snippet below demonstrates these steps in brief and the example code | ||
``examples/arkode/C_serial/ark_lotka_volterra_asa.c`` demonstrates these steps in detail. | ||
|
||
.. code-block:: C | ||
|
||
// 1. Create a SUNAdjointCheckpointScheme object | ||
|
||
// 2. Setup ARKStep for forward integration | ||
|
||
// 3. Attach the SUNAdjointCheckpointScheme | ||
|
||
// 4. Evolve the forward model | ||
|
||
// 5. Create the SUNAdjointStepper | ||
|
||
// 6. Setup the adjoint model | ||
|
||
// 7. Evolve the adjoint model | ||
|
||
// 8. Cleanup | ||
|
||
|
||
|
||
User Callable Functions | ||
----------------------- | ||
|
||
This section describes ARKStep-specific user-callable functions for performing | ||
adjoint sensitivity analysis with methods with ARKStep. | ||
|
||
.. c:function:: int ARKStepCreateAdjointStepper(void* arkode_mem, N_Vector sf, SUNAdjointStepper* adj_stepper_ptr) | ||
|
||
Creates a :c:type:`SUNAdjointStepper` object compatible with the provided ARKStep instance for | ||
integrating the adjoint sensitivity system :eq:`ARKODE_DISCRETE_ADJOINT`. | ||
|
||
:param arkode_mem: a pointer to the ARKStep memory block. | ||
:param sf: the sensitivity vector holding the adjoint system terminal condition. | ||
This must be an instance of the ManyVector ``N_Vector`` implementation with at | ||
least one subvector (depending on if sensitivities to parameters should be computed). | ||
The first subvector must be :math:`\partial g_y(y(t_f)) \in \mathbb{R}^N`. If sensitivities to parameters should be computed, then the second subvector must be :math:`g_p(y(t_f), p) \in \mathbb{R}^{N_s}`. | ||
:param adj_stepper_ptr: the newly created :c:type:`SUNAdjointStepper` object. | ||
|
||
:return: | ||
* ``ARK_SUCCESS`` if successful | ||
* ``ARK_MEM_FAIL`` if a memory allocation failed | ||
* ``ARK_ILL_INPUT`` if an argument has an illegal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ are specific to ARKStep. | |
User_callable | ||
Relaxation | ||
XBraid | ||
ASA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these supposed to be "code snippets" (as stated in the paragraph above)?