Skip to content

Improve tables #134

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

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Improve tables #134

merged 2 commits into from
Dec 20, 2024

Conversation

Pennycook
Copy link
Contributor

Related issues

N/A

Proposed changes

  • Replace use of our custom report.table function with tabulate.table.
  • Prevent non-determinism in table output (which I noticed when testing this new table functionality).

See below for an example of the change when running the sample code base.

Before

------------------------
Platform Set  LOC % LOC
------------------------
          {} 2661 98.37
       {cpu}    8  0.30
       {gpu}    8  0.30
  {gpu, cpu}   28  1.04
------------------------

NB: "gpu" appears before "cpu" in the final set. This is non-deterministic.

After

┌────────────────┬───────┬─────────┐
│   Platform Set │   LOC │   % LOC │
├────────────────┼───────┼─────────┤
│             {} │  2661 │   98.37 │
├────────────────┼───────┼─────────┤
│          {cpu} │     8 │    0.30 │
├────────────────┼───────┼─────────┤
│          {gpu} │     8 │    0.30 │
├────────────────┼───────┼─────────┤
│     {cpu, gpu} │    28 │    1.04 │
└────────────────┴───────┴─────────┘

NB: "cpu" now always appears before "gpu" in the final set.

The tabulate package is more flexible than our old table() function and
produces nicer output.

Signed-off-by: John Pennycook <[email protected]>
Prior to this change, the way that a given platform set was printed in a table
was non-deterministic, since the order of platforms in the set depends on the
order of insertion rather than the platform name.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added bug Something isn't working enhancement New feature or request refactor Improvements to code structure labels Dec 4, 2024
@Pennycook Pennycook requested a review from laserkelvin December 4, 2024 15:35
@Pennycook Pennycook added this to the 2.0.0 milestone Dec 17, 2024
Copy link
Contributor

@laserkelvin laserkelvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Pennycook Pennycook merged commit 896741d into intel:main Dec 20, 2024
3 checks passed
@Pennycook Pennycook deleted the improved-tables branch December 20, 2024 08:05
@Pennycook Pennycook mentioned this pull request Dec 20, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request refactor Improvements to code structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants