Announcement

Collapse
No announcement yet.

Unable to disable hyperthreading

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to disable hyperthreading

    I am not able to disable hyperthreading from BIOS.

    I searched on the internet and came accross with some suggestions. No one worked. Even with the one starting with sudo echo >0.

    Aren't we able to disable hyperthreading any more? This is very important. Hypertherading increases the overhead of cpu. I tried many experiments with htop. The scheduler randomly selects CPUs. When the load is high the cpu switches to single core mode. All threads are executed on the same core. Therefore, multicore cpu becomes useless under heavy load. Hypertthreading makes things worse.

    It is very crucial to provide an option for disabling hyperthreading. CPU will be faster.

    İf there is a way that I don't know in Kubuntu 14.0.4, what is it? If not please add this feature.

    I am an academician and conducting research on the performance of multicore cpus. Therefore, it is very important for me to discuss this issue with a developer responsible for cpu issues. Can this developer get into contact with me soon please?

    Regards

    #2
    maby ........... http://www.absolutelytech.com/2011/0...ores-in-linux/

    VINNY
    i7 4core HT 8MB L3 2.9GHz
    16GB RAM
    Nvidia GTX 860M 4GB RAM 1152 cuda cores

    Comment


      #3
      Disabling cores isn't the same thing as disabling hyperthreading. To the operating system, hyperthreading presents two virtual cores for each actual physical core in the CPU. Wikipedia's overview section explains it accurately.

      If you can't disable HT in the firmware, then you'll need to do it at the command line. This will require some research into the CPU architecture on your machine. First, run cat /proc/cpuinfo to see an overview. The values of interest will be:
      • processor: the virtual core number as seen by the operating system
      • physical id: the true physical CPU number
      • core id: the true physical core number
      • cpu cores: the actual number of true cores in the machine
      • siblings: the number of virtual cores per physical CPU exposed to the operating system

      My Lenovo T520 has a Core i7-2620M CPU. This is a single socket (single physical CPU), dual-core processor with hypertheading. Thus, the operating system will see four virtual CPUs. Let's take a look at the interesting bits:
      Code:
      steve@t520:~$ [B]cat /proc/cpuinfo | egrep '^processor|^physical id|^core id'[/B]
      processor       : 0
      physical id     : 0
      core id         : 0
      processor       : 1
      physical id     : 0
      core id         : 0
      processor       : 2
      physical id     : 0
      core id         : 1
      processor       : 3
      physical id     : 0
      core id         : 1
      There are four virtual processors, two physical cores, and one physical CPU. An interesting way to tell whether hyperthreading is enabled is to compare the number of cores to the number of siblings:
      Code:
      steve@t520:~$ [B]cat /proc/cpuinfo | egrep '^siblings|^cpu cores' | sort -u[/B]
      cpu cores       : 2
      siblings        : 4
      If siblings = cores * 2, then hyperthreading is enabled; if siblings = cores, then hyperthreading is disabled or not present on the CPU(s). An article on /proc/cpuinfo has more examples to review.

      To disable hyperthreading, you need to figure out which virtual processors are associated with which cores, and disable one virtual processor on each core. You can find this information in various files in /sys/devices/system/cpu/cpu*/topology. For each virtual processor in cpu*, useful files are:
      • physical_package_id: the true physical CPU hosting the virtual processor
      • core_id: the true physical core hosting the virtual processor
      • thread_siblings_list: the grouping of virtual processors per physical core
      • core_siblings_list: the grouping of virutal processors per physical CPU

      Continuing with my PC, we have:
      Code:
      steve@t520:~$ [B]grep . /sys/devices/system/cpu/cpu*/topology/{physical_package_id,core_id,thread_siblings_list,core_siblings_list}[/B]
      /sys/devices/system/cpu/cpu0/topology/physical_package_id:0
      /sys/devices/system/cpu/cpu1/topology/physical_package_id:0
      /sys/devices/system/cpu/cpu2/topology/physical_package_id:0
      /sys/devices/system/cpu/cpu3/topology/physical_package_id:0
      /sys/devices/system/cpu/cpu0/topology/core_id:0
      /sys/devices/system/cpu/cpu1/topology/core_id:0
      /sys/devices/system/cpu/cpu2/topology/core_id:1
      /sys/devices/system/cpu/cpu3/topology/core_id:1
      /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:0-1
      /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:0-1
      /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:2-3
      /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:2-3
      /sys/devices/system/cpu/cpu0/topology/core_siblings_list:0-3
      /sys/devices/system/cpu/cpu1/topology/core_siblings_list:0-3
      /sys/devices/system/cpu/cpu2/topology/core_siblings_list:0-3
      /sys/devices/system/cpu/cpu3/topology/core_siblings_list:0-3
      Of particular interest here is thread_siblings_list. From this, we learn that virtual processors cpu0 and cpu1 are grouped onto one core and that cpu2 and cpu3 are grouped onto another. To disable hyperthreading, I would need to disable one sibling on each core. That would be either the pair cpu0 and cpu2, or the pair cpu1 and cpu3.

      Now, how to do this? For each cpu*, there is a corresponding online file. Well, this isn't exactly correct: there is no such file for cpu0 -- because cpu0 cannot be disabled. Observe:
      Code:
      steve@t520:~$ [B]grep . /sys/devices/system/cpu/cpu*/online[/B]
      /sys/devices/system/cpu/cpu1/online:1
      /sys/devices/system/cpu/cpu2/online:1
      /sys/devices/system/cpu/cpu3/online:1
      So the last sentence in the previous paragraph is incorrect for my system. To disable hyperthreading, my only option would be to disable cpu1 and cpu3. To do this, I would issue the command:
      Code:
      steve@t520:~$ [B]echo 0 | sudo tee /sys/devices/system/cpu/cpu{1,3}/online >/dev/null[/B]
      We can verify the results thusly:
      Code:
      steve@t520:~$ [B]grep . /sys/devices/system/cpu/cpu*/online[/B]
      /sys/devices/system/cpu/cpu1/online:0
      /sys/devices/system/cpu/cpu2/online:1
      /sys/devices/system/cpu/cpu3/online:0
      Notably, /proc/cpuinfo has changed:
      Code:
      steve@t520:~$ [B]cat /proc/cpuinfo | egrep '^processor|^physical id|^core id'[/B]
      processor       : 0
      physical id     : 0
      core id         : 0
      processor       : 2
      physical id     : 0
      core id         : 1
      steve@t520:~$ [B]cat /proc/cpuinfo | egrep '^siblings|^cpu cores' | sort -u[/B]
      cpu cores       : 2
      siblings        : 2
      There is now only one virtual processor per physical core, and siblings = cores.



      Ultimately, you'll want to script the above, and have it run when the system boots. You will need to consider all the various ways these numbers could be reported, and develop an appropriate method. Take special consideration for machines with multiple physical CPUs. If my computer had two of these Core i7 CPUs, then I would have eight virtual processors spread across four physical cores, and the numbering arrangement would change accordingly.

      Also: the construct sudo echo 0 > /path/to/online doesn't work, because it only runs the echo command elevated; the redirection happens after the command completes -- and elevation has already ended. The workaround for this is echo 0 | sudo tee /path/to/online >/dev/null. tee takes input and sends it in two directions: to the specified output (the file) and to the console window. Elevating tee gives it the permissions to modify online. Adding >/dev/null keeps everything neat by not displaying the console output of the command.

      Comment


        #4
        Code:
        vinny@vinny-Bonobo-Extreme:~$ cat /proc/cpuinfo | egrep '^processor|^physical id|^core id'
        processor       : 0
        physical id     : 0
        core id         : 0
        processor       : 1
        physical id     : 0
        core id         : 1
        processor       : 2
        physical id     : 0
        core id         : 2
        processor       : 3
        physical id     : 0
        core id         : 3
        processor       : 4
        physical id     : 0
        core id         : 0
        processor       : 5
        physical id     : 0
        core id         : 1
        processor       : 6
        physical id     : 0
        core id         : 2
        processor       : 7
        physical id     : 0
        core id         : 3
        My core is bigger than your core ....................

        VINNY
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          Originally posted by vinnywright View Post
          [/CODE]My core is bigger than your core ....................
          Yes, by a factor of two. So, "Tripod," how's your day so far? LOL

          Comment


            #6
            "tripod"
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              LOL ,,,,,,, well I'm walking in circles now ............

              VINNY
              i7 4core HT 8MB L3 2.9GHz
              16GB RAM
              Nvidia GTX 860M 4GB RAM 1152 cuda cores

              Comment

              Working...
              X