From: Bruce Lambert
Subject: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <GWbl8.60169$Yv2.25245@rwcrnsc54>
I sometimes need to allocate very large data strucutres. The code causes
CLISP and CMUCL to crash when I give arguments greater than about 15000. On
ACL, using the excl:tenuring switch, it works fine up to 25000 or more. Here
is the code:

(defun make-sim-matrix (num-docs)
  "Makes sim matrix as vector of vectors."
  (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
               (type (integer 0 65535) num-docs))
  (excl:tenuring
   (let ((sim-matrix
          (the simple-array
            (make-array num-docs
                        :initial-element
                        (the simple-array (make-array 0 :element-type
'(unsigned-byte 16)))
                        :element-type 'simple-array))))
     (dotimes (i num-docs)
       (declare (type (integer 0 65535) i))
       (setf (aref sim-matrix i)
         (make-array i
                     :initial-element 0
                     :element-type '(unsigned-byte 16)))) (values
sim-matrix))))

What's going on? Why won't this work under CLISP or CMUCL? I am running
Solaris 8 on Tatung Ultrasparc hardware with 512 MB RAM, 900MB swap.
Thanks.

-bruce
········@uic.edu

From: Raymond Toy
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <4n7ko953ez.fsf@rtp.ericsson.se>
>>>>> "Bruce" == Bruce Lambert <·········@attbi.com> writes:

    Bruce> I sometimes need to allocate very large data strucutres. The code causes
    Bruce> CLISP and CMUCL to crash when I give arguments greater than about 15000. On
    Bruce> ACL, using the excl:tenuring switch, it works fine up to 25000 or more. Here
    Bruce> is the code:

    Bruce> (defun make-sim-matrix (num-docs)
    Bruce>   "Makes sim matrix as vector of vectors."
    Bruce>   (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
    Bruce>                (type (integer 0 65535) num-docs))
    Bruce>   (excl:tenuring
    Bruce>    (let ((sim-matrix
    Bruce>           (the simple-array
    Bruce>             (make-array num-docs
    Bruce>                         :initial-element
    Bruce>                         (the simple-array (make-array 0 :element-type
    Bruce> '(unsigned-byte 16)))
    Bruce>                         :element-type 'simple-array))))
    Bruce>      (dotimes (i num-docs)
    Bruce>        (declare (type (integer 0 65535) i))
    Bruce>        (setf (aref sim-matrix i)
    Bruce>          (make-array i
    Bruce>                      :initial-element 0
    Bruce>                      :element-type '(unsigned-byte 16)))) (values
    Bruce> sim-matrix))))

    Bruce> What's going on? Why won't this work under CLISP or CMUCL? I am running

The dynamic heap size for CMUCL is limited.  With recent versions of
CMUCL (after 18c), you can use -dynamic-space-size <n> to set the size
(the default is 256 MB, I think).  However, you are still limited to a
maximum of 1 GB.

Ray
From: Bruce Lambert
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <Hwxl8.66744$ZR2.32067@rwcrnsc52.ops.asp.att.net>
"Raymond Toy" <···@rtp.ericsson.se> wrote in message
···················@rtp.ericsson.se...

> The dynamic heap size for CMUCL is limited.  With recent versions of
> CMUCL (after 18c), you can use -dynamic-space-size <n> to set the size
> (the default is 256 MB, I think).  However, you are still limited to a
> maximum of 1 GB.

Ray,

I tried 'cmucl -dynamic-space-size 1000' and the program crapped out even
quier than before. I also tried with various smaller values
of -dynamic-space-size, with no apparent effect. Suggestions? How can I tell
how much space is allocated to the heap once CMUCL starts up. (room) does
not seem to be informative enough, or I'm not looking in the right place.
Thanks.

-bruce
From: Raymond Toy
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <4ny9go1vdi.fsf@rtp.ericsson.se>
>>>>> "Bruce" == Bruce Lambert <·········@attbi.com> writes:

    Bruce> "Raymond Toy" <···@rtp.ericsson.se> wrote in message
    Bruce> ···················@rtp.ericsson.se...

    >> The dynamic heap size for CMUCL is limited.  With recent versions of
    >> CMUCL (after 18c), you can use -dynamic-space-size <n> to set the size
    >> (the default is 256 MB, I think).  However, you are still limited to a
    >> maximum of 1 GB.

    Bruce> Ray,

    Bruce> I tried 'cmucl -dynamic-space-size 1000' and the program crapped out even
    Bruce> quier than before. I also tried with various smaller values
    Bruce> of -dynamic-space-size, with no apparent effect. Suggestions? How can I tell

Hmm, a tricky bug.  I don't know what to do.  I tried running your
test on my machine, but it only has 256 MB, so when it started
swapping, I killed it.

    Bruce> how much space is allocated to the heap once CMUCL starts up. (room) does
    Bruce> not seem to be informative enough, or I'm not looking in the right place.

Try the following:

* (alien:def-alien-variable ("dynamic_space_size" dynamic-space-size) c-call::int)

* dynamic-space-size

Ray
From: Raymond Toy
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <4nu1rc1u91.fsf@rtp.ericsson.se>
>>>>> "Bruce" == Bruce Lambert <·········@attbi.com> writes:

    Bruce> "Raymond Toy" <···@rtp.ericsson.se> wrote in message
    Bruce> ···················@rtp.ericsson.se...

    >> The dynamic heap size for CMUCL is limited.  With recent versions of
    >> CMUCL (after 18c), you can use -dynamic-space-size <n> to set the size
    >> (the default is 256 MB, I think).  However, you are still limited to a
    >> maximum of 1 GB.

    Bruce> Ray,

    Bruce> I tried 'cmucl -dynamic-space-size 1000' and the program crapped out even
    Bruce> quier than before. I also tried with various smaller values
    Bruce> of -dynamic-space-size, with no apparent effect. Suggestions? How can I tell

I tried this again.  Yes, there seems to be a problem with a size of
1000.  Try 500.  I used the following modified code to test this:

(defun make-sim-matrix (num-docs)
  "Makes sim matrix as vector of vectors."
  (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
           (type (integer 0 65535) num-docs))
   
  (let ((sim-matrix
         (the simple-array
           (make-array num-docs
                       :initial-element
                       nil))))
    (dotimes (i num-docs)
      (declare (type (integer 0 65535) i))
      (setf (aref sim-matrix i)
            (make-array i
                        :element-type '(unsigned-byte 16))))
    (values sim-matrix)))

sim-matrix is initialized to nil instead of a zero-element matrix,
since (upgraded-array-element-type 'simple-array) is T.  I also
deleted the initializer for the 16-bit arrays since CMUCL always
initializes arrays to 0.

With this, I can (make-sim-matrix 10000) without a problem.  I tried a
size of 25000 and let it run until top said it was using 416 MB of
memory before I killed the process.  (I only have 256 MB on my
machine and it was swapping like mad.)

Ray
From: Paolo Amoroso
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <kVqXPMfyoM2kPbDXoVBEx08n32Ew@4ax.com>
On Tue, 19 Mar 2002 02:38:31 GMT, "Bruce Lambert" <·········@attbi.com>
wrote:

> of -dynamic-space-size, with no apparent effect. Suggestions? How can I tell
> how much space is allocated to the heap once CMUCL starts up. (room) does
> not seem to be informative enough, or I'm not looking in the right place.

(ROOM T)


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]
From: Raymond Wiker
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <86hene8d6x.fsf@raw.grenland.fast.no>
"Bruce Lambert" <·········@attbi.com> writes:

> I sometimes need to allocate very large data strucutres. The code causes
> CLISP and CMUCL to crash when I give arguments greater than about 15000. On
> ACL, using the excl:tenuring switch, it works fine up to 25000 or more. Here
> is the code:

        25000^2 is 625 million elements. If you allocate 4 bytes per
element, you'll need 2.5 GB to hold it all. It may be that CMUCL needs
4 bytes per element in this case, while ACL may be able to allocate
only 2 bytes per element.

        It may be an idea to check what your current process limits
are, particularly the maximum data segment size.

-- 
Raymond Wiker                        Mail:  ·············@fast.no
Senior Software Engineer             Web:   http://www.fast.no/
Fast Search & Transfer ASA           Phone: +47 23 01 11 60
P.O. Box 1677 Vika                   Fax:   +47 35 54 87 99
NO-0120 Oslo, NORWAY                 Mob:   +47 48 01 11 60

Try FAST Search: http://alltheweb.com/
From: Joe Marshall
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <Lqnl8.31214$44.8577650@typhoon.ne.ipsvc.net>
When allocating something this huge that doesn't contain
pointers, you might want to allocate it outside of the
lisp heap.  There are different ways of doing this
depending on the Lisp implementation you are using.
Allocating outside the heap will also keep the GC
from trying to relocate this object.


"Bruce Lambert" <·········@attbi.com> wrote in message
··························@rwcrnsc54...
> I sometimes need to allocate very large data strucutres. The code causes
> CLISP and CMUCL to crash when I give arguments greater than about 15000.
On
> ACL, using the excl:tenuring switch, it works fine up to 25000 or more.
Here
> is the code:
>
> (defun make-sim-matrix (num-docs)
>   "Makes sim matrix as vector of vectors."
>   (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
>                (type (integer 0 65535) num-docs))
>   (excl:tenuring
>    (let ((sim-matrix
>           (the simple-array
>             (make-array num-docs
>                         :initial-element
>                         (the simple-array (make-array 0 :element-type
> '(unsigned-byte 16)))
>                         :element-type 'simple-array))))
>      (dotimes (i num-docs)
>        (declare (type (integer 0 65535) i))
>        (setf (aref sim-matrix i)
>          (make-array i
>                      :initial-element 0
>                      :element-type '(unsigned-byte 16)))) (values
> sim-matrix))))
>
> What's going on? Why won't this work under CLISP or CMUCL? I am running
> Solaris 8 on Tatung Ultrasparc hardware with 512 MB RAM, 900MB swap.
> Thanks.
>
> -bruce
> ········@uic.edu
>
>
From: Bruce Lambert
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <EMwl8.64519$702.18931@sccrnsc02>
"Joe Marshall" <·············@attbi.com> wrote in message
···························@typhoon.ne.ipsvc.net...
> When allocating something this huge that doesn't contain
> pointers, you might want to allocate it outside of the
> lisp heap.  There are different ways of doing this
> depending on the Lisp implementation you are using.
> Allocating outside the heap will also keep the GC
> from trying to relocate this object.

I think this is what the excl:tenuring macro does in ACL. Does anyone know
the equivalent trick in CMUCL or CLISP?

-bruce


> "Bruce Lambert" <·········@attbi.com> wrote in message
> ··························@rwcrnsc54...
> > I sometimes need to allocate very large data strucutres. The code causes
> > CLISP and CMUCL to crash when I give arguments greater than about 15000.
> On
> > ACL, using the excl:tenuring switch, it works fine up to 25000 or more.
> Here
> > is the code:
> >
> > (defun make-sim-matrix (num-docs)
> >   "Makes sim matrix as vector of vectors."
> >   (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space
0))
> >                (type (integer 0 65535) num-docs))
> >   (excl:tenuring
> >    (let ((sim-matrix
> >           (the simple-array
> >             (make-array num-docs
> >                         :initial-element
> >                         (the simple-array (make-array 0 :element-type
> > '(unsigned-byte 16)))
> >                         :element-type 'simple-array))))
> >      (dotimes (i num-docs)
> >        (declare (type (integer 0 65535) i))
> >        (setf (aref sim-matrix i)
> >          (make-array i
> >                      :initial-element 0
> >                      :element-type '(unsigned-byte 16)))) (values
> > sim-matrix))))
> >
> > What's going on? Why won't this work under CLISP or CMUCL? I am running
> > Solaris 8 on Tatung Ultrasparc hardware with 512 MB RAM, 900MB swap.
> > Thanks.
> >
> > -bruce
> > ········@uic.edu
> >
> >
>
>
From: Joe Marshall
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <heQl8.32981$44.9620862@typhoon.ne.ipsvc.net>
"Bruce Lambert" <·········@attbi.com> wrote in message
··························@sccrnsc02...
> "Joe Marshall" <·············@attbi.com> wrote in message
> ···························@typhoon.ne.ipsvc.net...
> > When allocating something this huge that doesn't contain
> > pointers, you might want to allocate it outside of the
> > lisp heap.  There are different ways of doing this
> > depending on the Lisp implementation you are using.
> > Allocating outside the heap will also keep the GC
> > from trying to relocate this object.
>
> I think this is what the excl:tenuring macro does in ACL. Does anyone know
> the equivalent trick in CMUCL or CLISP?

No, the excl:tenuring macro in ACL sets the generation spread of the GC
to zero and then performs two flips.  In effect, this causes the live
data to migrate to a more static space.

I was suggesting allocating outside the heap altogether.
From: Paolo Amoroso
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <xB2WPF8IcYjuwv3nahdk=LKx1A9r@4ax.com>
On Mon, 18 Mar 2002 02:04:22 GMT, "Bruce Lambert" <·········@attbi.com>
wrote:

> I sometimes need to allocate very large data strucutres. The code causes
> CLISP and CMUCL to crash when I give arguments greater than about 15000. On

Try using (ROOM T) with CLISP and CMU CL to check how much space your data
structures take.


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]
From: Bruce Lambert
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <7Jxl8.66831$ZR2.33055@rwcrnsc52.ops.asp.att.net>
"Bruce Lambert" <·········@attbi.com> wrote in message
··························@rwcrnsc54...
> I sometimes need to allocate very large data strucutres. The code causes
> CLISP and CMUCL to crash

I must apologize to the good people who develop CLISP! It may have crashed
an earlier version of CLISP, but a more recent version succeeds in
allocating a very large array:

3. Break [4]> (time (progn (make-sim-matrix 25000) t))

Real time: 176.75488 sec.
Run time: 26.77 sec.
Space: 625355224 Bytes
GC: 11, GC time: 14.55 sec.

Still can't get it to work on CMUCL however, and would appreciate any help
in doing so.

-bruce


when I give arguments greater than about 15000. On
> ACL, using the excl:tenuring switch, it works fine up to 25000 or more.
Here
> is the code:
>
> (defun make-sim-matrix (num-docs)
>   "Makes sim matrix as vector of vectors."
>   (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
>                (type (integer 0 65535) num-docs))
>   (excl:tenuring
>    (let ((sim-matrix
>           (the simple-array
>             (make-array num-docs
>                         :initial-element
>                         (the simple-array (make-array 0 :element-type
> '(unsigned-byte 16)))
>                         :element-type 'simple-array))))
>      (dotimes (i num-docs)
>        (declare (type (integer 0 65535) i))
>        (setf (aref sim-matrix i)
>          (make-array i
>                      :initial-element 0
>                      :element-type '(unsigned-byte 16)))) (values
> sim-matrix))))
>
> What's going on? Why won't this work under CLISP or CMUCL? I am running
> Solaris 8 on Tatung Ultrasparc hardware with 512 MB RAM, 900MB swap.
> Thanks.
>
> -bruce
> ········@uic.edu
>
>
From: Rahul Jain
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <874rjdntw3.fsf@photino.sid.rice.edu>
"Bruce Lambert" <·········@attbi.com> writes:

> Still can't get it to work on CMUCL however, and would appreciate any help
> in doing so.

Works for me (TM).

> lisp -dynamic-space-size 800

CMU Common Lisp release x86-linux 3.0.8 18c+ 31 December 2001 build 3030, running on photino
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to ········@debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos

Loaded subsystems:
    Python 1.0, target Intel x86
    CLOS based on PCL version:  September 16 92 PCL (f)
* (setq *bytes-consed-between-gcs* 100000000
      *gc-verbose* nil)      

NIL

* (defun make-sim-matrix (num-docs)
  "Makes sim matrix as vector of vectors."
  (declare (optimize (speed 3) (safety 1) (compilation-speed 0) (space 0))
           (type (integer 0 65535) num-docs))
   
  (let ((sim-matrix
         (the simple-array
           (make-array num-docs
                       :initial-element
                       (the simple-array
                         (make-array 0 :element-type '(unsigned-byte 16)))
                       :element-type 'simple-array))))
    (dotimes (i num-docs)
      (declare (type (integer 0 65535) i))
      (setf (aref sim-matrix i)
            (make-array i
                        :initial-element 0
                        :element-type '(unsigned-byte 16))))
    (values sim-matrix)))

MAKE-SIM-MATRIX

* (compile 'make-sim-matrix)

Compiling LAMBDA (NUM-DOCS): 
Compiling Top-Level Form: 

MAKE-SIM-MATRIX
NIL
NIL

* (time (progn (make-sim-matrix 25000) t))

Compiling LAMBDA NIL: 
Compiling Top-Level Form: 

Evaluation took:
  8.98 seconds of real time
  3.24 seconds of user run time
  3.82 seconds of system run time
  [Run times include 5.58 seconds GC run time]
  420 page faults and
  924856373 bytes consed.
T
* 

-- 
-> -/                        - Rahul Jain -                        \- <-
-> -\  http://linux.rice.edu/~rahul -=-  ············@techie.com   /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook  \- <-
-> -\  people if [they] try to walk around on their own. I really  /- <-
-> -/  wonder why XML does not." -- Erik Naggum, comp.lang.lisp    \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   (c)1996-2002, All rights reserved. Disclaimer available upon request.
From: Bruce L. Lambert, Ph.D.
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <a7809d$i52$1@newsx.cc.uic.edu>
> * (time (progn (make-sim-matrix 25000) t))
>
> Compiling LAMBDA NIL:
> Compiling Top-Level Form:
>
> Evaluation took:
>   8.98 seconds of real time
>   3.24 seconds of user run time
>   3.82 seconds of system run time
>   [Run times include 5.58 seconds GC run time]
>   420 page faults and
>   924856373 bytes consed.

Rahul,

What hardware are you running on?

-bruce
From: Rahul Jain
Subject: Re: Large data structures work with ACL but nor CLISP, CMUCL?
Date: 
Message-ID: <87bsdkmcev.fsf@photino.sid.rice.edu>
"Bruce L. Lambert, Ph.D." <········@uic.edu> writes:

> Rahul,
> 
> What hardware are you running on?

K6-3 400, VIA MVP3 chipset, 640MB RAM, ~500MB swap.

-- 
-> -/                        - Rahul Jain -                        \- <-
-> -\  http://linux.rice.edu/~rahul -=-  ············@techie.com   /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook  \- <-
-> -\  people if [they] try to walk around on their own. I really  /- <-
-> -/  wonder why XML does not." -- Erik Naggum, comp.lang.lisp    \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   (c)1996-2002, All rights reserved. Disclaimer available upon request.