unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* potential memory leak in do loop
@ 2006-05-02 20:33 Stephane Chatigny
  2006-05-03  1:48 ` Kevin Ryde
  0 siblings, 1 reply; 6+ messages in thread
From: Stephane Chatigny @ 2006-05-02 20:33 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 4376 bytes --]

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

 

 


[-- Attachment #1.2: Type: text/html, Size: 12483 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-04 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-02 20:33 potential memory leak in do loop Stephane Chatigny
2006-05-03  1:48 ` Kevin Ryde
2006-05-03 13:32   ` stephane chatigny
2006-05-03 14:09     ` Paul Emsley
2006-05-03 22:47     ` Kevin Ryde
2006-05-04 14:41     ` stephane chatigny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).