disable cpu
Posted 杏子肥
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了disable cpu相关的知识,希望对你有一定的参考价值。
根据我现在的判断,disable cpu 有两种方式。
第一种,在root的时候,进行 disable
Choose ‘e‘ and you get to a command line where you can add options. You can also create permanent boot option in grub by making a copy of your current boot option and add maxcpus=1 to the boot parameters. You can name this ‘Ubuntu, kernel 2.5.12-9-386 (1 cpu)‘ and have it amongst the other boot options like the picture shows. You can verify running on 1 cpu by issuing: cat /proc/cpuinfo | grep processor this should show something like this:
第二种,进行 Hotplug
You can dynamically disable CPUs via /sys/devices/system/cpu/cpuN/online, for example to disable CPU 1, use: echo 0 | sudo tee /sys/devices/system/cpu/cpu1/online
cat /sys/devices/system/cpu/online (to check online cpu)
cat /sys/devices/system/cpu/offline (to check offline cpu)
re-enable, use: echo 1 | sudo tee /sys/devices/system/cpu/cpu1/online
见网页:http://askubuntu.com/questions/46011/is-it-possible-to-disable-a-cpu-not-a-core
https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu/
tee 是需要有sudo 权限才能运行的。
以上是关于disable cpu的主要内容,如果未能解决你的问题,请参考以下文章
RuntimeError: ‘lengths’ argument should be a 1D CPU int64 tensor, but got 1D cuda:0 Long tensor(代码片段