[Nauty-list] 32 or 64 bit

Brendan McKay bdm at cs.anu.edu.au
Mon Apr 21 21:02:11 EST 2008


Let me start by correcting an error. The default value of WORDSIZE
is not determined by configure.  It is chosen by nauty.h using the
heuristic that WORDSIZE=64 if long ints have 64 bits and WORDSIZE=32
otherwise.

So I'm guessing your Sun has 32 bit longs normally.  If you use a
compiler switch that turns longs into 64 bits (which -m64 does in
gcc on many platforms), then a 64-bit nauty should result.

I should add a configuration option to override the WORDSIZE
heuristic, maybe something like --enable-wordsize=64.  (The
use of "enable-" is mandated by configure.)

Now let me address the general question, which is not simple.
When exactly should 64 bits be the default?

1. Efficiency at 64 bits does not depend on  a "64-bit O/S" or 
   64-bit addressing.  It depends critically on whether the cpu has
   hardware 64-bit integer instructions, and less critically on
   the width of the memory bus. How can these things be detected
   automatically?

2. Even on a machine with fast 64-bit arithmetic, nauty will usually
   handle small graphs (32 vertices or less) faster with WORDSIZE=32
   because more setwords will fit in the cache. Not to mention twice
   the memory for programs holding many small graphs.

So it isn't clear to me why what you want to happen automatically
should in fact happen automatically.

Brendan.

* Gordon Royle <gordon at csse.uwa.edu.au> [080421 18:03]:
> 
> On 21/04/2008, at 2:58 AM, Paul T. Darga wrote:
> 
> > I'm guessing that it has to do with the default compiler on the  
> > system, i.e. it's not so much a nauty thing as a Solaris thing.  I  
> > don't know off hand what flags you have to give Solaris compilers,  
> > but you can override what nauty puts in there with something like:
> >
> > $ make CFLAGS='-O4 -m64'
> >
> > Where I'm taking a stab that '-m64' puts the compiler in 64-bit  
> > mode.  Something like that.
> 
> Yes, there are compiler switches for gcc and indeed gcc -m64 works  
> fine for compiling a little test program.
> 
> And I can add it to CFLAGS and SAFECFLAGS in the makefile, and it  
> actually compiles nauty.
> 
> But the trouble is that nauty has already decided that WORDSIZE = 32  
> (maybe at the ./configure stage?) and so the compiler flag is too late  
> to have any effect...
> 
> I can "sort of" make it work by kludging it as follows
> 
> - add the line #define WORDSIZE 64 to the nauty-h.in
> - add -m64 to the CFLAGS and SAFECFLAGS
> - recompile
> 
> This works with only one or two warnings...
> 
> 
> But I don't like it... I really want to have it work automatically..
> 
> Cheers
> 
> Gordon
> 
> _______________________________________________
> Nauty-list mailing list
> Nauty-list at cs.anu.edu.au
> http://dcsmail.anu.edu.au/cgi-bin/mailman/listinfo/nauty-list




More information about the Nauty mailing list