Skip to content

Add option to switch text output modes#101

Merged
TomMelt merged 9 commits into
mainfrom
add-text-reduction
May 27, 2026
Merged

Add option to switch text output modes#101
TomMelt merged 9 commits into
mainfrom
add-text-reduction

Conversation

@TomMelt

@TomMelt TomMelt commented May 27, 2026

Copy link
Copy Markdown
Owner

Text Reduction Output Mode

Summary

Add a new combined output mode that deduplicates common lines across MPI ranks, reducing verbosity when debugging multi-rank programs where output is identical or largely overlapping.

Example:

Before (separate mode):

0: process 44900
0: cmdline = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'
0: cwd = '/home/melt/sync/cambridge/projects/side/mdb'
0: exe = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'
************************************************************************
1: process 44903
1: cmdline = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'
1: cwd = '/home/melt/sync/cambridge/projects/side/mdb'
1: exe = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'

After (combined mode):

  0: process 45004
0-1: cmdline = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'
0-1: cwd = '/home/melt/sync/cambridge/projects/side/mdb'
0-1: exe = '/home/melt/sync/cambridge/projects/side/mdb/examples/simple-mpi.exe'
  1: process 45005

Changes

Features

  • set output combined/separate — new command to switch between output modes:
    • separate (default): each rank's output shown independently, separated by **** dividers
    • combined: identical lines across ranks are merged and prefixed with collapsed rank ranges (e.g. 0-3:)
  • collapse_ranges() utility to convert lists of rank IDs into compact range notation (e.g. [0, 1, 2, 5, 6]"0-2,5-6")
  • reduce_response() function that groups identical lines across ranks and prints each unique line once with the contributing ranks

Documentation

  • New tutorial docs/source/changing-output.rst covering the output mode feature with side-by-side examples
  • Added link to the new tutorial in docs/source/index.rst

Testing

  • Added test_collapse_ranges() with coverage for consecutive ranges, disjoint ranges, unsorted input, duplicates, gaps, and edge cases
  • Added test_pretty_print_response() to verify default output format
  • Updated existing test outputs (answer-gdb.stdout, answer-lldb.stdout) to reflect formatting changes

Other

  • Minor formatting tweak: prepend_ranks() now uses " " instead of "\t" for rank prefix padding

@TomMelt TomMelt merged commit b2c67bf into main May 27, 2026
2 checks passed
@TomMelt TomMelt deleted the add-text-reduction branch May 27, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant