Skip to content
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

Sparse Jacobians for DVGeometryMulti #187

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Conversation

sseraj
Copy link
Collaborator

@sseraj sseraj commented Feb 27, 2023

Purpose

I changed the total Jacobian computation in DVGeometryMulti to use sparse matrices instead of dense matrices. I followed one of SciPy's recommended approaches by using lil_matrix for construction and then converting to csr_matrix for faster arithmetic. This approach required minimal changes to the code.

The memory usage was not dramatically different for the cases I tested because the Jacobian is usually not very sparse. Still, the memory used by the sparse Jacobian was about 60% of the memory used by the dense Jacobian for the largest case I tested (around 140k surface points and 270 geometric DVs).

Expected time until merged

1 week

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

The current DVGeometryMulti test passes, which shows that the derivatives are still correct.

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@sseraj sseraj requested a review from a team as a code owner February 27, 2023 22:18
@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Merging #187 (49d6108) into main (b7f1bfb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #187   +/-   ##
=======================================
  Coverage   64.76%   64.77%           
=======================================
  Files          47       47           
  Lines       11949    11951    +2     
=======================================
+ Hits         7739     7741    +2     
  Misses       4210     4210           
Impacted Files Coverage Δ
pygeo/parameterization/DVGeoMulti.py 91.05% <100.00%> (+0.01%) ⬆️

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

Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@hajdik hajdik merged commit 41ffb0b into mdolab:main Mar 2, 2023
@sseraj sseraj deleted the multi-sparse branch March 2, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants