Log in

View Full Version : How to limit the number of CPU thread used in encoding?


nghiabeo20
22nd December 2018, 10:25
I'm encoding on a laptop (4720HQ). I once nearly brick it due to running at 100% for too long. How can I reduce the number of thread to avoid overheat? And if there's such option for x265/Handbrake, could I reduce the heat significant by setting just 6 threads instead of 8? (I mean 6 thread is still larger than 4 cores, so even if I set it to 6 threads all the 4 core still actives, therefore the heat reduced is just minimal).

sneaker_ger
22nd December 2018, 11:41
How do you know you "nearly bricked it"? Did smoke come out?
If it runs too hot I would check the cooling system. Often laptops accumulate dust which needs to be cleaned out like once a year. Heat paste may become dry and need replacement.

To make it run cooler you can try:
1. Disable HyperThreading in BIOS/UEFI
2. disable AVX2 ("--asm FMA4")
3. reduce number threads: (e.g. --pools "4")
4. reduce clocks/undervolt (basically reverse overclocking), disable turbo boost. Instead of doing that in BIOS/UEFI you can try lower Windows Power Plans.

https://x265.readthedocs.io/en/default/cli.html

nghiabeo20
22nd December 2018, 11:46
How do you know you "nearly bricked it"?
If it runs too hot I would check the cooling system. Often laptops accumulate dust which needs to be cleaned out like once a year. Heat paste may become dry and need replacement.

To make it run cooler you can try:
1. Disable HyperThreading in BIOS/UEFI
2. disable AVX2 ("--asm avx")
3. reduce threads: e.g. --threads 4
4. reduce clocks/undervolt (basically reverse overclocking), disable turbo boost. Instead of doing in BIOS/UEFI you can try lower Windows Power Plans.

It actually stopped working, I had to replace a capacitor or something. I didnt think of disabling AVX, will test it ASAP.
I didn't find the --thread in x265 CLI option, can you provide me the exact option?

FranceBB
22nd December 2018, 21:28
You are better off downclocking it when needed; heat can be quite hard to dissipate on laptops.
I just googled the specs of your i7 4720HQ and it's a 4c/8th with 2.60GHz normal and 3.60GHz turbo boost.
Are you using Windows? I highly doubted that the UEFI of the laptop allows you to modify the multiplier nor the v-core of the CPU as those options are generally hidden, however you might google some programs that allow you to downclock the CPU.
On Linux, I generally use the scaling governor to modify the frequency.
Try to downclock it at about 2.00GHz, which is gonna be fine. (If it's still too hot, you can go to 1.60GHz, but it's gonna be extremely slow).
If you can't downclock it, at least disable the Turbo Boost and make sure that the fan is spinning as fast as it can.

Anyway, limiting the number of threads of x265 will help, but not so much.
If you can't really downclock the CPU and you just disabled the Turbo Boost, try with:

--no-asm --frame-threads 1 --pools "none" --no-wpp

It's gonna be terribly slow, tho.

kuchikirukia
27th December 2018, 20:42
You can disable Turbo by going into Advanced Power Settings and under Processor Power Management setting Maximum Processor State to 99%.

This is far better than reducing threads because it forces your processor down to where it's more efficient instead of just running fewer cores at max voltage and frequency.

https://i.postimg.cc/mDmv21pG/Untitled.png

benwaggoner
3rd January 2019, 20:20
There can be quality upside to reducing threads. It's not as big as it used to be, but --frame-threads 1 and --lookahead-threads 1 could reduce CPU load some while upping quality some. In general, there is CPU and cache overhead in parallelization, so if you're doing higher resolutions on smaller numbers of cores, you can actually get a bit faster, a bit better, and a bit lower power draw at the same time. Not generally, but it is possible in some circumstances.