ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

Adapting gfind

For scripts to aid with computation or simulation in cellular automata.

Re: Adapting gfind

Postby wildmyron » August 9th, 2019, 12:54 am

I think it's clear what needs to be done with gfind to support nt rules - just that nobody other than Paul Tooke has decided to put in the effort to do so (and publish the result of that effort).

LaundryPizza03 wrote:Should I use the version in the OP in the meantime?

Considering how long we've all been waiting for someone else to do this, I'd say yes. :P
The latest version of the 5S Project contains over 196,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1209
Joined: August 9th, 2013, 12:45 am

Re: Adapting gfind

Postby LaundryPizza03 » August 10th, 2019, 3:23 am

wildmyron wrote:I think it's clear what needs to be done with gfind to support nt rules - just that nobody other than Paul Tooke has decided to put in the effort to do so (and publish the result of that effort).

LaundryPizza03 wrote:Should I use the version in the OP in the meantime?

Considering how long we've all been waiting for someone else to do this, I'd say yes. :P

Which version of Hensel notation does it use?

EDIT: Also, how do I compile it?
x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!

LaundryPizza03 at Wikipedia
User avatar
LaundryPizza03
 
Posts: 457
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Adapting gfind

Postby wildmyron » August 13th, 2019, 8:33 am

Sorry, I think I wasn't entirely clear. Paul Tooke hasn't published the work he did on adapting gfind for non-totalistic rules (at least not that I'm aware of and definitely not here).
The latest version of the 5S Project contains over 196,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1209
Joined: August 9th, 2013, 12:45 am

Re: Adapting gfind

Postby LaundryPizza03 » August 13th, 2019, 8:46 pm

wildmyron wrote:Sorry, I think I wasn't entirely clear. Paul Tooke hasn't published the work he did on adapting gfind for non-totalistic rules (at least not that I'm aware of and definitely not here).

I mean the script in the OP, gfind-pt.c.
x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!

LaundryPizza03 at Wikipedia
User avatar
LaundryPizza03
 
Posts: 457
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Adapting gfind

Postby wildmyron » August 13th, 2019, 10:30 pm

LaundryPizza03 wrote:
wildmyron wrote:Sorry, I think I wasn't entirely clear. Paul Tooke hasn't published the work he did on adapting gfind for non-totalistic rules (at least not that I'm aware of and definitely not here).

I mean the script in the OP, gfind-pt.c.

Sorry, I misunderstood. To compile gfind-pt.c under Cygwin or "Linux on WSL" you should comment out the defines for PATCH01 and PATCH02 and use something like the following command to compile:
gcc -O3 -funroll-loops -march=native -o gfind-pt gfind-pt.c

Also, looking over the thread it seems I've misremembered. Paul Tooke did of couse publish his kludged Just Friends version of gfind, it was a more generalized NT version of gfind which hasn't been published.
The latest version of the 5S Project contains over 196,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1209
Joined: August 9th, 2013, 12:45 am

Re: Adapting gfind

Postby LaundryPizza03 » August 14th, 2019, 1:04 am

wildmyron wrote:
LaundryPizza03 wrote:
wildmyron wrote:Sorry, I think I wasn't entirely clear. Paul Tooke hasn't published the work he did on adapting gfind for non-totalistic rules (at least not that I'm aware of and definitely not here).

I mean the script in the OP, gfind-pt.c.

Sorry, I misunderstood. To compile gfind-pt.c under Cygwin or "Linux on WSL" you should comment out the defines for PATCH01 and PATCH02 and use something like the following command to compile:
gcc -O3 -funroll-loops -march=native -o gfind-pt gfind-pt.c

Also, looking over the thread it seems I've misremembered. Paul Tooke did of couse publish his kludged Just Friends version of gfind, it was a more generalized NT version of gfind which hasn't been published.

I still can't compile it. What do -funroll and -loops do?
gfind-pt.c:482:12: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
    printf(timeStr);
           ^~~~~~~
gfind-pt.c:482:12: note: treat the string as an argument to avoid this
    printf(timeStr);
           ^
           "%s",
gfind-pt.c:491:35: warning: implicitly declaring library function 'memset' with
      type 'void *(void *, int, unsigned long)'
      [-Wimplicit-function-declaration]
void resetHash() { if (hash != 0) memset(hash,0,4*HASHSIZE); }
                                  ^
gfind-pt.c:491:35: note: include the header <string.h> or explicitly provide a
      declaration for 'memset'
gfind-pt.c:610:31: warning: '&&' within '||' [-Wlogical-op-parentheses]
                if (x >= qTail || !EMPTY(x) && PARENT(x) >= y) y = x;
                               ~~ ~~~~~~~~~~^~~~~~~~~~~~~~~~~
gfind-pt.c:610:31: note: place parentheses around the '&&' expression to silence
      this warning
                if (x >= qTail || !EMPTY(x) && PARENT(x) >= y) y = x;
                                            ^
                                  (                          )
gfind-pt.c:629:54: warning: format specifies type 'int' but the argument has
      type 'node' (aka 'unsigned long') [-Wformat]
                printf("Exceeded %d node limit, search aborted\n", QSIZE);
                                 ~~                                ^~~~~
                                 %lu
gfind-pt.c:364:15: note: expanded from macro 'QSIZE'
#define QSIZE ((node) (1<<qBits))
              ^~~~~~~~~~~~~~~~~~~
gfind-pt.c:810:15: warning: using the result of an assignment as a condition
      without parentheses [-Wparentheses]
        if (fp=fopen(dumpFile,"r"))
            ~~^~~~~~~~~~~~~~~~~~~~
gfind-pt.c:810:15: note: place parentheses around the assignment to silence this
      warning
        if (fp=fopen(dumpFile,"r"))
              ^
            (                     )
gfind-pt.c:810:15: note: use '==' to turn this assignment into an equality
      comparison
        if (fp=fopen(dumpFile,"r"))
              ^
              ==
gfind-pt.c:824:23: warning: format specifies type 'unsigned int' but the
      argument has type 'unsigned long' [-Wformat]
    fprintf(fp,"%u\n",FILEVERSION);
                ~~    ^~~~~~~~~~~
                %lu
gfind-pt.c:791:21: note: expanded from macro 'FILEVERSION'
#define FILEVERSION ((unsigned long) 2000102901)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gfind-pt.c:836:23: warning: format specifies type 'unsigned int' but the
      argument has type 'unsigned long' [-Wformat]
    fprintf(fp,"%u\n",qHead-qStart);
                ~~    ^~~~~~~~~~~~
                %lu
gfind-pt.c:837:23: warning: format specifies type 'unsigned int' but the
      argument has type 'unsigned long' [-Wformat]
    fprintf(fp,"%u\n",qEnd-qStart);
                ~~    ^~~~~~~~~~~
                %lu
gfind-pt.c:858:16: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
                printf("%d", n);
                        ~~   ^
                        %ld
gfind-pt.c:862:29: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
        if (n >= 100) printf("%d", n/10);
                              ~~   ^~~~
                              %ld
gfind-pt.c:863:23: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
        else printf("%d.%d", n/10, n%10);
                     ~~      ^~~~
                     %ld
gfind-pt.c:863:29: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
        else printf("%d.%d", n/10, n%10);
                        ~~         ^~~~
                        %ld
gfind-pt.c:1220:30: warning: operator '<<' has lower precedence than '+'; '+'
      will be evaluated first [-Wshift-op-parentheses]
                                srows[i] = r << MAXWIDTH + 1;
                                             ~~ ~~~~~~~~~^~~
gfind-pt.c:1220:30: note: place parentheses around the '+' expression to silence
      this warning
                                srows[i] = r << MAXWIDTH + 1;
                                                ~~~~~~~~~^~~
13 warnings generated.
Undefined symbols for architecture x86_64:
  "_enqueue", referenced from:
      _doCompactPart2 in gfind-pt-00bdf1.o
      _findPaths in gfind-pt-00bdf1.o
      _search in gfind-pt-00bdf1.o
  "_isVisited", referenced from:
      _findPaths in gfind-pt-00bdf1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!

LaundryPizza03 at Wikipedia
User avatar
LaundryPizza03
 
Posts: 457
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Adapting gfind

Postby wildmyron » August 14th, 2019, 3:43 am

Oh, for clang you need to change function definitions with "inline" to "static inline". Eg:

change
inline long hashFunction(node b, row r) {

to
static inline long hashFunction(node b, row r) {

and the same for all the other function definitions with inline. Ref: viewtopic.php?p=29612#p29612 and https://github.com/conwaylife/gfind/com ... b58fe57b67 for example of this change applied to the original gfind.c

"-funroll-loops" is an optimization flag. I'm not sure that it helps with gfind performance so you can safely omit it from the compile command.
The latest version of the 5S Project contains over 196,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1209
Joined: August 9th, 2013, 12:45 am

Re: Adapting gfind

Postby LaundryPizza03 » August 16th, 2019, 6:32 am

So how do I run a non-totalistic rule?

EDIT1: And how do I process the dump files?

EDIT2: I've figured out how to dump files.
x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!

LaundryPizza03 at Wikipedia
User avatar
LaundryPizza03
 
Posts: 457
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Adapting gfind

Postby wildmyron » August 16th, 2019, 12:23 pm

LaundryPizza03 wrote:So how do I run a non-totalistic rule?

You can't run searches in non-totalistic rules with gfind-pt.c without modification, i.e. combining the "latest gfind hack" EricG with the patches to gfind in gfind-pt.c

I'm confused why you are asking this question, but I guess I haven't been clear.
The latest version of the 5S Project contains over 196,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1209
Joined: August 9th, 2013, 12:45 am

Previous

Return to Scripts

Who is online

Users browsing this forum: No registered users and 1 guest