-
Notifications
You must be signed in to change notification settings - Fork 240
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
Parallel derivative coloring with vector design variable can yield zero derivatives #2919
Comments
I was able to make this work if I converted the indep variable 'x' to a distributed variable by changing
to this
This causes the src_indices of [0] and [1] to reference values on different procs so the parallel derivatives work correctly. Your example uses src_indices of [0] and [1] to reference into a non-distributed variable which, because of how our transfer scheme currently works, causes both indices to refer to the 0 and 1 entries of the variable on rank 0 so we lose the separation between procs that makes parallel deriv coloring work. Is converting your indep var to a distributed variable an acceptable workaround? |
Thanks for looking into this. Unfortunately, I don't think this fixes the MPhys code I had first noticed this issue in. That code runs two aerostructural scenarios in parallel, with each scenario potentially using more than 1 processor. I think that's a common situation where MPhys folks may want to use derivative coloring: where you're trying to enforce lift constraints at multiple flight conditions by trimming angle of attack. Anyway, if this workaround can be made to work with >2 processors, then maybe that would suffice. |
I think that this one has been fixed now as part of my current refactor of our reverse transfers (on my |
That's great! That aerostructural MPhys example works now, when I change aoa1 and aoa2 back to a vector of aoa. The above example of course works as well. I'll check the other two issues now. |
Description
When testing parallel_deriv_color with a new model that has two parallel groups, derivatives were observed to be zero for one of the design variables--a vector with indices connected to each parallel group. This has worked for other models, so it is unclear what they key difference is.
Nonetheless, the example below seems to show this same behavior. When running compute_totals with 2 processors (1 per group), coloring yields total derivatives of
{('parallel_group.dummy_comp1.y', 'dvs.x'): array([[1., 3.]]), ('parallel_group.dummy_comp2.y', 'dvs.x'): array([[-0., -0.]])}
Without coloring, the derivatives are correct:
{('parallel_group.dummy_comp1.y', 'dvs.x'): array([[ 1., -0.]]), ('parallel_group.dummy_comp2.y', 'dvs.x'): array([[-0., 3.]])}
When using more than 2 processors, coloring yields x derivatives of all zeros.
Example
OpenMDAO Version
3.26.1-dev
Relevant environment information
I am using python 3.9.5 with the following package versions (among other packages):
numpy==1.24.2
scipy==1.10.1
mpi4py==3.1.4
petsc4py==3.15.0
The text was updated successfully, but these errors were encountered: