Ffmpeg doesn’t use maximum cpu power

cpuffmpeg

I purchased two new cpus E5-2650:

8c * 16t per core = 128 * 2 = 256 - max number of threads

but it looks like ffmpeg doesn't use maximum power of cpu even though i'm running it with -threads 0.
from atop i can see that ffmpeg uses only 72 threads.

  PID     RUID         EUID          THR      SYSCPU      USRCPU      VGROW      RGROW      RDDSK      WRDSK     ST     EXC     S     CPUNR      CPU     CMD         1/9
40919     root         root           72       1.37s      20.09s         0K         0K      2688K       768K     --       -     S         7     1084%     ffmpeg

cpuinfo:

vendor_id   : GenuineIntel
cpu family  : 6
model       : 45
model name  : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping    : 7
microcode   : 0x70a
cpu MHz     : 2001.000
cache size  : 20480 KB
physical id : 1
siblings    : 16
core id     : 7
cpu cores   : 8
apicid      : 47
initial apicid  : 47
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips    : 3990.40
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

Best Answer

The E5-2650 has 8 cores and can process 2 threads per code. That is 16 threads per CPU. Not 16 per core.

Two CPUs have a total of 32 threads. Assuming the rest of the computer is fast enough to keep feeding the CPU then the optimal use would be near 32 threads. In praxis this is not true, there is always some other delay, either when reading from memory, when reading or writing to disk or from somewhere else. So optimal usage is not always the same as the maximum number of usable threads.

In your case, 72 threads are probably used because some got started, then had to wait for other data. Meanwhile, other threads can continue. So there are actually more threads active that can be computed on at the same time.

Related Question