Apple’s Worldwide Developers Conference to kick off June 10 at 10 a.m. PDT with Keynote address

The Keynote will be available to stream on apple.com, the Apple Developer app, the Apple TV app, and the Apple YouTube channel. On-demand playback will be available after the conclusion of the stream.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

permanently disable hyperthreading

I need a way to permanently disable hyperthreading on a Mac Pro 2013. I am number crunching with Matlab. My code is 30%-50% faster with hyperthreading disabled. I am currently using the Instruments.app to temporarily disable hyperthreading, but it resets whenever the computer goes to sleep or is rebooted.


I have not found any solution that will keep hyperthreading disabled until I turn it back on. Any suggestions? Even a cleverly written applescript which would automate the instruments.app approach might work for me.

Mac Pro, OS X Mavericks (10.9.3)

Posted on May 24, 2014 3:53 AM

Reply
4 replies

May 24, 2014 6:11 PM in response to twtwtw

It is not possible to take better advantage of hyperthreading. I have already written the code in parallel. I have an 8 core machine and local parallel processing in Matlab will depoly a maxiumu of 12 cores (real or virutal). Hyperthreading creates 16 cores, only twelve of which are actually being used.


Also, it is interesting that even with 'single threaded' processing, turning off hyperthreading results in a 30% computational time reduction. I put 'single' in quotes since many Matlab functions take advantage of multiple cores even when you are running a linear process.


No matter how you cut it, Matlab runs significantly faster without hyperthreading.


Any ideas on how to write a script to disable hyperthreading?

May 25, 2014 9:29 PM in response to szenttehen

A (very) quick poke at sysctl indicates that the following values change as a result of switching the settings in Instruments:


hw.availcpu

hw.activecpu

hw.physicalcpu

hw.logicalcpu


Admittedly, I don't know which ones are cause vs. effect (e.g. it may be sufficient to change the hw.physicalcpu value and the others may follow, but a little trial and error might get you what you want. Of course, these might all be effects of some other low-level change that Instruments.app makes, but there shouldn't be any harm in trying.


The values can be change via something like:


sudo sysctl -w hw.availcpu=8


You might want to dump your entire sysctl table (systcl -a) first so that you have a record of the current values, which will make it easier to restore values later. Or you can just reboot (sysctl changes are transient). If you find a setting that works for you then you can incorporate it into a startup script that applies all the time.

Nov 13, 2014 3:15 AM in response to szenttehen

Hi,


I have the same issue, and I have a processor bound task where hyperthreading leaves me worse off (i.e. restructuring to use hyperthreading). Many responses to this question seem to deny the fact that hyperthreading is not the solution to improving performance for some problems, and that mother-knows-best.


Did you find a solution, as I have tried some other solutions but they seem not to work in Yosemite?

permanently disable hyperthreading

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.