From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephane Chatigny Newsgroups: gmane.lisp.guile.user Subject: potential memory leak in do loop Date: Tue, 02 May 2006 16:33:14 -0400 Message-ID: <390990895AACCE4AA76C5A19872C8ADB233D6C@serveur0.coractive.local> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1889577324==" X-Trace: sea.gmane.org 1146602023 10299 80.91.229.2 (2 May 2006 20:33:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 May 2006 20:33:43 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue May 02 22:33:37 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fb1Yj-0000PP-Dc for guile-user@m.gmane.org; Tue, 02 May 2006 22:33:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fb1Yj-0000Pd-57 for guile-user@m.gmane.org; Tue, 02 May 2006 16:33:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fb1Yc-0000P6-Jo for guile-user@gnu.org; Tue, 02 May 2006 16:33:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fb1Ya-0000Om-S7 for guile-user@gnu.org; Tue, 02 May 2006 16:33:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fb1Ya-0000Oj-Ln for guile-user@gnu.org; Tue, 02 May 2006 16:33:16 -0400 Original-Received: from [142.169.1.74] (helo=transit1.telusquebec.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fb1Yo-0004jW-6j for guile-user@gnu.org; Tue, 02 May 2006 16:33:30 -0400 Original-Received: from transit1.telusquebec.local(192.168.250.88) by avas8.globetrotter.net via smtp id 3c82_e1e62dca_da1a_11da_8dac_0002b3e6fcd8; Tue, 02 May 2006 16:33:15 -0400 Original-Received: from serveur0.coractive.local (mail.coractive.com [207.134.68.3]) by transit1.telusquebec.net (iPlanet Messaging Server 5.2) with ESMTP id <0IYN005SZNRE4W@"TELUS Quebec"> for guile-user@gnu.org; Tue, 02 May 2006 16:33:15 -0400 (EDT) Original-Received: from mail.coractive.com(207.134.68.3) by avas8.globetrotter.net via smtp id 3c80_e147ea66_da1a_11da_9f6b_0002b3e6fcd8; Tue, 02 May 2006 16:33:14 -0400 Original-To: guile-user@gnu.org X-MIMEOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message Thread-topic: potential memory leak in do loop Thread-index: AcZuJ6LPX1r0JNonQ3eoQ0YXIrh4mw== X-MS-Has-Attach: X-MS-TNEF-Correlator: X-NAI-Spam-Score: -1 X-NAI-Spam-Rules: 2 Rules triggered BAYES_20=-1, HTML_MESSAGE=0 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5278 Archived-At: This is a multi-part message in MIME format. --===============1889577324== Content-type: multipart/alternative; boundary="Boundary_(ID_bEyQDPuIpzBUjb4leG+5Hw)" Content-class: urn:content-classes:message This is a multi-part message in MIME format. --Boundary_(ID_bEyQDPuIpzBUjb4leG+5Hw) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Hello, I use the MIT MPB package on a machine running guile 1.6 and Debian-Linux 3.1r0a. Apparently, I generate a memory link while executing a do loop (although I have not tracked the memory usage yet). When I run the loop, the process is aborted before the end of the iteration. Interestingly, the number of iteration is always the same for a particular set of config parameters, but it will change if I change my config parameters. I have posted this question on the MPB mailing list but according to Steven Johnson (the developer of the MIT MPB package) this bug is probably related to Guile or Scheme and not to MPB. Here is a copy of its post: ======================================================================== ========================================== I've noticed that if you perform large numbers of runs from within a single .ctl file under Linux it sometimes eventually runs out of memory. I haven't been able to find any memory leak in MPB, so my best guess is that there is one in Guile. A workaround is, when you have simple parameter-sweep loop, to put the loop outside MPB (i.e. launch a new MPB process for each loop iteration). e.g. in the bash shell under Linux, do: for x in `seq a dx b`; do program x=$x myfile.ctl; done See also http://ab-initio.mit.edu/wiki/index.php/Guile_and_Scheme_links Cordially, Steven G. Johnson Does anyone know a solution to this problem? Here is a copy of my program (there is a couple of command for mpb... the do loop is at the end): Thanks Stef ======================================================================== =================================================== ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Based on an Example of Martin Lokke Nielson Thesis p143 ;TRIANGULAR Lattice of Air holes in silica ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define bands 32);Number of bands calculated (define kzstart 0);z-component of the k vector (define kzstep 0.01);z-component step (define kzend 5);z-component of the k vector (set! tolerance 1e-4);Defines tolerance for convergence (set! mesh-size 3) (set-param! resolution 8) (define-param k-interp 0) (define rstart 0.2);start value of rod radius, r (define rstep 0.025);increase r of step size rstep (define rend 0.5);limit for non-overlapping cylinders (define nstart 1) ;start band (define nstep 1) (define nend (- bands 1)) ;end band (define estart (* 1.44402 1.44402)) ;start epsilon Silica @ 1550nm (define estep 1) ;epsilon steps (define eend (* 1.44402 1.44402)) ;end epsilon ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Defining Super-cell parameters\\ ;Corresponds to translational invariant lattice (define S 1) ;Supercell definition (define points 32) (set! num-bands bands) ;Number of calculated bands (set! grid-size (vector3 points points 1)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define lattice, the unit cell\\ (set! geometry-lattice (make lattice (size S S no-size) (basis1 (/ (sqrt 3) 2) 0.5) (basis2 (/ (sqrt 3) 2) -0.5) )) (define (LatticeAndkz kz) (set! k-points (list (vector3 0 0 kz) ; Gamma (vector3 0 0.5 kz) ; M (vector3 (/ -3) (/ 3) kz) ; K (vector3 0 0 kz))) ; Gamma (set! k-points (interpolate k-interp k-points)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create periodic structure\\ ;Defining the function structure\\ ;In defined unit cell ;Create cylinder of radius r ;Invariant in z-direction ;Air has n=epsilon=1 ;Calculates the bands (define (structure r) (set! geometry (geometric-objects-lattice-duplicates (list (make cylinder (center 0 0 0) (radius r) (height infinity) (material air))))) (run) ) ;Background medium is set (define (background-material e) (define medium (make dielectric (epsilon e))) (set! default-material medium) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Loops which outputs epsilon, rod-radius and kz (do ((e estart ( + e estep))) ((> e eend)) (background-material e) (do ((r rstart ( + r rstep))) ((> r rend)) (do ((kz kzstart ( + kz kzstep))) ((> kz kzend)) (LatticeAndkz kz) (structure r) ) ) ) --Boundary_(ID_bEyQDPuIpzBUjb4leG+5Hw) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7BIT

Hello,

 

I use the MIT MPB package on a machine running guile 1.6 and Debian-Linux 3.1r0a. Apparently, I generate a memory link while executing a do loop (although I have not tracked the memory usage yet). When I run the loop, the process is aborted before the end of the iteration. Interestingly, the number of iteration is always the same for a particular set of config parameters, but it will change if I change my config parameters.

 

I have posted this question on the MPB mailing list but according to Steven Johnson (the developer of the MIT MPB package) this bug is probably related to Guile or Scheme and not to MPB. Here is a copy of its post:

==================================================================================================================

I've noticed that if you perform large numbers of runs from within a single .ctl file under Linux it sometimes eventually runs out of memory.

I haven't been able to find any memory leak in MPB, so my best guess is that there is one in Guile.

 

A workaround is, when you have simple parameter-sweep loop, to put the loop outside MPB (i.e. launch a new MPB process for each loop iteration).

e.g. in the bash shell under Linux, do:

 

            for x in `seq a dx b`; do program x=$x myfile.ctl; done

 

See also

 

            http://ab-initio.mit.edu/wiki/index.php/Guile_and_Scheme_links

 

Cordially,

Steven G. Johnson

 

 

Does anyone know a solution to this problem?

 

 

Here is a copy of my program (there is a couple of command for mpb… the do loop is at the end):

 

Thanks

Stef

===========================================================================================================================

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Based on an Example of Martin Lokke Nielson Thesis p143
;TRIANGULAR Lattice of Air holes in silica
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(define bands 32);Number of bands calculated

(define kzstart 0);z-component of the k vector
(define kzstep 0.01);z-component step
(define kzend 5);z-component of the k vector

(set! tolerance 1e-4);Defines tolerance for convergence
(set! mesh-size 3)
(set-param! resolution 8)
(define-param k-interp 0)

(define rstart 0.2);start value of rod radius, r
(define rstep 0.025);increase r of step size rstep
(define rend 0.5);limit for non-overlapping cylinders

(define nstart 1) ;start band
(define nstep 1)
(define nend (- bands 1)) ;end band


(define estart (* 1.44402 1.44402)) ;start epsilon Silica @ 1550nm
(define estep 1) ;epsilon steps
(define eend (* 1.44402 1.44402)) ;end epsilon

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Defining Super-cell parameters\\
;Corresponds to translational invariant lattice
(define S 1) ;Supercell definition                     
(define points 32)
(set! num-bands bands)  ;Number of calculated bands
(set! grid-size (vector3 points points 1))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Define lattice, the unit cell\\
(set! geometry-lattice (make lattice (size S S no-size)
                       (basis1 (/ (sqrt 3) 2) 0.5)
                       (basis2 (/ (sqrt 3) 2) -0.5) ))
(define (LatticeAndkz kz)
    (set! k-points (list (vector3 0 0 kz)  ; Gamma
                     (vector3 0 0.5 kz)        ; M
                     (vector3 (/ -3) (/ 3) kz) ; K
                     (vector3 0 0 kz)))        ; Gamma
    (set! k-points (interpolate k-interp k-points))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Create periodic structure\\
;Defining the function structure\\
;In defined unit cell
;Create cylinder of radius r
;Invariant in z-direction
;Air has n=epsilon=1
;Calculates the bands
(define (structure r)

    (set! geometry
        (geometric-objects-lattice-duplicates
            (list (make cylinder (center 0 0 0) (radius r) (height infinity)
(material air)))))
     (run)
)



;Background medium is set
(define (background-material e)
    (define medium (make dielectric (epsilon e)))
    (set! default-material medium)
)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Loops which outputs epsilon, rod-radius and kz
(do ((e estart ( + e estep))) ((> e eend))
    (background-material e)
    (do ((r rstart ( + r rstep))) ((> r rend))
              
        (do ((kz kzstart ( + kz kzstep))) ((> kz kzend))
            (LatticeAndkz kz)   
               (structure r)
         )
    )
)

 

 

--Boundary_(ID_bEyQDPuIpzBUjb4leG+5Hw)-- --===============1889577324== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user --===============1889577324==--