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

ASA core modules #641

Open
wants to merge 434 commits into
base: develop
Choose a base branch
from
Open

ASA core modules #641

wants to merge 434 commits into from

Conversation

balos1
Copy link
Member

@balos1 balos1 commented Jan 14, 2025

This PR adds the core modules that will support adjoint sensitivity analysis in a package-agnostic way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional suggestion: use the graphviz extension to generate this

doc/shared/sunadjoint/SUNAdjointCheckpointScheme.rst Outdated Show resolved Hide resolved
doc/shared/sunadjoint/SUNAdjointCheckpointScheme.rst Outdated Show resolved Hide resolved
doc/shared/sunadjoint/SUNAdjointCheckpointScheme.rst Outdated Show resolved Hide resolved
src/sundials/sundials_adjointstepper.c Outdated Show resolved Hide resolved
src/sundials/sundials_hashmap_impl.h Show resolved Hide resolved
src/sundials/sundials_profiler.c Show resolved Hide resolved
src/sundials/sundials_profiler.c Show resolved Hide resolved
src/sundials/sundials_profiler.c Show resolved Hide resolved
Copy link
Member

@gardner48 gardner48 left a comment

Choose a reason for hiding this comment

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

Partway through src

@@ -283,7 +286,7 @@ instead of `SameMajorVersion`. This fixes the issue seen

Fixed a CMake bug that caused an MPI linking error for our C++ examples in some
instances. Fixes [GitHub Issue
#464](https://github.com/LLNL/sundials/issues/464).
# 464](https://github.com/LLNL/sundials/issues/464).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# 464](https://github.com/LLNL/sundials/issues/464).
#464](https://github.com/LLNL/sundials/issues/464).

Copy link
Member

Choose a reason for hiding this comment

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

"indicate checkpoint" -> "indicate a checkpoint"

Comment on lines +26 to +29
.. c:enumerator:: SUNDATAIOMODE_INMEM

The IO mode for data that is stored in addressable random access memory.
The location of the memory (e.g., CPU or GPU) is not specified by this mode.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. c:enumerator:: SUNDATAIOMODE_INMEM
The IO mode for data that is stored in addressable random access memory.
The location of the memory (e.g., CPU or GPU) is not specified by this mode.
.. c:enumerator:: SUNDATAIOMODE_INMEM
The IO mode for data that is stored in addressable random access memory.
The location of the memory (e.g., CPU or GPU) is not specified by this mode.

states during forward integration and accessing them as needed during the backwards integration
of the adjoint model.

.. c:enum:: SUNDataIOMode
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. c:enum:: SUNDataIOMode
.. c:enum:: SUNDataIOMode
IO modes for storing adjoint checkpoints

The SUNDIALS simulation context.


.. c:type:: struct SUNAdjointCheckpointScheme_Ops_ *SUNAdjointCheckpointScheme_Ops
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. c:type:: struct SUNAdjointCheckpointScheme_Ops_ *SUNAdjointCheckpointScheme_Ops
The virtual table structure is defined as
.. c:type:: struct SUNAdjointCheckpointScheme_Ops_ *SUNAdjointCheckpointScheme_Ops

{
step_data_node = NULL;
}
else { SUNCheckCall(errcode); }
Copy link
Member

Choose a reason for hiding this comment

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

Why not have SUNCheckCall on the call to SUNDataNode_GetNamedChild?


SUNErrCode SUNAdjointCheckpointScheme_InsertVector_Fixed(
SUNAdjointCheckpointScheme self, int64_t step_num,
SUNDIALS_MAYBE_UNUSED int64_t stage_num, sunrealtype t, N_Vector y)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like stage_num is only used for logging, should it be removed?

stage_num);
errcode = SUNDataNode_GetChild(step_data_node, stage_num, &solution_node);
if (errcode == SUN_ERR_DATANODE_NODENOTFOUND) { solution_node = NULL; }
else { SUNCheckCall(errcode); }
Copy link
Member

Choose a reason for hiding this comment

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

Why not have SUNCheckCall on the call to SUNDataNode_GetChild?

Comment on lines +214 to +217
}

SUNCheckCall(SUNDataNode_HasChildren(step_data_node, &has_children));
if (!has_children)
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this be

Suggested change
}
SUNCheckCall(SUNDataNode_HasChildren(step_data_node, &has_children));
if (!has_children)
}
else


SUNCheckCall(SUNDataNode_Destroy(&IMPL_MEMBER(self, root_node)));

free(GET_CONTENT(self));
Copy link
Member

Choose a reason for hiding this comment

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

I think this is slightly more clear in this case

Suggested change
free(GET_CONTENT(self));
free(self->content);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants