Turn off CPU throttling when installing ATLAS

If ATLAS's configure detects that CPU throttling is enabled, it will kill itself. The reason is that ATLAS depends on timings to tune the library to your machine. OS-controlled throttling is so course-grained that essentially all timings become random. What this means is that instead of optimizing the code, ATLAS winds up randomly transforming the code, sometimes resulting in better code, and just as often, making the code slower.

If throttling is enabled, the only way to get a decent ATLAS install is therefore to turn it off. Most machines can switch it off in the BIOS, but on machines with newer Linux kernels even this does not stop pstate throttling. To tell linux not to ignore your bios settings you must log in as root/sudo, and issue something similar to:

  1. Edit /etc/default/grub
  2. Find line with: GRUB_CMDLINE_LINUX_DEFAULT
  3. Append the following to args: intel_pstate=disable
  4. Update grub: update-grub
  5. Reboot

For modern Linuxes, you can turn off throttling using cpufreq-set. Some systems allow you to set the speed of individual cores, and others force groups of cores to run at same speed. Therefore, on a 4-core system, your frequency settings may not take hold until you've set all 4-cores to the desired setting. For instance:

   /usr/bin/cpufreq-set -g performance -c 0
   /usr/bin/cpufreq-set -g performance -c 1
   /usr/bin/cpufreq-set -g performance -c 2
   /usr/bin/cpufreq-set -g performance -c 3

Under MacOS or Windows, you may be able to change this under the power settings. I have reports that issuing "powercfg /q" in cmd.exe under windows will tell you whether windows is throttling or not.

Note that if you worry about the system overheating, you should be able to get decent (not perfect) tuning by forcing any constant clock rate (rather than forcing the maximum rate, as above).

If you cannot turn off cpu throttling you must pray that ATLAS already has architectural defaults. If so, ATLAS will likely still have poor performance, but at least not all code transformation decisions will be taken at random. To proceed with a random ATLAS tuning in the face of CPU throttling, you can throw the the configure flag: --cripple-atlas-performance.

R. Clint Whaley 2016-07-28