-
Notifications
You must be signed in to change notification settings - Fork 277
[Core] Refactor UblasSpace to use ParallelUtilities
#13492
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
base: master
Are you sure you want to change the base?
Conversation
This PR replaces direct `OpenMP` pragmas in `kratos/spaces/ublas_space.h` with Kratos `ParallelUtilities` (primarily `IndexPartition`). This change modernizes the shared-memory parallelism approach in UblasSpace, aligning it with the recommended Kratos API. The following functions were refactored: - `Copy` (VectorType) - `Dot` - `TwoNorm` (`Matrix` and `compressed_matrix`) - `JacobiNorm` (`Matrix`) - `Mult` (`compressed_matrix`, via ParallelProductNoAdd) - `InplaceMult` - `Assign` - `UnaliasedAdd` - `ResizeData` (all three overloads) - `SetToZero` (all three overloads) - The private helper `ParallelProductNoAdd` was significantly refactored to use `IndexPartition`, and its own helpers `CreatePartition` and `partial_product_no_add` were removed. Reductions were handled using Kratos reducer objects like `SumReduction`.
|
Funny thing is that I think I found several bugs with this. Tests failing are due to incorrect size vectors. |
…eturn the sensitivity variable string
…the utility function
…r int, bool, double, array_1d, vector, and Matrix type variables.
…ivity variables like SHAPE_SENSITIVITY
Co-authored-by: Suneth Warnakulasuriya <7856520+sunethwarna@users.noreply.github.com>
Changes include: - The UDSM-based constitutive laws are no longer copy-able. Use member function `Clone` for creating deep copies. These constitutive laws are still not moveable. Compile-time checks have been added to enforce this part of the design. - By introducing a data member of type `ConstitutiveLawDimension`, we have been able to generalize class `SmallStrainUDSM3DLaw` such that class `SmallStrainUDSM2DPlaneStrainLaw` became redundant. The new data member is used for getting the strain size as well as the local space dimension. Consequently, we could get rid of static data members `VoigtSize` and `Dimension`. - Class `SmallStrainUDSM3DLaw` has been renamed to `SmallStrainUDSMLaw`. The corresponding files have been renamed, too. Class `SmallStrainUDSM2DPlaneStrainLaw` has been removed. - Moved function definitions from header files to the corresponding implementation files. - Removed a few `override`s that were identical to the base class implementation. - Removed many redundant comments. - Removed several redundant name qualifiers. - Removed several unused member functions. - Corrected the implementations of `save` and `load`, and made them more complete. - Removed several `KRATOS_TRY` and `KRATOS_CATCH` constructs, to avoid catching errors in places where they can't be handled properly anyway. - Made the implementation of member `Clone` complete (several data members were not handled). - Use square brackets (i.e. `[]`) rather than parentheses (i.e. `()`) to access vector entries. This is in line with how the STL accesses elements of containers. - Renamed function parameters `rThisVariable` to `rVariable`.
RiccardoRossi
left a comment
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. ignore if you dislike them
…h IndexPartition for better performance
…ved parallelism and performance
|
Should be fine now @RiccardoRossi |
…or improved parallelism and performance" This reverts commit ceacb6f.
Ping @RiccardoRossi |
Hello |
📝 Description
This PR replaces direct
OpenMPpragmas inkratos/spaces/ublas_space.hwith KratosParallelUtilities(primarilyIndexPartition).This change modernizes the shared-memory parallelism approach in UblasSpace, aligning it with the recommended Kratos API.
The following functions were refactored:
Copy(VectorType)DotTwoNorm(Matrixandcompressed_matrix)JacobiNorm(Matrix)Mult(compressed_matrix, via ParallelProductNoAdd)InplaceMultAssignUnaliasedAddResizeData(all three overloads)SetToZero(all three overloads)ParallelProductNoAddwas significantly refactored to useIndexPartition, and its own helpersCreatePartitionandpartial_product_no_addwere removed. (TODO)Reductions were handled using Kratos reducer objects like
SumReduction.🆕 Changelog
UblasSpaceto useParallelUtilities