Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: optimizing probs

Author: Will Singleton

Date: 00:09:39 09/04/00

Go up one level in this thread


On September 03, 2000 at 20:21:39, William Bryant wrote:

>On September 03, 2000 at 13:19:49, Will Singleton wrote:
>
>>On September 03, 2000 at 11:38:04, William Bryant wrote:
>>
>>>On September 03, 2000 at 02:45:37, Will Singleton wrote:
>>>
>>>>On September 02, 2000 at 23:54:32, Jon Dart wrote:
>>>>
>>>>>Arasan has been a Windows-only program since its original release in
>>>>>1994. I now have a port of the chess engine (not the GUI) that runs
>>>>>under Linux using xboard. It is pretty much identical in terms of
>>>>>algorithms and evaluation to the released Windows version but has
>>>>>a few bug fixes and tweaks.
>>>>>
>>>>>One of the motivations for doing this port is that I've had a lot of
>>>>>problems with the Microsoft Visual C++ compiler. In fact Visual C++
>>>>>6.0 can't compile Arasan correctly using full optimization. I've been
>>>>>stuck on version 5.0 of VC++ for a while and even that requires some
>>>>>hacks to make it build right.
>>>>>
>>>><snip>
>>>>
>>>>I've never been able to compile mine with full optimization.  I can't tell if
>>>>it's due to some coding problem or if the compiler is just weird.  Or perhaps it
>>>>just chess progs that won't optimize. :)
>>>>
>>>>Will
>>>
>>>Will,
>>>
>>>Are you refering to compiling on Windows, or both Windows and Mac.
>>>
>>>Screamer always compiles with full optimizations without problems.
>>>Crafty chokes th compiler with the file 'options.c' which I compile
>>>on level 2 optimizations, the rest of the program on full opitmizations.
>>>
>>>William
>>>wbryant@ix.netcom.com
>>
>>Compiling on the Mac.  I use level 2.  When I go to 3 or 4, it will compile, but
>>then Amateur runs much slower.
>>
>>I didn't know you could set individual files to compile separately.  What's the
>>procedure for that?
>
>At the top of the file put:
>#pragma optimization 2
>
>or something along those lines -- this will override the default optimizataion
>
>At the end of the file set:
>
>#pragma optimization 4
>
>to return to maximium optimization.
>
>This is what I did with Crafty.
>

I used the pragma method to locate which code caused the slowdown.  I set
optimization to 4 (max) in the global prefs, then tried compiling various
procedures with opt=2.  I found that eval() was causing the slowdown.

Then I tried to isolate exactly what part of the extra optimizing was the
culprit.  It turns out it was opt_strength_reduction.  I cleared it for eval(),
and now things are working fine.  Apparently, strength_reduction replaces
multiplication instructions inside loops with addition code.  Have no idea why
this is a problem, unless the compiler is broken (not likely) or I'm doing
something odd with multiplication.

So with global opt=4, I've just speeded up by 12%.  Not bad for an hour's work.
Thanks, William.

Will



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.