Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Not A Blast Re: Where are 64 bits machine?

Author: Matthew Hull

Date: 20:26:15 03/18/03

Go up one level in this thread


On March 18, 2003 at 22:47:12, Brian Richardson wrote:

>On March 18, 2003 at 20:27:12, Matthew Hull wrote:
>
>>On March 18, 2003 at 18:14:02, Brian Richardson wrote:
>>
>>>On March 18, 2003 at 18:09:52, Robert Hyatt wrote:
>>>
>>>>On March 18, 2003 at 17:47:49, Tom Kerrigan wrote:
>>>>
>>>>>On March 18, 2003 at 16:57:17, Brian Richardson wrote:
>>>>>
>>>>>>I have a dual Itanium2 1GHz system.  Perhaps you forgot my earlier post.
>>>>>>With the optimizing compilers (tried both Intel and Microsoft), it runs
>>>>>>Tinker at about 2GHz Pentium speed (x86 binary code at only 30%).
>>>>>>
>>>>>>Has anyone been able to reproduce your (Eugene's?) results showing MUCH faster
>>>>>>Itanium2 performance?
>>>>>
>>>>>*sigh* Like I've always said, Crafty is not your typical chess program.
>>>>>
>>>>>-Tom
>>>>
>>>>
>>>>There we agree.  Itanium is all about moving data around in large quantities.
>>>>32 bit programs won't necessarily benefit at all, and may well be a lot slower
>>>>in fact...
>>>>
>>>>However, this is also true of many other machines.  Many folks drop their
>>>>favorite
>>>>program on a Cray expecting blinding performance and don't get it, because they
>>>>can't
>>>>use the vector hardware.
>>>
>>>Of course, I ran both Crafty and Tinker (also bitboard based).
>>>The results were the same.  I even tried a small hash table size
>>>to fit all of Tinker in the 3MB cache...it sped things up about 10%,
>>>but still way below fast 32bit Intel and AMD CPUs.
>>
>>
>>Did you tweak the "defines" in Makefile and chess.h and utility.c?  You must
>>tell the code that the machine can do real 64 bits, not just longlong.
>>
>>Matt
>
>No, I think that should be up to the compiler.
>"__int64" is "real" 64 bits.  How it is implemented is up to the compiler.


Somewhere you must define "HAS_64BITS".  Otherwise the 32 bit workarounds get
included instead of the 64 bit stuff.

If you look at the Alpha target in Makefile (Alpha is a true 64 bit machine), it
sets "target=ALPHA".  Then in chess.h you find the following:

#if defined(ALPHA)
#  define HAS_64BITS           /* machine has 64-bit integers / operators     */
#  undef  HAS_LONGLONG         /* machine has 32-bit/64-bit integers          */
#  define UNIX                 /* system is unix-based                        */
#endif

The Makefile sets all this up with specific targets.  There is no target in
Makefile for Itanium.  You could start by cloning the "Generic" target in and
adding a "target=ITANIUM" to that section.  Make sure the Itanium target
directive is inserted _before_ the generic target.  It might look like this:

[I'm assuming linux, but you can make it whatever you  want]

linux-itanium:
        $(MAKE) target=ITANIUM \
                CC=gcc CXX=g++ \
                CXFLAGS=$(CFLAGS) \
                LDFLAGS=$(LDFLAGS) \
                crafty-make

Then you would need to modify chess.h to include the following

#if defined(ITANIUM)
#  define HAS_64BITS           /* machine has 64-bit integers / operators     */
#  undef  HAS_LONGLONG         /* machine has 32-bit/64-bit integers          */
#  define UNIX                 /* system is unix-based                        */
#endif

Assuming of course that it's Linux (define UNIX).

Also some logic in utility.c probably needs to be changed.  There is a section
that looks like this:

#  if !defined(LINUX) && !defined(ALPHA) && !defined(HP) && !defined(CRAY1) && !
defined(FreeBSD) && !defined(NetBSD) && !defined(__EMX__)

You would tack on the ITANIUM check so it would look like this:

#  if !defined(LINUX) && !defined(ALPHA) && !defined(HP) && !defined(CRAY1) && !
defined(FreeBSD) && !defined(NetBSD) && !defined(__EMX__) && !defined(ITANIUM)

This prevents some bogus includes that would break the compile under Linux.

Now you are ready for a bargain basement compile.

make linux-itanium

If that works, then run "bench".

Next try adding some of the optimizations that the other targets use like
-DCOMPACT_ATTACKS or CFLAGS like -O2, etc. and run bench again.


The bottom line is that HAS_64BITS needs to be defined, otherwise the
made-for-32-bit-machine code segements will get compiled instead of the 64 bit
ones.

Hope that helps,
Matt



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.