Coder Social home page Coder Social logo

Comments (7)

pmoura avatar pmoura commented on August 20, 2024

Cannot reproduce on macOS 13.4 using the latest git version (7adebe2):

$ GLOBALSZ=160154120 gprolog
GNU Prolog 1.6.0 (64 bits)
Compiled May  1 2023, 23:01:09 with /opt/local/bin/gcc-mp-12
Copyright (C) 1999-2023 Daniel Diaz

| ?- 

from gprolog.

flexoron avatar flexoron commented on August 20, 2024

Linux 6.3.4
Glibc 2.37 (Stable, Feb 2023)
Git: commit 7adebe2

GCC 13.1.1

	-------------------------------
	--- GNU PROLOG INSTALLATION ---
	-------------------------------

GNU Prolog version: 1.6.0 (Jun  2 2023)
Operating system  : linux-gnu
Processor         : x86_64
Size of a WAM word: 64 bits
C compiler        : gcc
C flags           : -O3 -fomit-frame-pointer -Wno-char-subscripts
C flags machine   :  -fno-strict-aliasing -fcommon
Assembler         : as
Assembler flags   : --64
Loader flags      : 
Loader libraries  : -lm
Use line editor   : Yes
Use piped consult : Yes
Use sockets       : Yes
Use FD solver     : Yes
Use machine regs. : Yes (4 used)
Used register(s)  : r12 (pl_reg_bank)  r13 (TR)  r14 (B)  r15 (H)
CLANG 16.0.1

	-------------------------------
	--- GNU PROLOG INSTALLATION ---
	-------------------------------

GNU Prolog version: 1.6.0 (Jun  4 2023)
Operating system  : linux-gnu
Processor         : x86_64
Size of a WAM word: 64 bits
C compiler        : clang
C flags           : -O3 -fomit-frame-pointer -Wno-char-subscripts
C flags machine   :  -fno-strict-aliasing -fcommon
Assembler         : as
Assembler flags   : --64
Loader flags      : 
Loader libraries  : -lm
Use line editor   : Yes
Use piped consult : Yes
Use sockets       : Yes
Use FD solver     : Yes
Use machine regs. : Yes (0 used)
Used register(s)  : none

Diff: clang does not use registers which means what?

Both:
$ GLOBALSZ=160154120 gprolog
Fatal Error: Memory allocation fault

from gprolog.

flexoron avatar flexoron commented on August 20, 2024

In contrast:
$ tar xf gprolog-1.5.0.tar.gz
$ cd gprolog-1.5.0/src
$ ./configure && make

	-------------------------------
	--- GNU PROLOG INSTALLATION ---
	-------------------------------

GNU Prolog version: 1.5.0 (Jun  4 2023)
Operating system  : linux-gnu
Processor         : x86_64
Size of a WAM word: 64 bits
C compiler        : gcc
C flags           : -O3 -fomit-frame-pointer -Wno-char-subscripts
C flags machine   :  -fno-strict-aliasing -fcommon
Assembler         : as
Assembler flags   : --64
Loader flags      : 
Loader libraries  : -lm
Use line editor   : Yes
Use piped consult : Yes
Use sockets       : Yes
Use FD solver     : Yes
Use machine regs. : Yes (4 used)
Used register(s)  : r12 (pl_reg_bank)  r13 (TR)  r14 (B)  r15 (H)  

$ cd TopComp
$ GLOBALSZ=160154120 ./gprolog
GNU Prolog 1.5.0 (64 bits)
Compiled Jun 4 2023, 17:37:10 with gcc
Copyright (C) 1999-2023 Daniel Diaz

| ?-

from gprolog.

didoudiaz avatar didoudiaz commented on August 20, 2024

The amount of memory you can use depends on your architecture (even with virtual memory): thus macos can be different from linux.
In 1.6.0, I have increased the default size of all stacks (but I don't believe this explain the memory fault).
Note that you are asking a lot of memory (size are in KB). 160154120 KB is around 150 GB !
Anyway, can you report the result of statistics/0, once you have launched 1.5.0 with your GLOBASZ=160154120 ?
About global registers: clang does not allow to specify that a global variable resides in a processor register (gcc does allow it).

from gprolog.

flexoron avatar flexoron commented on August 20, 2024
$ GLOBALSZ=160154120 ./gprolog 
GNU Prolog 1.5.0 (64 bits)
Compiled Jun  4 2023, 17:37:10 with gcc
Copyright (C) 1999-2023 Daniel Diaz

| ?- statistics.
Memory               limit         in use            free

   trail  stack      16383 Kb            0 Kb        16383 Kb
   cstr   stack      16384 Kb            0 Kb        16384 Kb
   global stack     770567 Kb            2 Kb       770565 Kb
   local  stack      16383 Kb            0 Kb        16383 Kb
   atom   table      32768 atoms      1770 atoms     30998 atoms

Times              since start      since last

   user   time       0.001 sec       0.001 sec
   system time       0.001 sec       0.001 sec
   cpu    time       0.002 sec       0.002 sec
   real   time      11.664 sec      11.664 sec

yes
| ?-

from gprolog.

didoudiaz avatar didoudiaz commented on August 20, 2024

This was I suspected. 1.5.0 allocates much less memory than asked (a bug).
This works for me in 1.6.0 (on a 64GB RAM machine):
GLOBALSZ=129431888 gprolog --init-goal 'statistics,halt'
(around 123 GB)

from gprolog.

flexoron avatar flexoron commented on August 20, 2024

Excellent! It makes sense.
Thank you very much.

Btw this config triggers a warning:

$ ./configure --without-doc-dir --without-html-dir --disable-regs --with-c-flags=debug
$ make
:
:
gcc -fno-strict-aliasing -fcommon -c -g -Wall -Wno-char-subscripts -funsigned-char terminal.c
terminal.c: In function ‘Parse_Env_Var’:
terminal.c:279:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  279 |   use_linedit = use_gui = use_ansi = true; /* default */
      |   ^~~~~~~~~~~
:
:
$

from gprolog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.