Refactor DeferredLogger as a mutable pointer into GroupStateHelper#6705
Refactor DeferredLogger as a mutable pointer into GroupStateHelper#6705atgeirr merged 26 commits intoOPM:masterfrom
Conversation
|
jenkins build this please |
|
jenkins build this please |
1 similar comment
|
jenkins build this please |
|
i'd be careful about doing this change. the passing of loggers is, while annoying, a feature. there are some spots where we need multiple loggers in flight to handle recursive stuff for wells et al, and there is no guarantee all these cases are exercised in the test suite. |
@akva2 Can you show an example? |
|
I'm sorry, I can't really pinpoint it, and it's a bit hard to look for. The fact that you have already changed this stuff in previous PRs makes it even harder to track. I just remember there has been PRs and there has been code where a def_logger and a local_def_logger was used to fix such issues. If you are confident that it's okay, it's probably okay, it was just a heads up that you really need to make sure you don't end up reintroducing these issues. |
| const Parallel::Communication& comm() const { return this->comm_; } | ||
|
|
||
| /// @brief Get the deferred logger | ||
| /// @throws assertion failure if no logger has been set via setupScopedDeferredLogger() |
There was a problem hiding this comment.
Not strictly true, I suggest making it true: instead of assert() make it a regular if and throw.
There was a problem hiding this comment.
Correct, I have updated the PR with a commit to address this. I also added two commits to address the recursive creation of temporary loggers that @akva2 made me aware of and he has approved those. Does this look ok to you?
|
jenkins build this please |
@akva2 Indeed, I found a place at https://github.com/OPM/opm-simulators/blob/master/opm/simulators/wells/BlackoilWellModel_impl.hpp#L1832. I will have to think about this, so I will put the PR in draft state to avoid merging for now. |
|
jenkins build this please |
|
jenkins build this please |
@akva2 See the last two commits: This should work now. You can now push as many deferred loggers as you want. We could consider cleaning up method calls where both groupStateHelper and deferredLogger are passed such that we only pass groupStateHelper (no need to pass both) in a follow-up PR, see e.g. https://github.com/OPM/opm-simulators/blob/master/opm/simulators/wells/BlackoilWellModel_impl.hpp#L1832 |
akva2
left a comment
There was a problem hiding this comment.
This is kinda hard to review in terms of regressions and/or change behavior, but the principles seems fine to me.
|
jenkins build this please |
Introduce a RAII-based mechanism for binding a DeferredLogger pointer to GroupStateHelper, enabling cleaner method signatures by avoiding repeated parameter passing. Changes: - Add ScopedDeferredLoggerGuard nested class with move semantics - Add setupScopedDeferredLogger() factory method and deferredLogger() accessor - Add mutable DeferredLogger* member (logical constness for logging) - GuideRateHandler now delegates to GroupStateHelper for logger access - Remove setLogger() calls from BlackoilWellModel_impl.hpp This is a first step toward simplifying the DeferredLogger parameter threading throughout the blackoil well model module.
Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
…rod() Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
…et() Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
…ctor() Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
…ucer() Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
…ells() Use GroupStateHelper's stored deferred logger instead of passing it as a parameter. This simplifies the method signature and call sites. Part of the DeferredLogger refactoring series for GroupStateHelper.
|
jenkins build this please |
|
jenkins build this please |
|
@akva2 The jenkins build reports an error that seems unrelated to this PR: CUDA ERROR (code = 35, CUDA driver version is insufficient for CUDA runtime version). Any ideas? |
|
Irrelevant, just that we build against cuda but there is no gpu.
Sendt fra Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Håkon Hægland ***@***.***>
Sent: Saturday, January 10, 2026 11:12:23 AM
To: OPM/opm-simulators ***@***.***>
Cc: Arne Morten Kvarving ***@***.***>; Mention ***@***.***>
Subject: Re: [OPM/opm-simulators] Refactor DeferredLogger as a mutable pointer into GroupStateHelper (PR #6705)
[https://avatars.githubusercontent.com/u/6708379?s=20&v=4]hakonhagland left a comment (OPM/opm-simulators#6705)<#6705 (comment)>
@akva2<https://github.com/akva2> The jenkins build reports an error that seems unrelated to this PR: CUDA ERROR (code = 35, CUDA driver version is insufficient for CUDA runtime version)<https://ci.opm-project.org/job/opm-simulators-PR-builder/9303/testReport/junit/(root)/default/runSimulator_spe1case1_carfin_gr/>. Any ideas?
—
Reply to this email directly, view it on GitHub<#6705 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAQLQR6GSSOD7A2U2E5E2UT4GDGAPAVCNFSM6AAAAACQGNTT22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMZSGMZTAMBSHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
jenkins build this please |
We need the move constructor in ScopedLoggerGuard since pushLogger() returns it by value.
Clarify why ScopedLoggerGuard needs to store a pointer to GroupStateHelper (and cannot store a reference)
Reduce scope of logger guard to log messages before the calls to OpmLog::debug() on rank 0 at the end of getWellConvergence().
|
jenkins build this please |
|
jenkins build this please |
…eter Methods that receive GroupStateHelper can obtain the DeferredLogger via groupStateHelper.deferredLogger(), making the separate parameter redundant.
|
jenkins build this please |
|
jenkins build this please |
When looping over well container some ranks may never enter the loop, so logger guard needs to be created outside the loop
|
jenkins build this please |
Don't create extra deferred loggers that do not match the logger in groupStateHelper
|
jenkins build this please |
|
jenkins build this please |
Use groupStateHelper logger instead of creating an explicit logger.
|
jenkins build this please |
|
I think this is good now, merging! |
Refactor
DeferredLoggerusage in theGroupStateHelperclass by integrating it as a mutable member ofGroupStateHelperwith RAII-based scoped setup. This simplifies method signatures throughout the codebase by removing the need to passDeferredLogger&to every method that needs logging.