Another way to “speed up” your chess engine (Fritz, Rybka, Hiarcs, Junior, or Shredder) is through the use of transposition tables, also known as hash tables. Proper use of these tables doesn’t actually make your chess engine analyze any faster (it’ll still evaluate the same number of positions per second), but you will get deeper searches in the time you allot to the analysis, because transposition tables ensure that the engine won’t waste time by re-evaluating board positions which have already been evaluated earlier in the search.
Here’s a simple example. Consider the following chess opening variations:
1.e4 e5 2.Nf3 Nf6 3.Nc3 Nc6
1.e4 e5 2.Nc3 Nc6 3.Nf3 Nf6
1.e4 e5 2.Nf3 Nc6 3.Nc3 Nf6
1.e4 Nc6 2.Nc3 e5 3.Nf3 Nf6
1.Nf3 Nc6 2.e4 e5 3.Nc3 Nf6
Five separate variations, but if you play them out you’ll see that they all wind up at the same place:
All five (and I could have listed more) of these variations end up at the same position, and an engine would therefore give all five variations the same evaluation (since the ending position is exactly the same). So wouldn’t it be a waste of time to analyze the same exact position five times?
That’s why transposition (hash) tables are incredibly useful. They’re basically just simple storage: a chess engine stores the positions it’s already analyzed (along with their evaluations) in a special temporary file which is located in virtual RAM memory (instead of on the physical hard drive). If the engine reaches a position it’s already analyzed (via a different move order – a transposition of moves, as we saw in our example above), it will remember that position’s evaluation and not waste time analyzing it again. This ensures that the x thousand positions per second that the engine analyzes will be new positions which haven’t already been analyzed. The engine isn’t really analyzing any faster (it’s still the same kN/s speed), but the engine will analyze more deeply because many, many positional evaluations will already be stored in temporary memory.
So how do you properly set up these hash tables? If you’re setting up an analysis using one of the playing programs (Fritz12, Rybka4, etc.), hit the F3 key while in the main (chessboard) screen to bring up the engine selection dialogue:
In ChessBase 11, you can get to a similar dialogue by opening a board window and clicking the “Add kibitzer” button.
Select your engine from the scrolling list, then use the “Hashtable size” section of the dialogue to select how much RAM you wish to use for the hashtables.
Before we discuss the value you should set, we’ll mention the three ways you can set a value in this dialogue. You can type a value into the box provided or use the up and down arrow buttons to the left of that box to increase or decrease the value (which is very slow, except for fine-tuning the number). The third method is to click the arrow button on the right side of the value box to select from a menu of preset values:
What kind of value should you set? Notice that there is an entry in this dialogue for the maximum setting (to the right of the white box used for entering a size for the hash tables). Don’t set the value to the maximum! You have other processes on your computer which may need to utilize RAM.
Instead set the value to about three-fourths (that’s 75% for those on the metric standard) of the listed available RAM. Test the setting (in Fritz, etc.) by clicking “OK” to close the dialogue and then clicking the “Infinite analysis” button; in ChessBase, just click “OK” to close the dialogue – the analysis will start automatically. Wait a few minutes, then check to see if your hard drive light on your computer (the box itself, not the monitor) is flickering while the computer is making a clicking sound. If you’re getting this flashing/clicking, it means that the hash table value is set too high and your chess engine is using free hard drive space for some of the hash tables. Since hard disk access is much slower than RAM access, this pretty much defeats the whole purpose of the hash tables to begin with, and you’ll need to experiment with smaller hash table size settings until you find a value that doesn’t cause this frantic hard drive access.
On the other hand, if you test the value and don’t get the hard drive access, it means that the value you’ve set is OK. If you wish, you can try setting the hashtables to a larger value. Keep experimenting until you hit a value which causes the hard disk access described above, then start lowering the value a little at a time until you find a hashtable size which doesn’t cause your hard drive to start banging – make a note of this value (in case the software resets it between sessions) and use it from now on.
You’ll recall in the last blog post we mentioned how you shouldn’t run other programs while your chess engine (Fritz, Rybka, etc.) is analyzing a game; these other programs will use part of your computer’s processing power. The same idea also applies to the amount of RAM available for hash tables; other software running on your computer will use some portion of RAM and thus limit your maximum hash table size (without hard disk access occurring).
So to get the best possible analysis in the time you’ve allotted for your chess engine to analyze a position, make sure you aren’t running other programs on your computer and set the hash table size to the largest value you can (without having your hard drive start clicking away).
Have fun! – Steve Lopez
Chessplayers who have purchased their ChessBase brand software from USCFSales can receive free technical support and advice on their purchases straight from me; just shoot me an e-mail (email@example.com), but please remember to include the USCFSales order number from your ChessBase software purchase. – Steve
Copyright 2011, Steven A. Lopez. All rights reserved.