question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Phase1 Renice

See original GitHub issue

Feature Request

Support configurable Phase1 and Phase2/3/4 NICE levels in the config Ex:

plotting:
        k: 32
        e: False             # Use -e plotting option
        n_threads: 6         # Threads per job
        n_buckets: 128       # Number of buckets to split data into
        job_buffer: 4096     # Per job memory
        phase_1_nice: -19 #Launch Nice of Plotting Process
        phase_234_nice: 15 #Renice on completion of Phase1

On launch of plotting processes set NICE of -19, as per example At Phase 1 completion, renice PID of respective job to 15, as per example

Background:

much of my plotting load testing has lead me to the conclusion that over-subscription of machine cores (threads) at a near 2:1 ratio nets optimal parallel plotting, while sacrificing a bit of phase1 speed. The objective is to minimize the peak/valley behavior and fully utilize the compute resources available, within the limits of the storage. Phase1 is multi-threaded and compared to the other phases, extremely CPU bound. In the example configuration 32 threads would be allocated to Phase1 with an additional 11 threads for the jobs in phase2/3/4. , 43 threads allocated on 32 threads, roughly a 34% over subscription.

Example Hardware Config:

Ryzen 5950x (16c / 32t) 64GB DDR4-3600 4 x 1TB NVME TMP (mdadm raid-0, xfs, zram logdev, noatime mounts, etc) 1 x 500GB SSD Destination

Example Plotman config:

4 max before stage 2:0, 10 second scan, 10 minute stagger, 15 max plots, memory 4096, threads 8

Data:

Testing has shown that for all PIDs of jobs in Phase1, setting a nice of -19 and all other jobs at a default 15 ensures that adequate (all the things…) CPU resources are allocated to quickly progress the P1 jobs to a state where everyone gets their own single physical core in 2+. In ~24 hours of testing this has resulted in about an 8% gain in reduction of total plot time.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

2reactions
altendkycommented, May 15, 2021

Random tidbit, I’m not aware of any good reason to be running any Chia or plotman stuff as root.

2reactions
rdiroccocommented, May 13, 2021

for anyone that cares to do the same, here is some bash that you can use, loop it, cron it, whatever

#!/bin/bash
main () {
        echo "Checking PIDs and Making Nice!"
        nice_p1
        nice_p234
}

function nice_p1 {
        jobs=($(plotman status | awk {'print $1" "$6'} | grep "1:" | awk {'print  $1'}))
        if [[ ${#jobs[@]} -gt 0 ]]
        then
                echo "- Jobs in Phase 1:"
                for i in $(echo ${jobs[@]}); do
                        pid=$(plotman details $i | grep "pid:" | cut -d ":" -f 2)
                        echo " -- PID: "$pid
                        echo " --- Checking NICE "
                        nice=$(ps --no-headers -o ni $pid)
                        if [[ $nice -ne -19 ]]
                        then
                                echo " ----"`renice --priority -19 --pid $pid`
                        else
                                echo " --- Good, continuing"
                        fi
                done
        fi
}

function nice_p234 {
        jobs=($(plotman status | awk {'print $1" "$6'} | grep -v "1:" | awk {'print  $1'} | tail -n +2))
        if [[ ${#jobs[@]} -gt 0 ]]
        then
                echo "- Jobs in Phase 2/3/4:"
                for i in $(echo ${jobs[@]}); do
                        pid=$(plotman details $i | grep "pid:" | cut -d ":" -f 2)
                        echo " -- PID: "$pid
                        echo " --- Checking Nice"
                        nice=$(ps --no-headers -o ni $pid)
                        if [[ $nice -ne 15 ]]
                        then
                                echo " ----"`renice --priority 15 --pid $pid`
                        else
                                echo " --- Good, continuing"
                        fi
                done
        fi
}

main"$@"

Read more comments on GitHub >

github_iconTop Results From Across the Web

renice Command - IBM
When you specify a process group, the request applies to all processes in the process group. The nice value is determined in an...
Read more >
nice features to have "request" - VEMS Community Forum
Re: nice features to have "request" ... In actuality there are very few ecu´s that have 0-5v outputs. It´s very normal to have...
Read more >
Life Of A Feature Request - LinkedIn
Requirements. Phase one, figure out exactly what he needs. · Validation. Phase two in our process is to validate it's a generally needed...
Read more >
- About This Guide - BlackBerry QNX
The guide introduces you to the QNX Momentics IDE by explaining the QNX development environment and how to build, run, and debug your...
Read more >
renice - The Open Group Publications Catalog
The renice utility shall request that the nice values (see the Base ... Some implementations may implement the nice-related features to affect all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found