Open eytanadler opened 1 month ago
Attention: Patch coverage is 9.09091%
with 30 lines
in your changes missing coverage. Please review.
Project coverage is 65.39%. Comparing base (
3404b51
) to head (65d20c6
).
Files | Patch % | Lines |
---|---|---|
pygeo/mphys/mphys_dvgeo.py | 0.00% | 30 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@eytanadler, this was discussed during the maintenance meeting last week (missed the last one), but just want to clarify, do you plan to add the forward mode in this PR? We can also just add that in a separate PR, but in that case please make an issue documenting the forward mode additions etc.
Yes, I’ll add it here. I just haven’t got around to it yet.
I did a first pass of forward mode derivatives for the MPhys DVGeo component. I'm not super familiar with the parallelization hacks, so @anilyil please check those and let me know if you have any concerns. Tests for this component and its derivatives are included on the mphys-tests branch, so I think it'd be best to either merge that branch into this one or this branch into that one. That way, we can ensure these derivatives work as expected before merging to main. I ran the tests locally and this seems to produce the same results as reverse mode.
A couple other things I found and changed while making this:
totalSensitivityProd
incorrectly finds missing variables if the variable is not in the final DVGeo. I fixed this by initializing the set with the variables we want to find rather than adding them as we go.if XYZ > 0 [do something] else [do something else]
, whereas in the primal it is if XYZ < 0 [do something else] else [do something]
. I switched the derivative version around so it matches the primal. @hajdik it'd be good for us to get to the bottom of this derivative problem. Nonetheless, the fwd and rev modes have the same problem, so I don't think it's something I introduced in this code.In the meantime, I'll add fwd mode derivative checking to the tests on the mphys-tests branch.
Purpose
The MPhys component for pygeo supports only reverse mode derivatives and otherwise gives zero derivatives. However, no warning or error is thrown. This PR adds a
RuntimeError
if the derivatives are requested with a mode other than"rev"
.Expected time until merged
A few days
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable