hwloc-nox set CPU affinity in Linux

sudo apt-get install  hwloc-nox
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  hwloc-nox
0 upgraded, 1 newly installed, 0 to remove and 530 not upgraded.
Need to get 151 kB of archives.
After this operation, 453 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 hwloc-nox amd64 1.11.2-3 [151 kB]
Fetched 151 kB in 0s (184 kB/s)   
Selecting previously unselected package hwloc-nox.
(Reading database ... 224148 files and directories currently installed.)
Preparing to unpack .../hwloc-nox_1.11.2-3_amd64.deb ...
Unpacking hwloc-nox (1.11.2-3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up hwloc-nox (1.11.2-3) ...
mint@mint ~ $ apt-cache search lstopo^C
mint@mint ~ $ lstopo
lstopo              lstopo-no-graphics 
mint@mint ~ $ lstopo-no-graphics
Machine (16GB total)
  NUMANode L#0 (P#0 7962MB)
    Package L#0
      L3 L#0 (6144KB)
        L2 L#0 (2048KB) + L1i L#0 (64KB) + Core L#0
          L1d L#0 (16KB) + PU L#0 (P#0)
          L1d L#1 (16KB) + PU L#1 (P#2)
        L2 L#1 (2048KB) + L1i L#1 (64KB) + Core L#1
          L1d L#2 (16KB) + PU L#2 (P#4)
          L1d L#3 (16KB) + PU L#3 (P#6)
        L2 L#2 (2048KB) + L1i L#2 (64KB) + Core L#2
          L1d L#4 (16KB) + PU L#4 (P#8)
          L1d L#5 (16KB) + PU L#5 (P#10)
        L2 L#3 (2048KB) + L1i L#3 (64KB) + Core L#3
          L1d L#6 (16KB) + PU L#6 (P#12)
          L1d L#7 (16KB) + PU L#7 (P#14)
      L3 L#1 (6144KB)
        L2 L#4 (2048KB) + L1i L#4 (64KB) + Core L#4
          L1d L#8 (16KB) + PU L#8 (P#16)
          L1d L#9 (16KB) + PU L#9 (P#18)
        L2 L#5 (2048KB) + L1i L#5 (64KB) + Core L#5
          L1d L#10 (16KB) + PU L#10 (P#20)
          L1d L#11 (16KB) + PU L#11 (P#22)
        L2 L#6 (2048KB) + L1i L#6 (64KB) + Core L#6
          L1d L#12 (16KB) + PU L#12 (P#24)
          L1d L#13 (16KB) + PU L#13 (P#26)
        L2 L#7 (2048KB) + L1i L#7 (64KB) + Core L#7
          L1d L#14 (16KB) + PU L#14 (P#28)
          L1d L#15 (16KB) + PU L#15 (P#30)
    HostBridge L#0
      PCIBridge
        PCI 14e4:1639
          Net L#0 "enp4s0f0"
        PCI 14e4:1639
          Net L#1 "enp4s0f1"
      PCIBridge
        PCI 14e4:1639
          Net L#2 "enp5s0f0"
        PCI 14e4:1639
          Net L#3 "enp5s0f1"
      PCIBridge
        PCI 103c:323a
      PCI 1002:4390
      PCI 1002:439c
        Block(Removable Media Device) L#4 "sr0"
      PCIBridge
        PCI 1002:515e
          GPU L#5 "renderD128"
          GPU L#6 "card0"
          GPU L#7 "controlD64"
  NUMANode L#1 (P#2 8032MB) + Package L#1
    L3 L#2 (6144KB)
      L2 L#8 (2048KB) + L1i L#8 (64KB) + Core L#8
        L1d L#16 (16KB) + PU L#16 (P#1)
        L1d L#17 (16KB) + PU L#17 (P#3)
      L2 L#9 (2048KB) + L1i L#9 (64KB) + Core L#9
        L1d L#18 (16KB) + PU L#18 (P#5)
        L1d L#19 (16KB) + PU L#19 (P#7)
      L2 L#10 (2048KB) + L1i L#10 (64KB) + Core L#10
        L1d L#20 (16KB) + PU L#20 (P#9)
        L1d L#21 (16KB) + PU L#21 (P#11)
      L2 L#11 (2048KB) + L1i L#11 (64KB) + Core L#11
        L1d L#22 (16KB) + PU L#22 (P#13)
        L1d L#23 (16KB) + PU L#23 (P#15)
    L3 L#3 (6144KB)
      L2 L#12 (2048KB) + L1i L#12 (64KB) + Core L#12
        L1d L#24 (16KB) + PU L#24 (P#17)
        L1d L#25 (16KB) + PU L#25 (P#19)
      L2 L#13 (2048KB) + L1i L#13 (64KB) + Core L#13
        L1d L#26 (16KB) + PU L#26 (P#21)
        L1d L#27 (16KB) + PU L#27 (P#23)
      L2 L#14 (2048KB) + L1i L#14 (64KB) + Core L#14
        L1d L#28 (16KB) + PU L#28 (P#25)
        L1d L#29 (16KB) + PU L#29 (P#27)
      L2 L#15 (2048KB) + L1i L#15 (64KB) + Core L#15
        L1d L#30 (16KB) + PU L#30 (P#29)
        L1d L#31 (16KB) + PU L#31 (P#31)

Set your affinity

 

taskset -p ps aux^C
mint mint # ps aux|grep kvm
root      1306  0.0  0.0      0     0 ?        S<   Aug17   0:00 [kvm-irqfd-clean]
root      3724  0.0  0.0  91656  5056 pts/3    S+   16:44   0:00 sudo qemu-system-x86_64 -m 11264 -smp 1 -net tap -net nic -enable-kvm -cpu host -drive file=/dev/sda
root      3725  8.7 45.2 12405860 7413032 pts/3 Sl+ 16:44  11:34 qemu-system-x86_64 -m 11264 -smp 1 -net tap -net nic -enable-kvm -cpu host -drive file=/dev/sda
root      3759  0.0  0.0      0     0 ?        S    16:44   0:00 [kvm-pit/3725]
root      5234  0.0  0.0  14224   980 pts/6    S+   18:56   0:00 grep --color=auto kvm
mint mint # taskset -pc 31 3725
pid 3725's current affinity list: 0-31
pid 3725's new affinity list: 31
mint mint # taskset -pc 30,31 3725
pid 3725's current affinity list: 31
pid 3725's new affinity list: 30,31

 

In the above command I set the affinity to core 31 and then changed it to cores 30 and 31.


Tags:

hwloc, nox, cpu, affinity, linuxsudo, apt, install, lists, dependency, packages, installed, upgraded, newly, kb, archives, additional, disk, http, archive, ubuntu, xenial, amd, fetched, selecting, previously, unselected, database, directories, currently, preparing, unpack, nox_, _amd, deb, unpacking, processing, triggers, db, mint, cache, lstopo, graphics, gb, numanode, mb, pu, hostbridge, pcibridge, pci, quot, enp, removable, sr, gpu, renderd, controld, taskset, ps, aux, grep, kvm, aug, irqfd, pts, sudo, qemu, _, smp, nic, enable, dev, sda, sl, auto, pc, pid, cores,

Latest Articles

  • Cloned VM/Server/Computer in Linux won't boot and goes to initramfs busybox Solution
  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint
  • Save money on bandwidth by disabling reflective rpc queries in Linux CentOS RHEL Ubuntu Debian
  • How to access a disk with bad superblock Linux Ubuntu Debian Redhat CentOS ext3 ext4
  • ImageMagick error convert solution - convert-im6.q16: cache resources exhausted
  • PTY allocation request failed on channel 0 solution
  • docker error not supported as upperdir failed to start daemon: error initializing graphdriver: driver not supported
  • Migrated Linux Ubuntu Mint not starting services due to broken /var/run and dbus - Failed to connect to bus: No such file or directory solution