forgive me if this is not the right forum.
I am looking for a way to programmatically enable/disable Hyperthreading in the CMOS setup. Since I have around 50 nodes, it would be easy if I could do it through a program and restart the machine. Do we have any assembly instruction or any Intel library which can be used for this? If there is not any, is it possible to use PORT address 70 and 71 to manipulate CMOS and modify the settings? I remember I manipulated CMOS settings by OUTing to Port address 70 and 71 long time back (for resetting system password).
Thanks in advance
Milton K Baby
In which operating system are you working on? By the way, PORT 70 and 71 allowed access to the first 128 bytes of the CMOS Setup, and you need driver privileges to do that inmodern operating systems. That was possible in old DOStimes.
Thanks for the response. I am working on Windows 2008.
Yes, I was aware that we cant access any hardware ports using OUT instruction in Windows OS as we were doing in DOS. I was sharing it as a pointer to get more info on the CMOS bit layout as a last option if there is no direct approch.
Milton K Baby
I don't know if a BIOS driver allows you to do that. However, perhaps this helps.
Yo can change the boot.ini to add different configurationsestablishinglimitsthe number of maximum logical cores in the [operating systems] section, adding the following to the end of each line that defines the OS.
To use just one core:
To use just two cores:
An so on:
This can help you. Because, you can make an application that changes the default value for the next reboot. And then, reboot the computer.
Please, take into account that you should be very careful when changing boot.ini.
On Nehalem, if you boot the system where HT is enabled in the BIOS, then you can use OS boot options to control the number of CPUs.
Say we have 1 Nehalem chip with 8 logical cpus on 4 cores (so HT is enabled). If you use the OS boot options to reduce the number of CPUs to 4, then the behavior of the system will be the same as if you had disabled HT in the BIOS.
On windowsXP, you can edit the boot.ini file and add the option /numproc=4 to the boot command line.
On Vista, you may have to use the bcdedit command to change the boot options. For more on bcdedit, see http://technet.microsoft.com/en-us/library/cc721886.aspx
On linux you can use the maxcpus=4 boot option (for example, on my linux box (from /boot/grup/menu.lst)
kernel /boot/vmlinuz-126.96.36.199-0.21-smp root=/dev/disk/by-id/scsi-SATA_ST3500320AS_5QM22FZB-part2 vga=0x314 resume=/dev/sda3 splash=silent showopts maxcpus=4
More info on linux boot options is available at http://tldp.org/HOWTO/BootPrompt-HOWTO-3.html#ss3.4
So a sample session might look like:
1) boot with HT enabled
2) do whatever you need to do with all 8 logical threads
3) change the default boot option to allow only 4 cpus
4) reboot (note that the dashes below are supposed to be short dashes - not long dashes .
a. On windows: shutdown -r -t 0
b. On linux: shutdown r t 0 now
5) The system should come back up with only 1 logical cpu per core and it should behave the same as if you had disabled HT in the BIOS.
Thank a lot Gastn and Om Sachan.
Definitely bcdedit is an option even though I am not sure if it will give the exact same behavior as we disable in the BIOS. Let us take the scenario where I have a quad core which implies 8 logical processors with HT enabled. I have two concerns here:
1) If I say 4 proc in boot.ini does it mean that OS will not consider the 4 HT provided logical processors and instead it will take the 4 physical cores?
Or is there a chance that OS will take the first 2 physical cores and its 2 HT enabled logical processors so that a total of 4 procs. But 2 are physical and 2 are logical here. Do you know if this can happen or not?
2) Suppose OS consider 4 physical cores only and not the logical ones. In this case, will these logical cores be completely turned off as in the case of disabling in BIOS? Or is there a chance that it will use power and it will contribute to the total heat generated and hence any possible impact on the performance?
Thanks in advance
I cannot tell you exactly how the OS works. However, I can tell you about my experience in recent tests made with a Core i7. I had many applications using pipelines to scale up to 8 cores and I wanted to test Hyper-Threading: http://www.ddj.com/go-parallel/blog/archives/2009/04/intels_hyperthr.html
I ran the tests disabling HT and then leaving HT enabled and doing exactly the same changes in boot.ini. Then, I compared the results and disabling HT worked the same than specifying the number of cores in boot.ini.
I guess (I guess), the OS gives priority to the physical cores first when you limit then. However, be careful because I ran these tests in Windows 2008 Server, FreeBSD 7 and OpenSuse 11. I wanted to make an OS independent test.
You told you were working with Windows 2008 Server too. I tell you this because I believe Windows XP's maximum number of cores is 4.
I'm sure it will not use additional power, because the OS completely ignores the additional cores. I've tested that situation.
Hope it helps.
As to the effect on power, the answer is correct, it doesn't matter whether the 2nd logical processor is turned off in BIOS or at OS boot time. As long as the OS scheduler never gives a task to the 2nd logical, it won't draw increased power and affect the Turbo operation, if you have enabled that.
If you build an application with Intel OpenMP, and set one of the OpenMP environment variable verbose options, such as KMP_AFFINITY=compact,0,verbose
you get a screen enumeration of how the OpenMP library sees your logical processes and the order it will use for thread to logical assignment. "compact" will pair up the logicals on each core, threads 0 and 1 being assigned to the same core,....
"scatter," with OMP_NUM_THREADS set to the number of cores, would pick out 1 logical from each core.
This is not entirely true. There are some ressources in the Core that are partitioned when Hyper-Threading is enabled in the BIOS. These are load buffers, store buffers, re-order buffers, and small-page ITLB. You canfind this information in section 2.2.9 of the Intel 64 and IA-32 Architectures Optimization Reference Manual. Even when the OS uses only one hardware thread per core, these buffers will still remain partitioned.
For most tuning and optimizations, I agree that this difference is most likely not relevant. However, there are quite some developers around who optimize their code on a micro-architectural level and therefore might experience the difference.
The "competitively-shared" resources are an important distinction from the NetBurst HT. Where Prescott allowed only 3 write combining buffers to be in use per logical processor, we now have at least 8 fill buffers available for demand sharing between logicals.