mdb package
- class mdb.async_client.AsyncClient(opts: AsyncClientOpts)[source]
Bases:
ABC
- class mdb.async_client.AsyncClientOpts
Bases:
TypedDict- connection_attempts: int
- exchange_hostname: str
- exchange_port: int
- class mdb.async_connection.AsyncConnection(reader: StreamReader, writer: StreamWriter)[source]
Bases:
object
- class mdb.backend.DebugBackend[source]
Bases:
ABC- abstract property argument_separator: str
- abstract property debug_command: str
- abstract property default_options: list[str]
- abstract property float_regex: str
- abstract property name: str
- abstract property prompt_string: str
- abstract property start_command: str
- class mdb.debug_client.DebugClient(opts: dict[str, str])[source]
Bases:
AsyncClient
- class mdb.exchange_server.AsyncExchangeServer(opts: dict[str, Any])[source]
Bases:
object- async client_loop(conn: AsyncConnection) None[source]
- mdb.mdb.run_main() None[source]
Wrapper around main function to add click environment variable support
See [here](https://click.palletsprojects.com/en/8.1.x/options/#values-from-environment-variables) for more info.
- class mdb.mdb_attach.ShellOpts
Bases:
TypedDict- backend_name: str
- exchange_select: str
- exec_script: str | None
- plot_lib: str
- ranks: int
- mdb.mdb_attach.attach_shell(client_opts: AsyncClientOpts, plot_lib: str, script_path: None | str = None) mdbShell[source]
Attach to mdb debug server. Returns the shell instance. Intended use is for within wrappers, scripts, or tests.
For details about the arguments, see the docstring of attach.
- class mdb.mdb_client.Client(opts: AsyncClientOpts)[source]
Bases:
AsyncClient
- class mdb.mdb_launch.Server_opts
Bases:
TypedDict- appfile: str
- args: str
- hostname: str
- mpi_command: str
- port: int
- ranks: int
- select: str
- class mdb.mdb_shell.mdbShell(shell_opts: ShellOpts, client: Client)[source]
Bases:
Cmd- broadcast_mode: bool = False
- default(line: str) bool | None[source]
Method called on an input line when the command prefix is not recognized.
- do_broadcast(line: str) None[source]
Description: Broadcast mode (bcm) sends commands to the selected ranks (see help select for more info). Broadcast mode is enabled/(disabled) by typing broadcast start/(stop). To exit broadcast mode, enter command [broadcast stop] or [quit] or press CTRL+D.
Example: The following command will start broadcast mode.
(mdb) broadcast start
- do_command(line: str) None[source]
Description: Run [command] on every selected process. Alternatively, manually specify which ranks to run the command on.
Example: The following command will run “print myvar” command on every process.
(mdb) command print myvar
The following command will run “print myvar” command on processes 0,3,4 and 5.
(mdb) command 0,3-5 print myvar
- do_dump(line: str) None[source]
Description: Dump variable in memory to binary file Example: The following command will dump variable [var] to a file with the name [var].dmp.[rank].
(mdb) dump [var]
- do_execute(line: str) None[source]
Description: Execute commands from an mdb script file.
Example: Run commands from script file test.mdb
(mdb) execute test.mdb
- do_plot(line: str) None[source]
Description: Print basic statistics (min, mean, max) and produce a bar chart for a given variable [var] on all selected processes. This is intended for float/integer variables.
Example: The following command will plot a graph of variable [var] on all selected processes.
(mdb) plot [var]
- do_quit(line: str) bool[source]
Description: Quit mdb.
Example: Quit the mdb debugger using the following command:
(mdb) quit
- do_select(line: str) None[source]
Description: Change which rank(s) are manually controlled.
Example: Manually control ranks 0,2,3 and 4 using the following command:
(mdb) select 0,2-4
- do_set(line: str) None[source]
Description: Set mdb options.
Example: Switch output format between separate and combined mode:
(mdb) set output combined (mdb) set output separate
combined reduces common output across the ranks
Show current settings:
(mdb) set
- do_shell(line: str) None[source]
Description: Run shell (UNIX) command.
Alias [!]
Example: Run a UNIX shell command from mdb.
(mdb) !ls
- hist_file: str = '/home/docs/.mdb_history'
- hist_filesize: int = 10000
- intro: str = 'mdb - mpi debugger - built on various backends. Type ? for more info. To exit interactive mode type "q", "quit", "Ctrl+D" or "Ctrl+]".'
- class mdb.mdb_wrapper.MPI_Mode(*values)[source]
Bases:
Enum- INTEL = 'Intel'
- MPICH = 'MPICH'
- OPENMPI = 'Open MPI'
- UNSUPPORTED = 'unsupported'
- class mdb.mdb_wrapper.WrapperLauncher(prog_opts: Wrapper_opts)[source]
Bases:
object
- class mdb.mdb_wrapper.Wrapper_opts
Bases:
TypedDict- appfile: str
- args: str
- backend: str
- connection_attempts: int
- hostname: str
- mpi_command: str
- mpi_config_opt: str
- port: int
- ranks: int
- redirect_stdout: str
- select: str
- target: str
- class mdb.messages.Message(msg_type: str, data: dict[str, Any])[source]
Bases:
object- data: dict[str, Any]
- msg_type: str
- mdb.utils.collapse_ranges(values: list[int]) str[source]
Collapse a list of integers into minimal range notation.
e.g. [1, 2, 3, 6, 7, 10, 11, 12] -> ‘1-3,6-7,10-12’
- mdb.utils.extract_float(line: str, backend: DebugBackend) float[source]
- mdb.utils.parse_ranks(ranks: str) list[int][source]
Parse a string of ranks into a set of integers. E.g.,
parse_ranks("1,3-5")would return the following:set(1,3,4,5).- Parameters:
ranks – string of ranks using either a mix of comma separation and ranges using hyphen.
- Returns:
A set of ranks represented by integers.
- mdb.utils.reduce_response(response: dict[int, str]) None[source]
Reduce debug output by deduplicating common lines across ranks.
Parses each rank’s output, groups identical lines together, and prints each unique line prefixed by the collapsed set of ranks that produced it. Lines from only one rank appear normally; shared lines are printed once with all contributing ranks.
Example output before and after:
Before (raw output per rank):
0: process 45402 0: cmdline = ‘/mdb/examples/simple-mpi.exe’ 0: cwd = ‘/mdb’ 0: exe = ‘/mdb/examples/simple-mpi.exe’ ******************************************************************** 1: process 45403 1: cmdline = ‘/mdb/examples/simple-mpi.exe’ 1: cwd = ‘/mdb’ 1: exe = ‘/mdb/examples/simple-mpi.exe’
After (deduplicated, ranks collapsed):
0: process 45402
0-1: cmdline = ‘/mdb/examples/simple-mpi.exe’ 0-1: cwd = ‘/mdb’ 0-1: exe = ‘/mdb/examples/simple-mpi.exe’
1: process 45403
- Parameters:
response – dict mapping process rank (int) to its output string.
- mdb.utils.sort_debug_response(results: dict[int, str]) dict[int, str][source]
Sort debug output by process rank.
- Parameters:
response – dict containing the
- Returns:
The string with bracketted paste escape sequence removed.
- mdb.utils.strip_bracketted_paste(text: str) str[source]
Strip bracketted paste escape sequence from text (see issue #669 https://github.com/pexpect/pexpect/issues/669).
- Parameters:
text – string that contains bracketted paste escape sequence,
- Returns:
The string with bracketted paste escape sequence removed.