Repository navigation
Sum the adjoint of an assignment from a scalar over all ranks - #5780
Open
sghelichkhani wants to merge 1 commit into
Open
sghelichkhani wants to merge 1 commit into
sghelichkhani wants to merge 1 commit into
Conversation
The adjoint of Function.assign from an AdjFloat or from a Function on R added only the degrees of freedom that each rank owns, so in parallel each rank got a partial derivative. Sum over the communicator with the PETSc Vec. The vector-valued Real branch called Function.sub with a deepcopy argument that Function.sub does not take. The sum does not need a copy.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
FunctionAssignBlocksummed the adjoint input only over the degrees of freedom that each rank owns, so in parallel the derivative with respect to anAdjFloator a RealFunctionassigned to aFunctionwas a partial sum on each rank. The sum now goes through the PETScVec, which reduces over the communicator, and this also corrects the Hessian action that uses the same code. The new tests are Taylor tests on 1 and 2 ranks. I also removed thedeepcopyargument fromFunction.subin the vector-valued Real branch, sinceFunction.subdoes not take it. A Taylor test cannot cover that branch yet because a vector-valued Real control fails withNotImplementedErrorin_ad_dot.Fixes #5778
AI-assisted with Claude Code.