Skip to content

Commit 48ea028

Browse files
committed
Add rankInfo command to print rank/thread information to interactive console
1 parent 0b728cf commit 48ea028

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/sst/core/impl/interactive/simpleDebug.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ SimpleDebugger::SimpleDebugger(Params& params) :
4747
[this](std::vector<std::string>& tokens) { cmd_help(tokens); } },
4848
{ "verbose", "v", "[mask]: set verbosity mask or print if no mask specified", ConsoleCommandGroup::GENERAL,
4949
[this](std::vector<std::string>& tokens) { cmd_verbose(tokens); } },
50+
{ "rankinfo", "ri", "print current rank and thread IDs", ConsoleCommandGroup::GENERAL,
51+
[this](std::vector<std::string>& tokens) { cmd_rankInfo(tokens); } },
5052
{ "confirm", "cfm", "<true/false>: set confirmation requests on (default) or off", ConsoleCommandGroup::GENERAL,
5153
[this](std::vector<std::string>& tokens) { cmd_setConfirm(tokens); } },
5254
{ "pwd", "pwd", "print the current working directory in the object map", ConsoleCommandGroup::NAVIGATION,
@@ -395,6 +397,15 @@ SimpleDebugger::cmd_verbose(std::vector<std::string>& tokens)
395397
}
396398
}
397399

400+
SimpleDebugger::cmd_rankInfo(std::vector<std::string>& UNUSED(tokens)) {
401+
402+
RankInfo info = getRank();
403+
RankInfo nRanks = getNumRanks();
404+
std::cout << "Rank " << info.rank << "/" << nRanks.rank
405+
<< ", Thread " << info.thread << "/" << nRanks.thread << std::endl;
406+
}
407+
408+
398409
// pwd: print current working directory
399410
void
400411
SimpleDebugger::cmd_pwd(std::vector<std::string>& UNUSED(tokens))

src/sst/core/impl/interactive/simpleDebug.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ class SimpleDebugger : public SST::InteractiveConsole
180180
181181
// Navigation
182182
void cmd_help(std::vector<std::string>& UNUSED(tokens));
183-
void cmd_verbose(std::vector<std::string>&(tokens));
183+
void cmd_verbose(std::vector<std::string>& (tokens));
184+
void cmd_rankInfo(std::vector<std::string>& UNUSED(tokens));
184185
void cmd_pwd(std::vector<std::string>& UNUSED(tokens));
185186
void cmd_ls(std::vector<std::string>& UNUSED(tokens));
186187
void cmd_cd(std::vector<std::string>& tokens);

0 commit comments

Comments
 (0)