-
Notifications
You must be signed in to change notification settings - Fork 9
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
869 make command-line arguments in VT non-static #898
Conversation
1720402
to
b82d4e0
Compare
b82d4e0
to
f3564d0
Compare
Codecov Report
@@ Coverage Diff @@
## develop #898 +/- ##
===========================================
- Coverage 77.37% 77.26% -0.11%
===========================================
Files 655 656 +1
Lines 25055 25076 +21
===========================================
- Hits 19386 19376 -10
- Misses 5669 5700 +31
|
commit c6b68a6 removes all invocations of
@lifflander @pnstickne do you guys have any advice on this? does it even make sense to move |
Ah, I see the problem that you are encountering. Basically, the arg config being a component means it starts up with the pack, but the |
d34db06
to
c6b68a6
Compare
82b28a0
to
6a96003
Compare
44ff0d1
to
6d09de3
Compare
65d96b6
to
d91346a
Compare
a couple of builds are failing when dereferencing Program received signal SIGSEGV, Segmentation fault.
0x00005555556fedda in vt::ctx::Context::Context (this=0x55555587b6d0, argc=<optimized out>,
argv=<optimized out>, is_interop=<optimized out>, comm=0x18)
77 if (comm != nullptr and *comm != MPI_COMM_NULL) {
(gdb) bt
#0 0x00005555556fedda in vt::ctx::Context::Context (this=0x55555587b6d0, argc=<optimized out>,
argv=<optimized out>, is_interop=<optimized out>, comm=0x18)
#1 0x0000555555692ca3 in std::make_unique<vt::ctx::Context, int&, char**, bool&, int*> ()
#2 vt::runtime::component::ComponentConstructor<vt::ctx::Context, void, int&, char**, bool&, int*>::apply<int&, char**, bool&, int*> ()
#3 vt::runtime::component::Component<vt::ctx::Context>::staticInit<int&, char**, bool&, int*> ()
#4 vt::runtime::component::ComponentPack::registerComponent<vt::ctx::Context, vt::arguments::ArgConfig, int&, char**, bool&, int*>(vt::ctx::Context**, vt::runtime::component::BaseComponent::DepsPack<vt::arguments::ArgConfig>, int&, char**&&, bool&, int*&&)::{lambda()#1}::operator()() (this=<optimized out>)
#5 std::_Function_handler<void (), vt::runtime::component::ComponentPack::registerComponent<vt::ctx::Context, vt::arguments::ArgConfig, int&, char**, bool&, int*>(vt::ctx::Context**, vt::runtime::component::BaseComponent::DepsPack<vt::arguments::ArgConfig>, int&, char**&&, bool&, int*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&)
#6 0x00005555556b491a in std::function<void ()>::operator()() const (this=<optimized out>)
#7 vt::runtime::component::ComponentPack::construct (this=0x55555587ad60)
#8 0x000055555568bb44 in vt::runtime::Runtime::initializeComponents (this=this@entry=0x555555872040)
(...) this doesn't happen when using Debug builds and even in the CI all builds apart from 4 gcc configurations are passing I have tracked down the change that introduces this - capturing by reference when registering components: @@ registry::AutoHandlerType ComponentPack::registerComponent(
- [ref,this,cons...]() mutable {
+ [ref,this,&cons...]() mutable { when we pass the MPI_Comm to edit: vt/runtime/component/component_pack.impl.h:68:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = vt::arguments::ArgConfig; _Dp = std::default_delete<vt::arguments::ArgConfig>]’
68 | [ref,this,cons...]() mutable {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(...)
/usr/include/c++/9/bits/unique_ptr.h:414:7: note: declared here
414 | unique_ptr(const unique_ptr&) = delete;
| ^~~~~~~~~~ |
d91346a
to
e02aa16
Compare
@@ -696,7 +566,7 @@ std::tuple<int, std::string> parseArguments(CLI::App& app, int& argc, char**& ar | |||
rargs = &vt_args; | |||
rargs->push_back(c); | |||
} else { | |||
passthru_args.push_back(c); |
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.
I recommend using local variables for local mutation, saving the assignment to global state until as late as possible.
This reduces expressions and allows identification of "when" global modification occurs my limitation potential candidates.
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.
#include "vt/runtime/component/component.h"
should be removed from the header when not needed.
bb7b969
to
07c2e3d
Compare
I'm working a little refactoring to print before the runtime starts up. This is very useful for debugging so I don't want to loose that functionality. |
Here is an overview of what got changed by this pull request: Clones removed
==============
+ src/vt/runtime/runtime.cc -2
See the complete overview on Codacy |
@cz4rs I've resolved a few problems.
/// =========================================================================
/// Notes on lifecycle for the ArgConfig/AppConfig
/// =========================================================================
///
/// - After \c vt::Runtime is constructed, the ArgConfig lives in
/// \c arg_config_ and \c app_config_ contains a pointer to the internals.
///
/// - After the pack registers the ArgConfig component, \c arg_config_ is no
/// longer valid. The config is in a tuple awaiting construction---thus, we
/// can't easily access it. app_config_ remains valid during this time
///
/// - After construction, the \c arg_config_ is in the component
/// \c theConfig() and can be accessed normally
///
/// - After \c Runtime::finalize() is called but before the pack is destroyed,
/// we extract the \c ArgConfig from the component and put it back in
/// \c arg_config_ for use after.
///
/// - From then on, until the \c vt::Runtime is destroyed or VT is
/// re-initialized \c arg_config_ will contain the configuration.
///
/// For this to all work correctly, the \c vt_debug_print infrastructure
/// calls \c vt::config::getConfig() which always grabs the correct app
/// config, either from the component singleton or the \c vt::Runtime
///
/// =========================================================================
|
@lifflander Great, thanks for the fixes and improvements (especially for documetning the lifecycle!) |
draft for further discussion regarding #869
include
s from headers when possibleFixes #869