users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MAX_ATOM, ATOM_SIZE, etc


From: Daniel Diaz
Subject: Re: MAX_ATOM, ATOM_SIZE, etc
Date: Tue, 28 Mar 2006 00:49:34 +0200
User-agent: Thunderbird 1.5 (Windows/20051201)

Hi Duncan is right,

I post something about this I sent sometimes ago (some line numbers can be out of date but the principle remains):

1) You need to uncompress the source distribution. Go to src/EnginePl:

   $ cd ..../src/EnginePl

The size of the table must be a power of 2, it is currently 2^16 (so 65536 atoms are allowed), I suppose here you change to 2^17 (providing 131072 atoms).

2) modify pl_params.h:33 with the value of the power of 2, e.g.:

#define ATOM_SIZE                  17

If you use another value than 17 you should also do steps 3, 4, 5. If you use 17 they are useless, so go directly to 6.

3) compile euclide.c using

   $ gcc -o euclide euclide.c

4) execute:

   $ ./euclide 67 131072 (if 131072 is the size you want)

the following result is shown (for 131072):

   Res: 19563      i.e. (1/67) % 131072 = 19563
                   i.e. (67*19563) % 131072 = 1

5) modify atom.c:59 with the value shown by euclide, e.g.

#define INV_RADIX_MOD_MAX_ATOM     19563

(NB for the value 131072 the value is the same as for 65536)

6) redo the whole (eventually with a ./configure if not yet done):

   $ cd ..                 (i.e. go to ..../src)
   $ ./configure [OPTIONS] (if not yet done)
   $ . SETVARS
   $ make clean            (if a version is already compiled)
   $ make

7) try the top-level:

   $ gprolog               (or TopComp/gprolog)
   GNU Prolog 1.2.18
   By Daniel Diaz
   Copyright (C) 1999-2003 Daniel Diaz
   | ?- current_prolog_flag(max_atom,X).

   X = 131072

8) If you use antoher value than 17 you can have an error message like:

Fatal Error: atom: invalid ATOM_NIL (should be 1766)

In that case, modify src/EnginePl/atom.h:57 with the value displayed by the message, e.g.:

#define ATOM_NIL                  1766

(NB: for the value 131072 the value is also the same as for 65536).

redo a make clean followed by a make in the src directory.

9) finally install your modified version:

   $ make install



Duncan Patton a Campbell a écrit :
[howto go]> about recompiling to expand the
65k limit on the Gprolog atom table, but there are no further references.

How do I go about doing this?  Is this currently possible or is some
other mechanism prefered?
Thanks,

Duncan (Dhu) Campbell

Since I couldn't find it in the docs (not that it isn't there;)
here are my hacks..

in gprolog-1.2.19/src/EnginePl

        ./atom.c: (@line 59)

#define RADIX                      67
//Dhu #define INV_RADIX_MOD_MAX_ATOM     19563  /* see prog. euclide.c */
//#define INV_RADIX_MOD_MAX_ATOM     281707     /* see prog. euclide.c */
//Dhu ./euclide 67 2097152 ==> 281707.
// 1 << 21 = 2097152 ==> ATOM_SIZE in gprolog.h
//#define INV_RADIX_MOD_MAX_ATOM     61099115   /* see prog. euclide.c */
#define INV_RADIX_MOD_MAX_ATOM     10767467     /* see prog. euclide.c */

        ./pl_params.h: (@line 33)

//Dhu ATOM_SIZE was 16  -- 65536, 21 gives 2097152, with hash of 281707
//Dhu ATOM_SIZE was 16  -- 65536, 24 gives 16777216, with hash of 10767467
#define ATOM_SIZE                  24
#define MAX_ATOM                   (1 << ATOM_SIZE) /* number of elements */

        ./gprolog.h: (@line 226)

//Dhu ATOM_SIZE was 16  -- 65536, 21 gives 2097152, with hash of 281707
//Dhu ATOM_SIZE was 16  -- 65536, 24 gives 16777216, with hash of 10767467
#define ATOM_SIZE                  24
#define MAX_ATOM                   (1 << ATOM_SIZE) /* number of elements */

Dhu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]