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

  • ssh Too many authentication failures not prompting for password
  • LightDM Mint Ubuntu Debian won't start errors Nvidia Graphics
  • WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files. Check that you have pkg-config and the libglvnd development libraries installed, or specify a path with --glvnd-egl-config-path. Linux Ubuntu Mint Debian E
  • How To Upgrade Linux Mint 18.2 to 18.3 to 19.x and 20.x
  • MP3s Won't Play / ID3 Version 2.4 Issues in Cars and Other MP3 Players/CDs/DVDs Solution
  • LXC Containers LXD How to Install and Configure Tutorial Ubuntu Debian Mint
  • GlusterFS HowTo Tutorial For Distributed Storage in Docker, Kubernetes, LXC, KVM, Proxmox
  • Ubuntu Mint audio output not working pulseaudio "pulseaudio[13710]: [pulseaudio] sink-input.c: Failed to create sink input: too many inputs per sink."
  • How To Shrink Dynamically Allocated VM QEMU KVM VMware Disk Image File
  • How To Enable Linux Swapfile Instead of Partition Ubuntu Mint Debian Centos
  • 404 Not Found [IP: 151.101.194.132 80] apt update Debian 11 Bullseye Solution The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
  • WARNING: Can't download daily.cvd from db.local.clamav.net freshclam clamav error solution
  • (firefox:9562): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory) Solution
  • Debian Mint Ubuntu Which Package Provides missing top, ps and w Solution
  • Vbox Virtualbox DNS NAT Network Mode NOT working
  • Docker Tutorial HowTo Install Docker, Use and Create Docker Container Images Clustering Swarm Mode Monitoring Service Hosting Provider
  • Zoom Password Error 'That passcode was incorrect' - Solution Wrong Passcode Wrong Meeting Name
  • How To Startup and Open Remote/Local Folder/Directory in Ubuntu Linux Mint automatically upon login
  • How To Reset Windows Server Password 2019, 2022, 7, 8, 10, 11 Recovery and Removal Guide Using Linux Ubuntu Mint Debian
  • How To Create OpenVPN Server for Secure Remote Corporate Access in Linux Debian/Mint/Ubuntu with client public key authentication