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

build: Remove remaining circular link dependencies #3282

Merged
merged 31 commits into from
Aug 21, 2024

Conversation

rrsettgast
Copy link
Member

@rrsettgast rrsettgast commented Aug 14, 2024

This PR seeks to remove remaining circular link dependencies.

  • Move OutputBase::getOutputDirectory() to a lower level component to avoid dependencies on fileIO
  • Move constitutive drivers to their own component (constitutiveDrivers).
  • remove reliance on ProblemManager::getPhysicsSolverManager() functions and insert hard coded getGroup( "Solvers" ) function. Not optimal, but gets rid of the circular dependency.
  • reintruduce shared library option
  • remove shared geosx_core created using blt_combine_static_libraries
  • remove GEOS_LINK_PREPEND_FLAG and GEOS_LINK_POSTPEND_FLAG in favor of cmake $<LINK_LIBRARY:WHOLE_ARCHIVE,${lib}> option.
  • update all paths in documentation as a result of creation of constitutiveDrivers module.
  • cleanup unit test dependencies

Here is the dependency tree. Note that this doesn't resolve circular header dependencies.
dependency

@rrsettgast rrsettgast self-assigned this Aug 14, 2024
@rrsettgast rrsettgast marked this pull request as ready for review August 14, 2024 20:28
@rrsettgast rrsettgast added ci: run CUDA builds Allows to triggers (costly) CUDA jobs dependencies Pull requests that update a dependency file labels Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes missing coverage. Please review.

Project coverage is 56.00%. Comparing base (4d4eb35) to head (0cedfed).
Report is 89 commits behind head on develop.

Files with missing lines Patch % Lines
...lvers/multiphysics/PoromechanicsInitialization.cpp 0.00% 3 Missing ⚠️
...olvers/solidMechanics/SolidMechanicsStateReset.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3282   +/-   ##
========================================
  Coverage    55.99%   56.00%           
========================================
  Files         1053     1053           
  Lines        89157    89168   +11     
========================================
+ Hits         49921    49935   +14     
+ Misses       39236    39233    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@rrsettgast rrsettgast requested a review from jhuang2601 as a code owner August 17, 2024 08:24
@MelReyCG
Copy link
Contributor

MelReyCG commented Aug 20, 2024

@rrsettgast About OutputBase::getOutputDirectory():
What do you think of a static string Path::getOutputDirectory() (along with the setter too)? Or, at least, to relocate it in src/common/*?

@rrsettgast
Copy link
Member Author

@rrsettgast About OutputBase::getOutputDirectory(): What do you think of a static string Path::getOutputDirectory() (along with the setter too)? Or, at least, to relocate it in src/common/*?

I think this is the only solution. I just hadn't done it yet.

…ject in ~ProblemManager() to avoid constitutiveDrivers from being dropped by the linker
…tBase. Also remove static data members in OutputBase. Also reenable TableFunction::print
@MelReyCG
Copy link
Contributor

MelReyCG commented Aug 21, 2024

@rrsettgast

To avoid to rely on Group tree assomptions like...

  Group & problemManager = this->getGroupByPath( "/Problem" );
  Group & physicsSolverManager = problemManager.getGroup( "Solvers" );

... I would like to suggest two options:


Option 1. Split ProblemManager in two classes to invert the dependency:

  1. ProblemManagerABC or ProblemManagerBase: located in dataRepository, it would be a shallow class which would mainly expose mainly the different assessors for the sub-managers, along with the view-keys (we can also imagine a static method to get it getRoot( Group const & anyGroup ) or with a singleton getInstance()),
  2. ProblemManager or ProblemManagerImpl: located in mainInterface, it would contain the concrete behaviour / management methods (problemSetup(), runSimulation().

Option 2. Expose the ProblemManager::groupKeysStruct view-keys in a dedicated file in dataRepository, maybe with methods for accessing them:

  • T & getManager<T>( Group const & anyGroup, string_view managerViewKey )
  • T const & getConstManager<T>( Group const & anyGroup, string_view managerViewKey )

@rrsettgast rrsettgast added the ci: run integrated tests Allows to run the integrated tests in GEOS CI label Aug 21, 2024
@rrsettgast
Copy link
Member Author

@rrsettgast

To avoid to rely on Group tree assomptions like...

  Group & problemManager = this->getGroupByPath( "/Problem" );
  Group & physicsSolverManager = problemManager.getGroup( "Solvers" );

... I would like to suggest two options:

Option 1. Split ProblemManager in two classes to invert the dependency:

  1. ProblemManagerABC or ProblemManagerBase: located in dataRepository, it would be a shallow class which would mainly expose mainly the different assessors for the sub-managers, along with the view-keys (we can also imagine a static method to get it getRoot( Group const & anyGroup ) or with a singleton getInstance()),
  2. ProblemManager or ProblemManagerImpl: located in mainInterface, it would contain the concrete behaviour / management methods (problemSetup(), runSimulation().

Option 2. Expose the ProblemManager::groupKeysStruct view-keys in a dedicated file in dataRepository, maybe with methods for accessing them:

  • T & getManager<T>( Group const & anyGroup, string_view managerViewKey )
  • T const & getConstManager<T>( Group const & anyGroup, string_view managerViewKey )

I think I would prefer to tackle this in a follow up PR. This one is kind of heavy already.

m_outputDirectory = outputDir;
string & outputDirectory = const_cast< string & >( getOutputDirectory() );
outputDirectory = outputDir;
FunctionBase::setOutputDirectory( outputDirectory );
Copy link
Member Author

Choose a reason for hiding this comment

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

@MelReyCG I did this instead of moving the outputDirectory up to common. We will have to come back and do something better later, but I didn't like the move option either....maybe we can discuss at the next meeting.

@rrsettgast rrsettgast merged commit d8c3166 into develop Aug 21, 2024
22 of 33 checks passed
@rrsettgast rrsettgast deleted the cleanup/removeCircularLinkDependencies branch August 21, 2024 22:51
@MelReyCG
Copy link
Contributor

I think I would prefer to tackle this in a follow up PR. This one is kind of heavy already.

@rrsettgast @wrtobin
No problem, what do you guys think of the suggestions? I can make a PR for the one you prefer.

@@ -77,7 +77,6 @@ set(ENABLE_MATHPRESSO OFF CACHE BOOL "")
# Silo configure script doesn't recognize systype
set(SILO_BUILD_TYPE powerpc64-unknown-linux-gnu CACHE STRING "")

set(GEOS_BUILD_SHARED_LIBS OFF CACHE BOOL "")
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not possible to build Geos as a shared library on powerpc architecture (error at link edition).

As by default the GEOS_BUILD_SHARED_LIBS variable is enabled, we have to keep this line for the P3 host-config (at least until we fix the linke error, which is not a priority for us for now).

@paveltomin
Copy link
Contributor

CC @drmichaeltcvx

rrsettgast added a commit that referenced this pull request Sep 17, 2024
* remove events from constitutive dependency list

* remove a bunch of redundant direct dependencies

* re-introduce options for dynamic libraries for each component

* move constitutive drivers outside of constitutive to resolve circular dependencies

* remove the use of blt_combine_static_libraries

* shared libs on by default in CI

* drop dependency of events on mesh. create temporary TriaxialDriver object in ~ProblemManager() to avoid constitutiveDrivers from being dropped by the linker

* add an outputDirectory in FunctionBase instead of grabbing from OutputBase. Also remove static data members in OutputBase. Also reenable TableFunction::print

* add WHOLE_ARCHIVE cmake decorations to linking for static libs. Lots of CMakeLists.txt cleanup

* cleanup unit test cmake files

* move constitutive driver documentation out on its own
rrsettgast added a commit that referenced this pull request Sep 17, 2024
* remove events from constitutive dependency list

* remove a bunch of redundant direct dependencies

* re-introduce options for dynamic libraries for each component

* move constitutive drivers outside of constitutive to resolve circular dependencies

* remove the use of blt_combine_static_libraries

* shared libs on by default in CI

* drop dependency of events on mesh. create temporary TriaxialDriver object in ~ProblemManager() to avoid constitutiveDrivers from being dropped by the linker

* add an outputDirectory in FunctionBase instead of grabbing from OutputBase. Also remove static data members in OutputBase. Also reenable TableFunction::print

* add WHOLE_ARCHIVE cmake decorations to linking for static libs. Lots of CMakeLists.txt cleanup

* cleanup unit test cmake files

* move constitutive driver documentation out on its own
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants