-
Notifications
You must be signed in to change notification settings - Fork 640
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
Non-materialized DFT field storage for streamlined adjoint calculations #1832
Comments
With regards to step 2, that is already true for the centered grid, I think. If the DFT chunks are on the Yee grid, then different field components aren't on the same grid points so it's not clear what you mean by the "same" grid volume. I guess you can't process the components separately because of anisotropic materials? I think it might be possible to avoid boundary communications, but I think we need to sit down and go through exactly what is needed here. With regard to symmetries, I think it would be cleanest to operate similarly to loop in chunks, looping over each chunk potentially multiple times depending on the symmetry operations that map it into the design region. |
In particular, to avoid boundary communication for anisotropic materials, probably the solution is to have a flag that allows the DFT chunks to be "padded" with redundant points around the edges (including not-owned) points as needed for the off-diagonal tensor communications. |
@oskooi, I would outline things into 2 PRs:
As discussed, properly padding the DFT region (complicating the first PR) will eliminate the need to do any boundary communication (significantly simplifying the second PR). |
This step is a bit tricky. Naively, it would be great if we could just "not delete" these chunks and hang on to the pointers for post-processing during the recombination step. However, each dft chunk depends on its underlying fields chunk, which we have to delete... An alternative solution might be to define a lightweight data structure that acts like the @stevengj do you have any other ideas? |
Can't we just set the And we can store the |
As discussed in #1797, we can alleviate several memory constraints while computing gradients during adjoint optimization by not materializing the DFT fields on every process. Instead, we can distribute the computation of the gradient itself. Here's what needs to happen/change in order for this to work.
dft_fields
object too (thanks to SWIG), so we'll need to double-check that.grid_volume
on the same process (this might already be the default). This will reduce a lot of communication during the recombination step (and simplify the code).OptimizationProblem
class will no longer need to materialize the DFT fields. Rather, they will just store a pointer to the DFT object itself.get_gradient
routine to acceptdft_fields
pointers, rather than a pointer to the fields themselves.sum_to_all
.Some gotchas
loop_in_chunks
routine. But we should probably support the use case of returning the full, symmetric array to the user (like the code currently operates).(cc @oskooi)
The text was updated successfully, but these errors were encountered: