mdolab / pygeo

pyGeo provides geometric design variables and constraints suitable for gradient-based optimization.
https://mdolab-pygeo.readthedocs-hosted.com/en/latest/?badge=latest
Apache License 2.0
122 stars 54 forks source link

Parallelized triangulated meshes in DVGeometryMulti #224

Closed sseraj closed 10 months ago

sseraj commented 10 months ago

Purpose

This PR parallelizes the triangulated meshes in DVGeometryMulti by splitting up the mesh points per processor and embedding a subset of the points on each processor. All triangulated mesh points are still stored on all processors because they are needed for pySurf operations. However, the parallelized embedding vastly improves memory usage during derivative computation for large cases and speeds up the embedding step.

I also fixed a minor parallelization bug when using excludeSurfaces. I ran into this while writing a parallelized version of the DVGeometryMulti test, so I included the fix in this PR.

Expected time until merged

2-3 weeks

Type of change

Testing

I parallelized the main DVGeometryMulti test and parameterized the test to run on 1 and 3 processors. The coordinates and derivatives match between the serial and parallel cases. The reference file changed because I switched from par_add_val to root_add_val, but the values are identical.

In addition, to test performance on a realistic case, I ran the DLR-F6 adjoint computation and recorded the memory usage for the DVGeo.totalSensitivity call. The memory usage scales much better with the parallelized triangulated meshes:

image

Checklist

codecov[bot] commented 10 months ago

Codecov Report

Merging #224 (be63b71) into main (d6e2d9c) will increase coverage by 0.24%. The diff coverage is 97.50%.

@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
+ Coverage   64.78%   65.02%   +0.24%     
==========================================
  Files          47       47              
  Lines       12073    12106      +33     
==========================================
+ Hits         7821     7872      +51     
+ Misses       4252     4234      -18     
Files Coverage Δ
pygeo/parameterization/DVGeoMulti.py 92.82% <97.50%> (+1.57%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more