I have a skill code with about 5000 lines. Inside the top level procedure, everything is very simple: call two lower level functions (let's call them A and B). There is no global variables shared between function A and B except a cell view they will work on. So, I basically can run them step by step on a cell view if I like to do so.I can't explain the following facts: (1). if I run the top level procedure, which means that A and B will be run in sequence, then, it will take forever to finish the second function (B). (>24 hours). VERY SLOW!! The function A takes about 1 minute cputime to run, which is ok. (2). Run A and B step by step: run function A, which still takes about 1 minute. then, save the cell view and quite opus. restart opus and open the saved cell view. then, run function B on it, which takes about 5 minutes to finish, VERY FAST!! (3). Run A and B separately. After A finished, immediately start function B, both phenomena of item 1&2 may happen. Some times, I got B takes looong time (>24 hrs) and some times, I got B takes less than 5 minutes. If I interrupt the B function in the middle using "ctrl-C", and then, restart B, the chance is high that B will finish fast (<5 minutes).My goal is to run the top level procedure directly like in (1) in a reasonable short time.I have used profile('memory) to look into the memory usage. function A will take ~300mB and B will take ~1GB. I added needNCells to increase the initial memory allocations in my code so that the allocated numbers are large than necessary values reported by profileSummary and gcsummary. By the way, the computer I used has 6GB physical memory, much larger than the needed 1.5GB.Also, I tried to insert "gc" in several locations of the code to force it collect garbage and tried to make sure all the used variables are local so that their memory can be recycled when a function is not used anymore.But none of the above methods could help me reduce function B cputime if I run A&B together by calling the top level function. What have I missed? Please help!Thanks,Tong
Have you tried profiling the performance instead of the memory? If it is gc related, then the majority of the time will be indicated with the gc. The inconsistency in run time makes me think you have a variable that is not getting reset correctly or might be global and used by both routines. Have you run skill lint checker to look at global variables? -Derek
Does this SKILL code uses ipc and sleep calls? Is it anyway related to OSS based netlisting?
Hi, Derek and Rairaj,Thanks for your reply!To Derek: when I tried profiling cputime or looked into the gcsummary report, the time taken by gc only tens of seconds. The huge time chunk is allocated to the function B. In function B, there are a lot of list operation (creation) and dbGetOverlaps. I guess the dynamic memory allocation is causing those procedures slow when A & B are run in sequence. I did pay attention to the variable types of function A (all of them defined withing let()), and actually, the reported memory usage of function A is not huge (300mb~500mb). I should have run lint as you suggested. So, I will do "lint" for the whole script (including function A&B) and post the result back later.To Rairaj: no ipc or sleep calls in the current script. This script is for processing a layout view, basically play with shapes. Therefore, no netlist involved.Tongju