OpenCL perft() Technical Issues

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Work unit handling

Post by sje »

Work unit handling

Oscar's operft driver program now understands processing work unit files as is needed for the perft(14) effort. While not yet running under OpenCL, the operft driver will correctly eat an entire work unit, build all the OpenCL input and output parameter blocks, and then calculate all the perft() values including the per-position product and the sum of products.

To help test this, I made a synthetic work unit with the 72,078 unique(4) positions and had operft run perft(4) on each position. The result:

Code: Select all

Record count read from WorkUnit: 72078
Creating 72078 sets of parameter blocks
Perft calculations started
Perft calculations completed
Sum of products: 84998978956
Which is perft(8).
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

And with the unique(5) position set

Post by sje »

And with the unique(5) position set

Operft is repeating the synthetic work unit test, this time with the 822,516 record unique(5) position set, calculating perft(5) for each record and then summing the products to form perft(10). The run is only about 6% complete; it will take a while to finish.

There are other ways to calculate perft(10), such as using the 96,400,068 record unique(7) set and calculating perft(3) for each record. It's all a matter of balance; more work done on one part means less work needed for the other.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

And with wu7.964

Post by sje »

Work unit wu7.984 has only 68 FEN records, making it a good choice for testing.

Running it through operft, the resulting file is byte-for-byte identical to the one produced by Symbolic. This is a good sign.

Sum of products: 3,559,610,440,957,581

The gzip versions of wu7.964 (before and after processing):
https://dl.dropboxusercontent.com/u/316 ... wu7.964.gz
https://dl.dropboxusercontent.com/u/316 ... 964.sum.gz
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Movies!

Post by sje »

Movies!

I've added a feature to Oscar to produce perft() movies. What is a perft() movie? It's an animated graphical display of the generation of a perft() result.

In Oscar's case, the movie produced is a very, very simple one: a long sequence of character data, composed mostly of ANSI ASCII escape sequences for terminal control. The movie is played by concatenating the move file directly onto a terminal emulator window.

By having the movie written to stdout or stderr instead of to a disk file, the movie can be viewed while it's being made.

At present, the movie shows only a chessboard using the ANSI eight color palette; white and green squares, white chessmen made from red letters, black chessmen made from blue letters. Each square is two characters wide and one character tall. A possible future enhancement would be to output the current variation as well. An update is made immediately after each Execute() and Retract() call.

Oscar knows enough to update only those squares which have had their content changed by a move; two squares for most moves, three for en passant, and four for castlings.

It works under Mac OS/X and Linux. It might work with Windows. And I'd guess it would work with an old style CRT color terminal if you could find one.

The movie would surely look better if it used images instead of characters. But as I have no talent with graphics, I'll leave that improvement to others.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

And with unique(5)

Post by sje »

Using the 822,518 FEN records from unique(5), operft calculated the perft(5) value for each and got:

Code: Select all

Sum of products: 69352859712417
Which is perft(10), another good sign.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Single thread Oscar on a 2.66 GHz Xeon

Post by sje »

Here are some benchmarks from single thread Oscar on a 2.66 GHz Xeon using a 2^24 element transposition table and with bulk counting.

I run these after every coding session to help detect any major screw-ups:

Code: Select all

gail:tmp sje$ ./operft -bt -d6
119060324   59.95 MHz
gail:tmp sje$ ./operft -bt -d7
3195901860   169.15 MHz
gail:tmp sje$ ./operft -bt -d8
84998978956   362.98 MHz
gail:tmp sje$ ./operft -bt -d9
2439530234167   615.85 MHz
gail:tmp sje$ ./operft -bt -d10
69352859712417   927.31 MHz
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: OpenCL perft() Technical Issues

Post by smatovic »

One challenge with OpenCL is the mechanism by which an OpenCL application is built. At present, I can do this only with Macs running Mac OS/X 10.7 or better. I may later need some assistance with building operftocl for Linux sys
Another option is to load and compile the OpenCL source during runtime on the client machine via "clBuildProgram". All modern AMD and Nvidia GPU drivers should include an OpenCL runtime environment, not sure what the latest state for CPUs or APUs is.

--
Srdja