Skip to content

Conversation

@tupek2
Copy link
Collaborator

@tupek2 tupek2 commented Aug 5, 2025

This is an initial implementation of an automatically generated computational graph, based on recording the evaluation, storage, and dependencies between arbitrary types. Compared to other differentiable graph libraries, this one executes during runtime, and can branch dynamically. In addition, it is constructed such that it can be reversed (in the sense of adjoints or back-propagation), to compute the derivative of some final double qoi (quantity of interest) with respect to any input to the graph. Finally, these adjoints require storing (in general) the entire history of the graph. To avoid this, the graph automatically uses 'dynamic-checkpointing' (Minimal Repetition Dynamic Checkpointing Algorithm for Unsteady Adjoint Calculation, Wang, et. al. 2009) to store a near minimal number of states and automatically recomputes states in a near optimal way when back-propagating.

@@ -0,0 +1,42 @@

set(smith_gretl_sources
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be "serac"?

@tupek2 tupek2 force-pushed the tupek/gretl_refactor branch from 954952c to 9a67661 Compare August 5, 2025 21:30
@tupek2 tupek2 added the ready for review Ready for active inspection by reviewers label Aug 5, 2025
@tupek2 tupek2 requested a review from ebchin August 5, 2025 23:21
@tupek2 tupek2 requested review from btalamini and white238 August 5, 2025 23:22
Copy link
Member

@btalamini btalamini left a comment

Choose a reason for hiding this comment

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

Nice!

};

/// @brief interface to run forward with a linear graph, checkpoint, then automatically backpropagate the sensitivities
/// given the reverse_callback jvp.
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
/// given the reverse_callback jvp.
/// given the reverse_callback vjp.


namespace gretl {

struct Unit {};
Copy link
Member

Choose a reason for hiding this comment

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

What is this for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nothing deleted.

@@ -0,0 +1,10 @@
set(gretl_test_depends serac_gretl gtest)
Copy link
Member

@white238 white238 Aug 29, 2025

Choose a reason for hiding this comment

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

Suggested change
set(gretl_test_depends serac_gretl gtest)
# Copyright (c) Lawrence Livermore National Security, LLC and
# other Serac Project Developers. See the top-level LICENSE file for
# details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
set(gretl_test_depends serac_gretl gtest)

@@ -0,0 +1,42 @@

Copy link
Member

@white238 white238 Aug 29, 2025

Choose a reason for hiding this comment

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

Suggested change
# Copyright (c) Lawrence Livermore National Security, LLC and
# other Serac Project Developers. See the top-level LICENSE file for
# details.
#
# SPDX-License-Identifier: (BSD-3-Clause)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 94.15515% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.11%. Comparing base (4bb9d93) to head (29cf89a).

Files with missing lines Patch % Lines
src/serac/gretl/data_store.cpp 84.41% 36 Missing ⚠️
src/serac/gretl/tests/test_gretl_graph.cpp 92.55% 7 Missing ⚠️
src/serac/gretl/print_utils.hpp 0.00% 5 Missing ⚠️
src/serac/gretl/checkpoint.hpp 98.00% 2 Missing ⚠️
src/serac/gretl/state_base.hpp 84.61% 2 Missing ⚠️
src/serac/gretl/tests/test_gretl_checkpoint.cpp 98.26% 2 Missing ⚠️
src/serac/gretl/data_store.hpp 98.21% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1432      +/-   ##
===========================================
+ Coverage    92.03%   92.11%   +0.07%     
===========================================
  Files          199      213      +14     
  Lines        25200    26142     +942     
===========================================
+ Hits         23193    24080     +887     
- Misses        2007     2062      +55     
Flag Coverage Δ
unittests 92.11% <94.15%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

ready for review Ready for active inspection by reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants