Skip to content

Adjust output formatting and add graceful shutdown#21

Open
Likqez wants to merge 2 commits into
MinecraftAtHome:mainfrom
Likqez:main
Open

Adjust output formatting and add graceful shutdown#21
Likqez wants to merge 2 commits into
MinecraftAtHome:mainfrom
Likqez:main

Conversation

@Likqez

@Likqez Likqez commented Jun 24, 2026

Copy link
Copy Markdown

This PR fixes #20, and includes a singnal handler to do graceful shutdown.
The handler also prints a final message, before exiting, giving the user more insight into how many seeds have been checked, and what the initial start seed was.

^C
Shutting down...
Waiting for GPU batches to finish...
Start seed: -367462408893886601, Total seeds checked: 3725347258368

@BoySanic

Copy link
Copy Markdown
Contributor

I made my print interval 8192 and the effect is still a problem with your fix:

filter_seeds         - 52493.634 ms |  30.846 % |    2199023255552 ->    349839588 | 1 in    6285.804 |  41.891 Gips |   6.664 Mops
init_seeds           -  2934.128 ms |   1.724 % |        349839588 ->    349839588 | 1 in       1.000 | 119.231 Mips | 119.231 Mops
filter_gradvecs_1    - 62975.958 ms |  37.006 % |   22927087239168 ->   6181577479 | 1 in    3708.938 | 364.061 Gips |  98.158 Mops
filter_2_01a         - 36989.235 ms |  21.736 % |       6181577479 ->     24040373 | 1 in     257.133 | 167.118 Mips | 649.929 kops
filter_gradvecs_2    -  5355.509 ms |   3.147 % |     317933932925 ->    214789979 | 1 in    1480.208 |  59.366 Gips |  40.106 Mops
filter_2_01b         -  1446.208 ms |   0.850 % |        214789979 ->      6601185 | 1 in      32.538 | 148.519 Mips |   4.564 Mops
init_seeds_late_1    -  1703.801 ms |   1.001 % |          6601185 ->      6601185 | 1 in       1.000 |   3.874 Mips |   3.874 Mops
filter_2a            -   655.332 ms |   0.385 % |          6601185 ->       425716 | 1 in      15.506 |  10.073 Mips | 649.619 kops
init_seeds_late_2    -   508.435 ms |   0.299 % |           425716 ->       425716 | 1 in       1.000 | 837.306 kips | 837.306 kops
filter_2b            -   572.258 ms |   0.336 % |           425716 ->        33522 | 1 in      12.700 | 743.923 kips |  58.578 kops
init_seeds_late_3    -   486.204 ms |   0.286 % |            33522 ->        33522 | 1 in       1.000 |  68.946 kips |  68.946 kops
filter_2c            -  2007.563 ms |   1.180 % |            33522 ->         1157 | 1 in      28.973 |  16.698 kips | 576.321  ops
init_seeds_late_4    -   102.106 ms |   0.060 % |             1157 ->         1157 | 1 in       1.000 |  11.331 kips |  11.331 kops
filter_2d            -  1012.212 ms |   0.595 % |             1157 ->           40 | 1 in      28.925 |   1.143 kips |  39.517  ops
total                - 170178.163 ms |  99.450 % |    2199023255552 ->           40 |                  |  12.922 Gips |   0.235  ops

Could you make it dynamically adjust padding to adjust for the largest number in each column or something?

Comment thread src/gpu.cu
auto [scaled_input_speed, input_speed_unit] = scale_si(scaled_total_inputs / stage.total_time);
auto [scaled_output_speed, output_speed_unit] = scale_si(stage.total_outputs / stage.total_time);
std::printf("%-20s - %9.3f ms | %7.3f %% | %12" PRIu64 " -> %12" PRIu64
std::printf("%-20s - %9.3f ms | %7.3f %% | %16" PRIu64 " -> %12" PRIu64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As stated before, same issue if you just increase the print interval enough (as it starts to affect the other columns too).

A better approach would be to dynamically change how the columns are padded based on the widest text that will go into the column, imo.

Comment thread src/main.cpp
#endif

#ifndef NO_GPU
for (auto &thread : gpu_threads) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you're going to change this, move the following NO_CPU block into the first NO_CPU block too for consistency.

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.

Output table misaligned

2 participants