Home > Community > Forums > Custom IC SKILL > Release the memory by skill

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Release the memory by skill 

Last post Wed, Jan 23 2013 9:33 AM by marcelpreda. 5 replies.
Started by nidon 20 Jan 2013 06:54 PM. Topic has 5 replies and 1064 views
Page 1 of 1 (6 items)
Sort Posts:
  • Sun, Jan 20 2013 6:54 PM

    • nidon
    • Top 500 Contributor
    • Joined on Tue, May 22 2012
    • shanghai, Shanghai
    • Posts 22
    • Points 410
    Release the memory by skill Reply

    Hi everyone,

     I write a skill code to generate a lot of pcells,but the speed of the generation become slower and slower.

    And I think it may be generated large memory by the code,so how can I release these memory to improve the the speed of generation?

     

    Tks a lot~

    • Post Points: 20
  • Mon, Jan 21 2013 5:42 AM

    • Quek
    • Top 10 Contributor
    • Joined on Wed, Oct 14 2009
    • Singapore, 00-SG
    • Posts 1,071
    • Points 16,285
    Re: Release the memory by skill Reply

    Hi Nidon

    I think in general, you can try disabling "undo" and using dbClose on unused cellviews to reduce memory consumption of skillscripts. It is a little hard to know the cause of the actual problem without looking at the codes. : )


    Best regards
    Quek

    • Post Points: 20
  • Mon, Jan 21 2013 6:56 PM

    • nidon
    • Top 500 Contributor
    • Joined on Tue, May 22 2012
    • shanghai, Shanghai
    • Posts 22
    • Points 410
    Re: Release the memory by skill Reply

    Ths for your reply,quek

    In the fact,I have been used dbClose/dbSave and undoLimit in my code,but it seems doesn't work.And the whole code as follow:

    procedure(LeeGenResdrc(parampath list_pdk)
        let((gen_process num_model numbers_of_inst res_log cellId respath inres list cricut
             second forth param_begin_w param_end_w param_begin_l param_end_l list_multi grid multi_num
             z aaa bbb list_fingers j factor step param_add param_adda param_addb list_param_w list_l
             num_l i value list_connection list_boolean num_con num_boolean num_fingers list_w 
             total_num num_row num_col calu value_key row beg end ref_x ref_y para counts model_list
             list_pa ele_pa ele_aa list_aa ele_nw)

             gen_process=hiCreateWindow(nil "text" "Generate Process File")

    ;         hiDisplayWindow(gen_process)

    ;        hiSetWindowName(gen_process strcat(runDir libName_gds ".log"))
     
             num_model=length(list_pdk)
             numbers_of_inst=1
     
             res_log=strcat(ddGetObjReadPath(ddGetObj(LibName)) "/../pdk_miss.log")
             miss_list=list_pdk
            
             hiSetUndoLimit(0)
             foreach(bjt list_pdk
                 cellId=dbOpenCellViewByType(LibName strcat(bjt "_pdk_drc_all") "layout" "maskLayout" "w")
                 respath=strcat(parampath bjt "/")
                 inres=infile(strcat(respath "cell.cdf"))
                 list=ncons(nil)
                 model_list=ncons(nil)
                 cricut=t
     
                 while(cricut
                    cricut=gets(line inres)
                    list=append1(list line))
                 close(input)
                 list=remove(nil list)
             
                 counts=1
                 foreach(para list
                     list_pa=parseString(para "(")
                     if(counts<=2 then
                        foreach(ele_pa list_pa
                           list_aa=parseString(ele_pa " ")
                           if(list_aa=='("cdfCreateParam") then counts++ )
                           if(length(list_aa)>=1 then
                               foreach(ele_aa list_aa
                                  if(ele_aa=="?choices" then
                                      list_bb=parseString(para " '(\"")
                                          foreach(ele_nw cdr(remd(car(last(list_bb)) list_bb))
                                                       ; remove the first and last element for list_bb
                                               model_list=append1(model_list ele_nw)
                                                  ) ; for
                                  ) ; if ele_aa
                                ) ; for
                              ) ; if
                            ) ; if
                          ) ; if
                        ) ; for extract the model choices from each bjt model parameters
                model_list=remove(nil model_list)
                printf("%L\n" model_list)
     


                list_multi=nil
                grid=0.005u
                multi_num=20
                z=0
                while(z<multi_num
                        z=z+1
                        aaa=sprintf(nil "%n" z)
                        bbb=list(aaa)
                        list_multi=nconc(list_multi bbb)
                       )
                list_col=list_multi
                list_row=list_multi
                list_param=nil
                param_num=60u
                j=0
                param_begin=3u
                factor=10
                while(j<=factor
                        step=float(param_num)/factor
                        param_add=float(param_begin)+j*step
                        param_adda=PasCeiling(param_add grid t)
                        param_addb=list(param_adda)
                        list_param=nconc(list_param param_addb)
                        j=j+1
                       )
                list_w=list_param
                list_l=list_param
                num_col=length(list_col)
                num_row=length(list_row)
                num_w=length(list_w)
                num_l=length(list_l)
                num_model=length(list_pdk)
                total_num=num_col*num_row*num_model
                num_col=fix(sqrt(total_num))
                num_row=round(total_num/num_col)
                i=1
                value=1
                spa_cell=250
                numbers_of_inst=1
                foreach( model_name model_list
     
                        foreach( col_choice list_col

                            foreach( row_choice list_row

                                    calu=(i-1)/num_col
                                    key=fixp(calu)
                                    value=(if key then calu else value)
                                    value=float(value)
                                    value_key=float(1)+value*num_col
                                    row=float(round(i/num_row))
                                    beg=1+row*num_col
                                    end=(row+1)*num_col
                                    ref_x=0
                                    ref_y=0-(value-1)*spa_cell
                                    if( i==value_key then

                                    instId=dbCreateParamInstByMasterName(cellId target_pdk bjt "layout" get_pname(concat("bjt_list" "_" i)) 0:0 "R0" 1
                                                      list(
                                                           list("model" "string" model_name)
                                                           list("col" "string" col_choice)
                                                           list("row" "string" row_choice)
                                                           )
                                           )
                                    cdfGetInstCDF(instId)    
                                        rodAlign(
                                            ?alignObj           rodGetObj(sprintf(nil "bjt_list_%n" i) cellId)
                                            ?alignHandle        'lowerLeft
                                            ?refPoint           list(ref_x ref_y)
                                        )

                                    ) ;end if

                                    if( i!=value_key then

                                        dbCreateParamInstByMasterName(cellId target_pdk bjt "layout" get_pname(concat("bjt_list" "_" i)) 0:0 "R0" 1
                                            list(
                                                list("model" "string" model_name)
                                                list("col" "string" col_choice)
                                                list("row" "string" row_choice)
                                            )
                                        )

                                        rodAlign(
                                            ?alignObj           rodGetObj(sprintf(nil "bjt_list_%n" i) cellId)
                                            ?alignHandle        'lowerLeft
                                            ?refObj             rodGetObj(sprintf(nil "bjt_list_%n" i-1) cellId)
                                            ?refHandle          'lowerRight
                                            ?xSep               100
                                            ?maintain           nil
                                        )

                                    ) ;end if

                                    i++
                        ) ;end foreach

                    ) ;end foreach

                    numbers_of_inst++
                ) ;end foreach

                     dbSave(cellId)
                     dbClose(cellId)

                     miss_list=remove(bjt miss_list)
                     setq(port outfile(res_log))
                     foreach(mis_res miss_list
                     fprintf(port "%s\n" mis_res)
                            )
                     close(port)
                     numbers_of_inst++

             ) ;end foreach

             deleteFile(res_log)
     
             file_path=strcat(ddGetObjReadPath(ddGetObj(LibName)) "/../")
             hiSaveViewfile(gen_process strcat(file_path "Generate_Process_File" ".log"))
      ) ; let
    ) ; procedure

     

    LeePdkPathCheck()

     

     

    • Post Points: 20
  • Tue, Jan 22 2013 12:38 AM

    • berndfi
    • Top 100 Contributor
    • Joined on Tue, Sep 11 2012
    • Neubiberg, Bavaria
    • Posts 67
    • Points 1,255
    Re: Release the memory by skill Reply

     Does ‘dbClose’ really purges cells  form memory?
    I always use ‘dbClose’ in combination with ‘dbPurge’, to be on the save side.


    dbSave(cellId)
    dbClose(cellId)
    dbPurge(cellId)


    Bernd

    • Post Points: 20
  • Tue, Jan 22 2013 2:03 AM

    • nidon
    • Top 500 Contributor
    • Joined on Tue, May 22 2012
    • shanghai, Shanghai
    • Posts 22
    • Points 410
    Re: Release the memory by skill Reply

    Thank you~

    But I used the dbPurge,it seem still doesn't work

    And the code will become slower and slower~

    • Post Points: 20
  • Wed, Jan 23 2013 9:33 AM

    • marcelpreda
    • Top 200 Contributor
    • Joined on Tue, Jan 19 2010
    • Bucharest, Romania
    • Posts 44
    • Points 715
    Re: Release the memory by skill Reply

     Hi there,

    Reading the 1st post looks like it is not 100% sure that the problem is memory.

    Better  to try the the skill profiler (license is needed).
    You can check with it which procedures are slow, but also you can check the memory used by each one.
    If you do not have license available for profiler you can try to monitor the process to see the allocated memory,
    with a command like `top' ; available on most unix flavors.

    Any how looking at the code.

    I do no know how large are your list, but a code like:
    ~~~~~~~~~~~~~
                 list=ncons(nil)
     ....
                 while(cricut
                    cricut=gets(line inres)
                    list=append1(list line))
                 close(input)
                 list=remove(nil list)
    ~~~~~~~~~~~~~~~~

    can be translated to
    ~~~~~~~~~~~~~~~~
                 list = nil  ;; actually your list is already nil
     
                 while(cricut
                    cricut=gets(line inres)
                    list=cons(line list)
                 close(input)

    ~~~~~~~~~~~~~~~~

    The idea is that cons is much faster than append1 when huge list is involved;
    cons() adds the element at the begining of the list.
    If the elements order matters you can do a
         list = reverse(list)

    Or you can try directly to use tconc() structure ;

    I personally I'm to lazy to use it :D - every time I should check the manual.

    You ca do the same thing with the other list where you also use append1.



    BR,
    Marcel

    Filed under:
    • Post Points: 5
Page 1 of 1 (6 items)
Sort Posts:
Started by nidon at 20 Jan 2013 06:54 PM. Topic has 5 replies.