Linux(Ubuntu)上的CPU使用率下降

时间:2018-10-15 23:59:03

标签: amazon-web-services ubuntu tensorflow multiprocessing

enter image description here

我正在使用具有16个vCPU的AWS c5.4xlarge实例,并运行10个进程的python程序。但是,如图所示,每个进程的CPU使用率仅在10秒内逐渐下降到10%。 16个vCPU实例的CPU总使用率仅为6%。

我减少了进程数,但是每个进程的CPU使用率仍然很低。在我自己的macOS上一切正常。

enter image description here

这有什么问题?

1 个答案:

答案 0 :(得分:0)

好的,我找到了答案。这是关于处理器亲和力的。对于Linux初学者: https://en.wikipedia.org/wiki/Processor_affinity

在Linux中,您可以将Linux下的CPU分配给特定进程:

$ taskset -cp CPU_ID PID

例如:

$ taskset -cp 0-1 1000

将为ID为1000的CPU分配0和1。

您可以通过使用

找到PID
$ top

在您的终端上。