32 bit and 64 bit

Discussion of chess software programming and technical issues.

Moderator: Ras

hawkeye
Posts: 62
Joined: Thu Apr 03, 2008 8:54 pm

32 bit and 64 bit

Post by hawkeye »

can older engines written for 32 bit be run under 64 bit systems without problems?
User avatar
Onno Garms
Posts: 224
Joined: Mon Mar 12, 2007 7:31 pm
Location: Bonn, Germany

Re: 32 bit and 64 bit

Post by Onno Garms »

Yes, normally even without recompile.

If you recompile you can expect to win 0-100% of speed, depending on the style in that the engine was written. Bitboard engines win more then mailbox engines.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: 32 bit and 64 bit

Post by Carey »

Under Windows, yes. Win64 can run all Win32 programs, with the exception of some drivers etc. But regular user programs will work. Windows uses a layer called 'WoW' (Windows on Windows) to take care of that.

Under Linux. Don't know. Somebody else will have to answer. But I would certainly expect it to be able to.


If you are talking about compiling the 32 bit program into 64 bit code, then the odds are good that you can't unless it's been designed for that or its very generic.

Data sizes can be a killer at times. Programmers expect 'int' to be a certain size (32 bits) and programs can often croak when it's moved to a system with a different size.

Many simple programs will compile & run okay (like old mailbox programs, for example) but take more memory than they need.

But more complicated or better tweaked programs may barf. They may depend on data being specific sizes.
hawkeye
Posts: 62
Joined: Thu Apr 03, 2008 8:54 pm

Re: 32 bit and 64 bit

Post by hawkeye »

thanks
User avatar
Onno Garms
Posts: 224
Joined: Mon Mar 12, 2007 7:31 pm
Location: Bonn, Germany

Re: 32 bit and 64 bit

Post by Onno Garms »

In deed, some badly written programs will require some effort to port their source to 64 bit. But:
- Visual Studio prints warnings in 32-bit-compile on every line of code that will not work in 64-bit mode.
- for example Toga compiles on 64 bit without problems (but isn't much faster, if at all)
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: 32 bit and 64 bit

Post by Carey »

Onno Garms wrote:In deed, some badly written programs will require some effort to port their source to 64 bit. But:
- Visual Studio prints warnings in 32-bit-compile on every line of code that will not work in 64-bit mode.
- for example Toga compiles on 64 bit without problems (but isn't much faster, if at all)
It's more subtle than that.

VC (& other compilers or LINT programs) can flag obvious code issues, but it can't judge what the author was wanting to do.

Something like

Code: Select all

z=1;
 while (z)
  {
   z = z << 1;
   do stuff
  }
may fail horribly.

Under a 64 bit system the loop will execute way too many times because the programmer was depending on the shift rolling over to zero after the 32nd bit.

Plus there are issues as to whether the compiler just happens to do 'in't as 32 bits or 64 bits. Or maybe the author used 'long int' because he thought it was guaranteed to be the full 32 bits.

So not only do you have to worry about the code itself, you also have to worry about what the programmer intended.

The author using uint32_t and so on can actually go a long way to making sure the program will keep working in the future. And it's a good start for porting a 32 bit program to 64 bit systems.