-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add terminal-based steering interface via an extract #1345
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.
Look great!
a few minor suggestions related to using C++ refs for strings and vectors, as well as the recipe for grabbing the right MPI comm
descriptions["run"] = "Run an Ascent callback with 'run my_callback_name'."; | ||
|
||
#ifdef ASCENT_MPI_ENABLED | ||
MPI_Comm_rank(MPI_COMM_WORLD, &m_rank); |
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.
We might not be using COMM_WORLD, so let's grab the right communicator using:
MPI_Comm mpi_comm = MPI_Comm_f2c(flow::Workspace::default_mpi_comm());
std::map<std::string, std::function<void()>> commands; | ||
std::map<std::string, std::string> descriptions; | ||
conduit::Node params; | ||
conduit::Node output; |
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.
We like to use m_
prefix for member vars
|
||
void empty_run(); | ||
void exit_shell(); | ||
void parse_input(std::string cmd, std::vector<std::string> args); |
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.
void parse_input(std::string cmd, std::vector<std::string> args); | |
void parse_input(std::string &cmd, std::vector<std::string> &args); |
void exit_shell(); | ||
void parse_input(std::string cmd, std::vector<std::string> args); | ||
void list_callbacks(); | ||
void modify_params(std::vector<std::string> args); |
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.
void modify_params(std::vector<std::string> args); | |
void modify_params(std::vector<std::string> &args); |
void modify_params(std::vector<std::string> args); | ||
void print_help(); | ||
void print_params(); | ||
void run_callback(std::vector<std::string> args); |
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.
void run_callback(std::vector<std::string> args); | |
void run_callback(std::vector<std::string> &args); |
} | ||
|
||
#ifdef ASCENT_MPI_ENABLED | ||
MPI_Bcast(&input_size, 1, MPI_INT, 0, MPI_COMM_WORLD); |
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.
grab comm from workspace
src/libs/ascent/ascent.hpp
Outdated
@@ -87,6 +87,14 @@ void ASCENT_API execute_callback(std::string callback_name, | |||
//----------------------------------------------------------------------------- | |||
bool ASCENT_API execute_callback(std::string callback_name); | |||
|
|||
//----------------------------------------------------------------------------- | |||
std::vector<std::string> |
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.
ref copy out style will be slight more efficient:
void ASCENT_API get_void_callbacks(std::vector<std::string> &name);
src/libs/ascent/ascent.hpp
Outdated
|
||
//----------------------------------------------------------------------------- | ||
std::vector<std::string> | ||
ASCENT_API get_bool_callbacks(); |
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.
ref copy out style will be slight more efficient:
void ASCENT_API get_bool_callbacks(std::vector<std::string> &name);
src/libs/ascent/ascent.hpp
Outdated
@@ -87,6 +87,14 @@ void ASCENT_API execute_callback(std::string callback_name, | |||
//----------------------------------------------------------------------------- | |||
bool ASCENT_API execute_callback(std::string callback_name); |
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.
bool ASCENT_API execute_callback(std::string callback_name); | |
bool ASCENT_API execute_callback(const std::string &callback_name); |
src/libs/ascent/ascent.cpp
Outdated
@@ -928,6 +928,28 @@ execute_callback(std::string callback_name) | |||
return callback_function(); | |||
} | |||
|
|||
//----------------------------------------------------------------------------- | |||
std::vector<std::string> |
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.
copy out still ref args are a bit more efficient (see below)
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.
thanks for the tweaks!
Tests exercising steering look good - let me know when you feel its ready to merge. |
Sweet, thanks Cyrus. I just made another polishing pass. Added comments, fixed formatting, simplified logic where I could, and made some tweaks after testing it out for myself. I feel comfortable merging it in it's current state. I'll go create a new branch to work on an example instrumentation which makes use of this. |
d77c26b
to
11197e0
Compare
This PR adds a new extract which puts the user into a basic shell-like steering interface. The main benefit is to have a simpler, no-dependency alternative to the existing ascent-jupyter-bridge steering interface.
It can be accessed via:
The current implementation allows users to manually, at runtime:
Still to-do:
Despite not being ready, the big picture implementation details are unlikely to change (where I've implemented it, how I've plumbed it through). Any feedback you may have for me is welcome.