-
Notifications
You must be signed in to change notification settings - Fork 249
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
Optimizing HROM Setup Performance #12270
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments to be addressed
@@ -167,7 +175,7 @@ def ModifyAfterSolverInitialize(self): | |||
aux[j,i] = petrov_galerkin_nodal_modes[node_id][j][i].GetDouble() | |||
node.SetValue(KratosROM.ROM_LEFT_BASIS, aux) | |||
|
|||
elif self.rom_parameters["rom_format"].GetString() == "numpy": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let us name the options:
"numpy_svd", "numpy_rsvd", later on we could add: "dislib_tsqr_svd", "dask_rsvd", and so on
@@ -0,0 +1,1463 @@ | |||
Begin ModelPartData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why arent we refering to the original file, therefore avoiding copying it in the RomApp folder? I mean:
"input_filename" : "../../../../FluidDynamicsApplication/tests/CouetteFlowTest/couette_flow_test"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change done.
Not passing the tests. Is this related to the use of the model part from the CFDApp? |
as a TODO for future PRs, we should create an SVD class, so that we can move there the svds implemented in this PR in the hrom_training_untility.py |
Summary
This PR introduces substantial improvements to the setup process for HROMs in Kratos. It replaces the previous dictionary-based storage for ROM elements and weights with a more efficient list-based approach. This change addresses performance bottlenecks identified during the handling of large datasets, where the former method was projected to take impractically long execution times (up to weeks for extensive cases like the motor setup; now, it takes a few seconds).
Changes
Replaced Data Structures
Old Implementation: Used a dictionary to store weights and indices for ROM elements and conditions. This method was not only memory-intensive but also significantly slower for large data sets due to the overhead associated with dictionary operations in Python and C++.
New Implementation: Shifts to using lists and numpy arrays that streamline the data handling and improve the execution speed. The new method directly loads and processes
.npy
files for element and condition IDs, and weights into numpy arrays, facilitating faster access and operations.Additional Enhancements
Minor Bug Fixes: Addressed a few default minor bugs that were affecting the efficiency and correctness of the HROM setups.
SVD Type Setting: Introduced a new setting (
svd_type
) that allows users to choose between using the randomized SVD (rSVD) and numpy's SVD.HROM Creation Test: Added a test for the HROM creation process, an essential part of our testing suite that was previously missing.