March, 2013

Overclocking the i5 and i7 under Linux

Overclocking is something that I have avoided for many years, my thinking being that I value stability and reliability far above a modest increase in speed. But when I purchased an i5-2500K chip and paid a little extra for the "K" that indicated an unlocked multiplier, I was intrigued. And when the guy at the store said that it was a total no brainer to buy a decent heat sink and run the chip at 4.5 Ghz I was hooked.

It is worth asking yourself right up front, just what running at a 4.5 Ghz clock (as compared to the stock 3.5 Ghz) is going to buy you. We are talking about a 1 part in 4 speed increase. Something like 25 percent faster. So a computation that would have taken 60 minutes will now take 47 minutes. Is this going to change your life? I remember some time ago reading that a computer that runs twice as fast won't really get your attention, but an upgrade that gets you running 4 times as fast is definitely worth doing. A good rule of thumb. So why get in a sweat over an "upgrade" that gets you going 1.25 times as fast?
Good question, now lets get after it.

Here are some high quality articles:

Here is a nice discussion of Linux overclocking circa 2013:

Heat Sink

You would be unwise to try overclocking without doing a significant upgrade to the processor heat sink. You can go hog wild here, even going as far as to run a liquid cooling system, which is exactly what the overclocking enthusiasts do. I don't intend to go that far. I am interested in what I can do "on air" as the saying goes. What I did was to buy the Hyper-212 plus from Cooler Master for about $32. It is rated as well or better than fancy heat sinks costing as much as $100. In fact, it was the economical price of this heat sink that removed my last objection to trying some overclocking.

Motherboard

In general you need a motherboard that provides options in the BIOS that support overclocking. You will need to be able to modify the clock multiplier, and to select processor voltages. The way the game goes, you bump up the processor multiplier, but at some point things do not work. You can then increase the processor voltage, and things will work again. There are lots of ways to play this game, finding out by trial and error just how far you can push your specific processor. Some motherboards are overclocking friendly, some are not. Beyond having options in the BIOS, the hardware on the board has to support selection by software of processor voltages.

Choice of chip

You will need a chip (i5 or i7) with an unlocked multiplier (this is indicated by a "K" at the end of the part number, like i7-3770K). If you never intend to overclock, don't waste money on an unlocked chip (unless you think an i7-3770K running at 3.5 Ghz is really significantly faster than an i7-3770 running a 3.4 Ghz). Is one part in 34 (3 percent) anything significant? I don't think so. Also, if you are serious about overclocking, you are probably better off with the older "Sandy Bridge" parts (such as the i5-2500K). When Intel puts the chips together, they use a compound inside to join the heat spreader to the actual processor die. In Sandy Bridge chips, this is fluxless solder (so we are told), but in Ivy Bridge chips (like the i7-3770K) this is a thermal paste. This is fine for chips that will be run "in spec" as most people do, but limits how much overclocking can be done with Ivy Bridge chips before they get too hot. Lots of overclocking enthusiasts are upset and frustrated about this. It is in an odd way ironic. The Ivy Bridge chips run cooler (they consume 77W, as compared to 95W for a Sandy Bridge chip run in spec), so you would expect to be able to overclock them more aggressively, but this thermal issue limits the game prematurely.

Software Tools

Beyond the BIOS, you will need tools that run under linux (or whatever operating system you run) to monitor processor speeds and most importantly processor temperatures. You also need some piece of software to stress test your computer (to make as many cores as you choose of the processor busy so you can see how hot things get).

The most common way to do overclocking is to change processor settings in the BIOS, then boot your operating system, and run software to stress test the setup and display temperatures. There are however software tools that allow settings (processor multiplier at any rate) to be manipulated while the operating system is runing. Many people like to call this "software overclocking". Other know-it-alls complain that the BIOS is software too, and this is a misnomer. So be it, call it what you want.

Temperature monitoring

What I want is lm_sensors and gkrellm on linux. On my Fedora 18 system I do:
su
yum install lm_sensors
yum install gkrellm
sensors-detect
service lm_sensors start
systemctl enable lm_sensors.service

When I ran sensors-detect, I basically say yes to all the questions, including the one at the end when it wants to overwrite /etc/sysconfig/lm_sensors.

After this, I can run gkrellm as an ordinary user and see all kinds of temperatures displayed.

Temperature limits and experience

Somewhere I read that a good upper limit for CPU temperatures would be 75C when overclocking. The same source said that running in the range 65-70 would be a good goal. The trouble with this is that my processor, even with a serious heat sink, hits 72C under load, with stock settings. I am beginning to believe this advice is too conservative.

The Ivy Bridge CPU has an absolute limit of 105C and will act to downclock itself if pushed into this realm. Another source is saying that you should not go higher than 85-90 when overclocking. Yet another source says he would not like to see anything above 80C in regular use.

My i7-3770K system runs at 32 degrees C when idle (and apparently the CPU reduces its clock to 1.6 Ghz when it has nothing to do, which is nice).

Amazingly, Intel offers (for a small fee on the order of $25) what they call a PTPP (Performance Tuning Protection Plan), where if you burn up your processor overclocking it, they replace it for free! Their slogan, "Go ahead and push it, we've got your back". You get one free replacement. Makes me think that this expresses their confidence in th ability of the processor to protect itself, and their willingness to accept your small donation.

Voltages and Multipliers

One recommendation (for Ivy Bridge) is to jump the processor voltage up to 1.25 volts, set the multiplier to 45, and start from there. Work the voltage down in 0.01 volt steps to see at how low a voltage the system will be stable. A recommended absolute upper limit for Ivy Bridge overclocking is 1.3 volts and that is very aggressive. You would hope to be setting the voltage at 1.2 volts. People say that there is a good chance of clocking to 4.0 Ghz with stock voltages and only a slight voltage jump will take you to 4.5.

This is a significant change from practices with Sandy Bridge where pushing to 1.5 volts was common.

Processor speed monitoring

You can look at /proc/cpuinfo and find youself asking, "What is wrong, why doesn't this show my processor using the TurboBoost feature?". The deal is that this simply tells you what type of chip is in your system, and not what it is doing at any given moment. The best tool for this seems to be something called "i7z" To get this on my Fedora 18 system, I simply did:
yum install i7z
The first thing you will probably notice when you run this (aside from the fact you have a lot to learn before you can interpret what it is showing you) is that your 3.4 Ghz processor is idling away at 1.6 Ghz. More interesting things happen when you do stress testing. This, along with gkrellm give you a pretty good handle on what your system is doing. Too bad there isn't a krell that shows CPU speed.

Turbo Boost

What this is is a built in overclocking facility. It may bump up the clock for all cores if the chip can continue to run within spec. If only one core is busy, it can significantly bump up the clock for that core. It is controversial whether this feature should be turned off or not if a person is already deliberately overclocking. One point of view that seems reasonable is that there is no point having it on if the chip is already pushed to the limit (it will have no room to activate). On the other hand, the dynamic nature of having it push the clock when one core is busy might still make it useful in an already overclocked system. Aspects of this are under operating system control via the ACPI subsystem (Advanced Configuration and Power Interface), in particular the ability to specify a "performance state". The ACPI specification seems geared more towards mobile systems which want to control power consumption, but has relevance for this discussion also.

MSR tools

yum install msr-tools
You will need to go read about these, but they allow access to the MSR (Machine/Model Specific Register) and allow you to do things like disable TurboBoost (but why?). Screwing with the MSR could let you do things like doing overclocking on systems with a BIOS that don't allow access to processor multipliers, enabling overclocking at run time, then disabling it later, all kinds of things - but be careful.

Stress Testing

The commonly used tool for this is mprime: Don't be put off by this (as I was) or think you have gone to the wrong place. Find the download link and download a tarball -- unpack it and you will have the mprime executable. Run it (probably via ./mprime). The first time you run it you get a friendly greeting telling you that you are free to use it as a stress test tool without participating in the distributed prime search project. Thereafter you get greeted with a menu with 18 selections that you choose by number. I use "5" (to exit) and "15" (torture test). You get to select the number of cores to test.

After setting an overclock multiplier, mprime would not run from the command line. To fix this, delete mprime.txt and all was well -- who knows what this was all about.

Also it is possible to run mprime from the command line with a few options.

Results with stock settings and my i7

My i7-3770K system (with its big Hyper-212 heat sink), idles at 32C and running at 1.6 Ghz, much like any system would do. When I run mprime on a single core, the clock jumps to 3.87 Ghz (clearly using Turbo Boost) and the temperature for whatever core gets chosen to run mprime goes to 50C. If you tell it to run 2 cores, it avoids hyperthreading (as it should). The two active cores both run at 3.87 Ghz, which is somewhat surprising. Temperatures are now hitting 57C. With 3 cores active, the cores run at 3.78 Ghz and temperatures hit 64C. With 4 cores, I see 3.69 clocks and 66C - and it seems to be running hyperthreads rather than different cores (this is surprising, and not as it should be I think). With all 8 cores running, I see a clock of 3.69 Ghz and temperatures hit 72 or 73.

Results with mild overclocking and my i7

I was curious what the stock voltage settings were, so I rebooted my system and took a detour into the BIOS to check. The stock Vcore setting was 1.195 volts (with "auto" next to it). The stock clock multiplier was 35. It was hard to resist, so while I was there, I bumped the clock multiplier up to 40. The system booted normally and seemed entirely fine. Of course with no load, the CPU runs at 1.6 Ghz. I used "mprime -t" to run the torture test, which got all 8 "cores" busy. The i7z monitor shows all cores running at 4.0 Ghz. Temperatures rose to 72C, which I had seen already before I bumped up the multiplier, so it would seem that I get 4.0 Ghz for free (or for the cost of the $32 heat sink). We will see about 4.5 Ghz.

Results with serious overclocking and my i7

I had the machine apart to pop in a new power supply (a Corsair CX500), so it was a fine time to jump into the bios and bump up the multiplier from 40 to 45. I left the voltage settings at stock (but I need to check if they are also controlled by some auto setting that is doing things I don't expect). With the Vcore still at 1.195 volts and a multiplier of 45, I booted up without event and was humming along at 1.6 Ghz as usual. I used mprime -t again to run the torture test. This time temperatures in some cores got as high as 96 degrees after less than 5 minutes, and I terminated the experiment. This will not do.

Before returning to the stock fan and giving up entirely on i7 Ivy Bridge overclocking, I decided to investigate if the auto voltage setting was at the root of the thermal issues at 4.5 Ghz. And indeed it was. When I went into the bios and set a fixed 1.2 volt vcore, the system was definitely unstable (things locked up during stress testing, I got dumped out of my graphical desktop, and the kernel paniced -- can't get much more unstable than that). With 1.25 volts things were still not stable. This time the mprime stress test reported some unexpected numerical issues and declared my system sick.

Results with a stock fan and stock settings

I am done with overclocking the i7, and have transferred my fancy heat sink to my i5-2500K, where I think I will be more satisfied by what I can accomplish. Since I have gotten familiar with monitoring tools, I was curious what stress testing with the stock fan and settings would show me.

It was a surprise. First when running an 8 thread stress test, the CPU ran at 3.7 Ghz on all cores and temperatures rose to 81C -- pretty much the target limit, so there won't be much room to push things with the stock fan (but pushing to 4.0 Ghz showed the same temperatures as 3.7 with the fancy fan, so maybe I should give it a go?). Much more encouraging though was a single thread stress test. Here the CPU ran at 3.9 Ghz thanks to turbo boost, and temperatures were only hitting 62C for the busy core. This is the mode I am most likely to push the CPU on anyway (single core), so I think stock settings are fine for this system. It will run cool, last long, and be impressive at 3.7 or 3.9 Ghz.

Analysis of my i7-3770K overclocking

All in all I would call it a bust.

First of all, it is amazing what you learn from monitoring tools. I would never have known that most of the time my 3.5 Ghz CPU is running at 1.6 Ghz. And I would never have known that it will happily run at 3.7 Ghz across all cores via turbo boost. I had expected a single core to go to 3.9 Ghz -- and that is probably the most useful number given the applications I run.

With a good heat sink I see temperatures as high as 73C at stock settings (with Turbo Boost this is 3.7 Ghz on all cores). I can bump the multiplier to 4.0 Ghz and temperatures get no higher than they did with stock settings, so I can get the jump from 3.7 to 4.0 "for free". It will be curious to see if I can do the same with the stock fan.

The attempt to get 4.5 Ghz, while apparently stable, was running hotter than I was willing to accept. If I was hell bent to run this fast, I might be able to get the temperatures down, but I don't see the point and don't think the money is well spent. I think this just confirms what I have been reading - the Ivy Bridge chips have thermal issues that are the limiting factor.

What I intend to do at this point is to swap my Hyper 212 heatsink onto my Sandy Bridge i5-2500K and see what results I can get with it.


Have any comments? Questions? Drop me a line!