[Nauty-list] Multithreading

Matthew Skala mskala at cs.umanitoba.ca
Fri Jan 13 05:38:01 EST 2012


On Thu, 12 Jan 2012, Susanne Niess wrote:
> Could you please also send me the make file to apply the changes to the files
> in nauty? I applied it to several of them by hand and then couldn't compile
> them, so something must still be wrong. My includes are
> #include "../nau/naututil.h"
> #include "../nau/nauty.h"
> #include "../nau/gtools.h"
> and my compiling script contains
> ../nau/nauty.o ../nau/nautil.o ../nau/naututil.o ../nau/naugraph.o
> ../nau/nausparse.o ../nau/rng.o ../nau/gtools.o

Attached are a small Makefile and a modified version of mkts.  You will
also need to change whatever other Makefile you're using so that it will
link with, and depend on, files named tnauty.c instead of nauty.c,
tnauty.o instead of nauty.o, and so on.  If you need more help, I'd
suggest we take this discussion off-list, because it'll be primarily a
question of getting your compiler to read the modified files rather than
anything nauty-specific.

> asked back because I could not think of a possibility to run more than one
> nauty in one thread at the same time (as nauty itself does not call itself

It's possible but tricky - the callback situation might be the most likely
way it might happen, if you tried to define a user-defined refinement
procedure or similar that itself invoked nauty.  I could imagine someone
attempting that even if it might not be a good idea, and it would raise
re-entrancy problems.
-- 
Matthew Skala
Postdoctoral Fellow, University of Manitoba
mskala at cs.umanitoba.ca
-------------- next part --------------
#!/usr/bin/perl

$tlkw=shift;

print "/* DO NOT EDIT THIS FILE - it is automatically generated. */\n";

while (<>) {
   s/(#include\s+"[^\"]*)nauty.h"/$1"tnauty.h"/g;
   s/(#include\s+"[^\"]*)naututil.h"/$1"tnausparse.h"/g;
   s/(#include\s+"[^\"]*)gtools.h"/$1"tgtools.h"/g;
   
   s/(static\s+)
     (FILE|boolean|dispatchvec|graph|int|long|permutation|
        set|short|shortish|size_t|statsblk|tcnode|type|unsigned)
     (\s+[^(;,=]+[;,=])
    /$1$tlkw\ $2$3/gx;

   print;
}
-------------- next part --------------
t%.h: %.h mkts
	./mkts '__thread' $< > $@

t%.c: %.c mkts
	./mkts '__thread' $< > $@



More information about the Nauty mailing list