guile-user
[Top][All Lists]
Advanced

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

potential memory leak in do loop


From: Stephane Chatigny
Subject: potential memory leak in do loop
Date: Tue, 02 May 2006 16:33:14 -0400

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)
         )
    )
)

 

 


reply via email to

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