Page 1 of 2

Why I won't Buy Rybka 5

Posted: Thu Jan 12, 2012 2:19 pm
by kingliveson
Will we finally be seeing a Linux binary?
<1% probability, but I hope you'll be able to use Wine/MicroWine again.

Vas
http://rybkaforum.net/cgi-bin/rybkaforu ... #pid390932

The days of accepting 2nd class citizenry are over. Wine is useless for chess engines because the decrease in speed is significant and makes it not worth it.

Re: Why I won't Buy Rybka 5

Posted: Sat Jan 14, 2012 1:18 am
by Uly
Switch to Windows, it doesn't have that problem.

Re: Why I won't Buy Rybka 5

Posted: Sat Jan 14, 2012 8:41 pm
by kingliveson
Uly wrote:Switch to Windows, it doesn't have that problem.
Vas is more than capable. I understand the Linux market (Desktop) is quite small, but still...and besides, all the cool authors are doing it. :)

An Operating System that can't differentiate A from a clearly is doing it wrong.

Re: Why I won't Buy Rybka 5

Posted: Sat Jan 14, 2012 9:09 pm
by Uly
So this is the comparison?

Linux: Can't run Windows programs natively and Wine slows down the chess engines.

Windows: Can't tell the difference between A and a.

Oh yeah, I know which one to choose :)

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 1:25 am
by hyatt
Uly wrote:So this is the comparison?

Linux: Can't run Windows programs natively and Wine slows down the chess engines.

Windows: Can't tell the difference between A and a.

Oh yeah, I know which one to choose :)

Wine doesn't "slow down the chess engines" at all. It is completely "uninvolved" until the engine wants to do I/O or graphics.

I am not sure where this particular "urban legend" comes from. I have run some very cpu-intensive things on wine with no issues at all, and no decrease in performance when compared to re-booting (on a dual-boot box) and running natively under windows...

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 1:47 am
by Richard Vida
hyatt wrote:
Uly wrote:So this is the comparison?

Linux: Can't run Windows programs natively and Wine slows down the chess engines.

Windows: Can't tell the difference between A and a.

Oh yeah, I know which one to choose :)

Wine doesn't "slow down the chess engines" at all. It is completely "uninvolved" until the engine wants to do I/O or graphics.

I am not sure where this particular "urban legend" comes from. I have run some very cpu-intensive things on wine with no issues at all, and no decrease in performance when compared to re-booting (on a dual-boot box) and running natively under windows...
I can confirm - applications that don't depend much on win32 api in time-critical stuff do perform rather well under wine. The windows build (MSVC + PGO) of Critter runs cca 2-3% faster under wine than the native GCC compile (Ubuntu/linaro + gcc 4.6.1). Intel compiler tops all of them by a small margin, but I am reluctant to use it as it may "unintentionally" generate code that performs sub-optimal on AMD cpus.

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 2:03 am
by Richard Vida
Richard Vida wrote:
hyatt wrote:
Uly wrote:So this is the comparison?

Linux: Can't run Windows programs natively and Wine slows down the chess engines.

Windows: Can't tell the difference between A and a.

Oh yeah, I know which one to choose :)

Wine doesn't "slow down the chess engines" at all. It is completely "uninvolved" until the engine wants to do I/O or graphics.

I am not sure where this particular "urban legend" comes from. I have run some very cpu-intensive things on wine with no issues at all, and no decrease in performance when compared to re-booting (on a dual-boot box) and running natively under windows...
I can confirm - applications that don't depend much on win32 api in time-critical stuff do perform rather well under wine. The windows build (MSVC + PGO) of Critter runs cca 2-3% faster under wine than the native GCC compile (Ubuntu/linaro + gcc 4.6.1). Intel compiler tops all of them by a small margin, but I am reluctant to use it as it may "unintentionally" generate code that performs sub-optimal on AMD cpus.
OTOH.. I must say that I do some ugly stuff just to make MSVC happy. Guess you need to be 'gentle' with your favorite girl^h^h^h^h compiler...

With MSVC i must write:

Code: Select all

  if (*board->queen_list<wtm>() != -1) {
      lp = board->queen_list<wtm>();
      do {
        from = Square(*lp);
        to_bb = attack_map[from] & target;
        serialize_captures(Queen(wtm));
        lp++;
      } while (*lp != -1);
    }
this is ugly like hell, but MSVC generates very fast code here... For GCC it is not necessary.
GCC output is exactly same as if I wrote:

Code: Select all

  lp = board->queen_list<wtm>();
  while (*lp != -1) {
    from = Square(*lp);
    to_bb = attack_map[from] & target;
    serialize_captures(Queen(wtm));
    lp++;
  };

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 3:01 am
by kingliveson
Here are some quick benchmarks for Critter 1.4 Linux/Native and Windows/Wine:

Native

Code: Select all

time: 59986 nodes: 335399440 evals: 252662019 knps: 5591
phash: 80.79% evalcache: 10.78% lazy: 38.04% eg_recog: 0
splits: 28627
Wine

Code: Select all

time: 59986 nodes: 309578917 evals: 233593356 knps: 5160
phash: 81.29% evalcache: 10.49% lazy: 37.74% eg_recog: 0
splits: 25870
Native

Code: Select all

time: 99986 nodes: 559984269 evals: 413473219 knps: 5600
phash: 80.95% evalcache: 11.49% lazy: 37.44% eg_recog: 2
splits: 50156
Wine

Code: Select all

time: 99986 nodes: 518032761 evals: 380642623 knps: 5181
phash: 80.75% evalcache: 11.45% lazy: 36.83% eg_recog: 0
splits: 43407
Native

Code: Select all

time: 199986 nodes: 1154964601 evals: 852760483 knps: 5775
phash: 81.35% evalcache: 11.33% lazy: 39.14% eg_recog: 2
splits: 66990
Wine

Code: Select all

time: 199986 nodes: 1064932281 evals: 790297153 knps: 5325
phash: 82.23% evalcache: 11.35% lazy: 38.83% eg_recog: 1
splits: 75969
As you can see, native is outperforming wine by ~8.5%. This is from bare-naked runs. Now when you include overhead produced by wine+GUI, it is really not worth it. These results are actually good compared to others that I've seen, and the slow-down is definitively not "urban legend," but real.

It is interesting however that Bob is advocating I buy Rybka 5. :P

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 3:39 am
by Richard Vida
kingliveson wrote:Here are some quick benchmarks for Critter 1.4 Linux/Native and Windows/Wine:
<snip>
Thanks for benchmarking. I know it sounds like heresy, but 1.4 had never seen any Linux on my computer. It was compiled/tested with VirtualBox on a Win64 host, so I had no idea what about its performance in native Linux. However, 1.2 was compiled/tested with genuine Linux and was indeed a bit slower than the Windows build on the same computer.

Critter is quite dependent on the compiler to be able to do link-time inlining, but I never managed to harness any gain from -lto with gcc :(
kingliveson wrote: It is interesting however that Bob is advocating I buy Rybka 5. :P
If R5 does not run on Linux it is already obsolete ;)

Re: Why I won't Buy Rybka 5

Posted: Sun Jan 15, 2012 4:22 am
by wgarvin
One option is to include all of your source files in a single file and compile that. Obviously it has some side effects (anonymous namespaces and static/internal-linkage symbols may conflict, and things like preprocessor macros can also cause problems) but if your codebase can accomodate it, it will generate code as good as LTCG because the compiler sees the whole engine as one translation unit.

To make it less thorny, you can leave out files that aren't critical and have ugly dependencies (on platform header files like windows.h for example).

Also: Is the GCC compiling with exceptions disabled?