-
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
Initial discrete adjoint capability with ERK #559
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: Steven Roberts <roberts115@llnl.gov>
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.
I just went through the documentation updates. I'll look through the code soon.
Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu>
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.
A few minor changes on the added/updated content, and I did see one of my previous comments that may still require investigation (inside doc/arkode/guide/source/Usage/ARKStep/ASA.rst
)
:param cs: The :c:type:`SUNAdjointCheckpointScheme` object | ||
:param step_num: the step number of the checkpoint | ||
:param stage_num: the stage number of the checkpoint | ||
:param t: the time of the checkpoint |
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.
t is not an argument to this function
:param t: the time of the checkpoint |
(or if it is, then the signature above needs to be fixed)
:param keep: Keep data stored even after it is not needed anymore. | ||
:param sunctx: The :c:type:`SUNContext` for the simulation. | ||
:param check_scheme_ptr: Pointer to the newly constructed object. | ||
:return: A :c:type:`SUNErrCode` indicating success or failure. |
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.
Does this need a preceding blank line (like the other .. c:function::
blocks above)?
:return: A :c:type:`SUNErrCode` indicating success or failure. | |
:return: A :c:type:`SUNErrCode` indicating success or failure. |
|
||
.. c:member:: SUNMatrix Jac | ||
|
||
Matrix data for the Jacobian :math:`df/dy`. |
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.
I apologize in advance, but the math professor in me needs these Jacobians to be denoted correctly (since
Matrix data for the Jacobian :math:`df/dy`. | |
Matrix data for the Jacobian :math:`\partial f/\partial y`. |
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.
Good catch. It was not in :math:
originally, it was plain text so\partial
was not used. When I just did a find/replace to add the :math:
I overlooked this.
|
||
.. c:member:: SUNMatrix JacP | ||
|
||
Matrix data for the Jacobian :math:`df/dp`. |
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.
Matrix data for the Jacobian :math:`df/dp`. | |
Matrix data for the Jacobian :math:`\partial f/\partial p`. |
|
||
.. c:member:: SUNRhsJacFn JacFn | ||
|
||
Jacobian function pointer to evaluate :math:`df/dy`. |
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.
Jacobian function pointer to evaluate :math:`df/dy`. | |
Jacobian function pointer to evaluate :math:`\partial f/\partial y`. |
Sets the function pointers to evaluate :math:`(df/dy)^T v` and :math:`(df/dp)^T v` | ||
|
||
:param adj_stepper: The SUNAdjointStepper object. | ||
:param Jvp: function that evaluates :math:`(df/dy)^T v`. | ||
:param JPvp: function that evaluates :math:`(df/dp)^T v`. |
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.
Sets the function pointers to evaluate :math:`(df/dy)^T v` and :math:`(df/dp)^T v` | |
:param adj_stepper: The SUNAdjointStepper object. | |
:param Jvp: function that evaluates :math:`(df/dy)^T v`. | |
:param JPvp: function that evaluates :math:`(df/dp)^T v`. | |
Sets the function pointers to evaluate :math:`(\partial f/\partial y)^T v` and :math:`(\partial f/\partial p)^T v` | |
:param adj_stepper: The SUNAdjointStepper object. | |
:param Jvp: function that evaluates :math:`(\partial f/\partial y)^T v`. | |
:param JPvp: function that evaluates :math:`(\partial f/\partial p)^T v`. |
Sets the function pointers to evaluate :math:`v^T (df/dy)` and :math:`v^T (df/dp)` | ||
|
||
:param adj_stepper: The SUNAdjointStepper object. | ||
:param Jvp: function that evaluates :math:`v^T (df/dy)`. | ||
:param JPvp: function that evaluates :math:`v^T (df/dp)`. |
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.
Sets the function pointers to evaluate :math:`v^T (df/dy)` and :math:`v^T (df/dp)` | |
:param adj_stepper: The SUNAdjointStepper object. | |
:param Jvp: function that evaluates :math:`v^T (df/dy)`. | |
:param JPvp: function that evaluates :math:`v^T (df/dp)`. | |
Sets the function pointers to evaluate :math:`v^T (\partial f/\partial y)` and :math:`v^T (\partial f/\partial p)` | |
:param adj_stepper: The SUNAdjointStepper object. | |
:param Jvp: function that evaluates :math:`v^T (\partial f/\partial y)`. | |
:param JPvp: function that evaluates :math:`v^T (\partial f/\partial p)`. |
Performs the matrix-vector product *y \gets A^Tx*. It should | ||
only be called with vectors *x* and *y* that are compatible with | ||
the matrix *A^T* -- both in storage type and dimensions. The return | ||
value denotes the success/failure of the operation: |
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.
Should these use :math:
mode?
Performs the matrix-vector product *y \gets A^Tx*. It should | |
only be called with vectors *x* and *y* that are compatible with | |
the matrix *A^T* -- both in storage type and dimensions. The return | |
value denotes the success/failure of the operation: | |
Performs the matrix-vector product :math:`y \gets A^Tx`. It should | |
only be called with vectors :math:`x` and :math:`y` that are compatible with | |
the matrix :math:`A^T` -- both in storage type and dimensions. The return | |
value denotes the success/failure of the operation: |
# "ark_test_erkadjoint.cpp\;--check-freq 1 --no-stages\;" | ||
# "ark_test_erkadjoint.cpp\;--check-freq 2 --no-stages\;" | ||
# "ark_test_erkadjoint.cpp\;--check-freq 5 --no-stages\;" | ||
# "ark_test_erkadjoint.cpp\;--check-freq 1 --dont-keep --no-stages\;" | ||
# "ark_test_erkadjoint.cpp\;--check-freq 2 --dont-keep --no-stages\;" | ||
# "ark_test_erkadjoint.cpp\;--check-freq 5 --dont-keep --no-stages\;" |
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.
Should these just be deleted from the file instead of commented out?
# "ark_test_erkadjoint.cpp\;--check-freq 1 --no-stages\;" | |
# "ark_test_erkadjoint.cpp\;--check-freq 2 --no-stages\;" | |
# "ark_test_erkadjoint.cpp\;--check-freq 5 --no-stages\;" | |
# "ark_test_erkadjoint.cpp\;--check-freq 1 --dont-keep --no-stages\;" | |
# "ark_test_erkadjoint.cpp\;--check-freq 2 --dont-keep --no-stages\;" | |
# "ark_test_erkadjoint.cpp\;--check-freq 5 --dont-keep --no-stages\;" |
// TODO(CJB): figure out why ForwardDiff, CVODES, and ERK adjoint all differ | ||
// if (check_sensitivities_backward(sf)) | ||
// { | ||
// fprintf(stderr, | ||
// ">>> FAILURE: adjoint solution does not match correct answer\n"); | ||
// return -1; | ||
// }; | ||
// printf(">>> PASS\n"); |
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.
Is this "TODO(CJB)" still relevant, or should the comment and associated code be deleted?
No description provided.