-
Notifications
You must be signed in to change notification settings - Fork 283
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
Allow limiting number of plotting processes during Stage 1 #177
base: main
Are you sure you want to change the base?
Conversation
I would expect that setting the priority to the threads really low (or high nice-level) would also solve this problem, or at least mitigate it. Have you tested that? If that would work well. it would be a bit more scalable going forward. We may want to parallelize more steps, like sorting, in the future. And if the OS scheduler could sort this out itself, it would be ideal. |
@arvidn Interesting idea, I haven't tried that. it might help with GUI not getting frozen when overprovisioning threads, I'll check if it helps. But it will still result in Phase 1 taking longer overall if all processes will be simultaneously in it. It might be worth setting low priority as additional measure. Another thing of concern is adding more args to Python bindings. Possibly it's better to pass params as struct in CreatePlotDisk? For example, Deno's linter has a rule |
Required changes in chia-blockchain: |
Lowering priorities but setting them to different values for each plotter could also work. Theoretically this will allow for one plotter to be prioritized and finish faster and not stall all of them. |
When multiple plotter instances are working, use flock to prevent them from copying files to destination disk simultaneously on rotational media. Assume media is non-rotational by default. Linux only, on Windows and MacOS the behavior is unchanged.
Allow specifying maximum number of simultaneous plot processes entering phase 1 for staggered plotting. Temporary files are used as flags: one file per process. Sample cli usage: mkdir -p /home/user/.config/chia/run ./ProofOfSpace create -k 24 --p1maxproc 2 --runtimedir /home/user/.config/chia/run
'This PR has been flagged as stale due to no activity for over 60 |
This PR is based on unmerged #176
Please review only the last commit, I'll rebase once 176 is merged. Can be merged separately if needed.
Will require adding commandline switches in chia-blockchain as well.
Sample use case: when starting 16 plotters (each using 4 threads) on 16 thread CPU, it's best to stagger their runs to not lock the computer down during stage 1 (multithreading is supported only in stage 1).
Currently this has to be done with external script:
etc
But this setup is error-prone:
As a solution, this patch uses lock files to allow only up to a specified number of processes in Stage 1. Other plotters will wait for their turn. Plotters can be stopped and restarted at any time without consequences. Locks (slots) are automatically released if plotters crash or are stopped.
How to test:
Runtimedir should be the same (on prod can default to
~/.config/chia/run
)Third process will wait until first two leave Stage 1.