ffmpeg 不使用最大 CPU 功率

ffmpeg 不使用最大 CPU 功率

我购买了两个新的 CPU E5-2650:

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

但看起来,即使我用它运行,ffmpeg 也没有使用 CPU 的最大功率-threads 0。从atop我可以看到,ffmpeg 只使用了 72 个线程。

  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

CPU信息:

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:

答案1

E5-2650有 8 个核心,每个代码可以处理 2 个线程。也就是 16 个线程每个 CPU. 不是每核 16 个。

两个 CPU 总共有 32 个线程。假设计算机的其余部分足够快,可以继续为 CPU 提供数据,那么最佳使用率将接近 32 个线程。实际上情况并非如此,总会存在其他延迟,无论是从内存读取时,还是从磁盘读取或写入时,或者从其他地方读取或写入时。因此最佳的使用量并不总是与最大可用线程数相同。

在您的例子中,可能使用了 72 个线程,因为有些线程启动后必须等待其他数据。与此同时,其他线程可以继续。因此实际上有更多活动线程可以同时进行计算。

相关内容