Writing a LOT of Cells in a Circular Pattern and Could Use Some Help with Memory Limitations

Hello all,

I have seen a few discussions on how to write circular patterns of unit cells. This discussion is not to ask about how to do that, but to ask about what I SHOULD be able to do. Currently, I am looking at writing something around 50 billion unit cells that are some arbitrary nanometers in size. I have been able to make a pattern that spans a couple hundred microns in diameter (about 50 thousand unit cells). It took a few minutes, but I was able to visualize it in KLayout. My goal is to go to a larger pattern (tens of billions of unit cells), but I figured this would require a heap of RAM I do not have. I tried anyway, and unsurprisingly, I ran into a bad memory allocation error.

I have a few questions:

1) What are some ideas of how to get around memory limitations when creating large files like these? I would assume populate an array cell for some number of rings then write these to storage. Repeat the process to add more rings to the same .gds file, but I am unsure how to load the file (to ) in such a way that would
2) Currently, I loop through each ring, insert the unit cells I know I can fit (manually calculating each unit cell position while incorporating an angular offset that changes each ring), then insert more cells if possible (more manual position calculations and angular offsets). Is there currently a more efficient way to write unit cells in a circular pattern than to manually calculate each cells position?

Here is a pattern to show an example of what I am able to achieve on a smaller scale:

Comments

  • edited November 24

    I'm surprised to see a question here ... everybody else seems to have moved to AI.

    The solution I think is writing OASIS directly instead of using a database and then dump it. I suggest you ask your favorite model to generate code for that. I should use low-level binary writer primitives to generate OASIS directly from the algorithm that produces the dots. Writing it in the serial fashion will overcome memory limits during generation. I suggest to let the model produce code in a fast compiled language like C++ or Rust. Let it look for the OASIS spec on the net. It will find it. Otherwise let it check public sources for writer code. First try the simple serial approach, writing instance for instance. Then ask it to include a compaction algorithm to bring down the file size at the expense of memory use and runtime. Ask it to implement a compaction buffer limit, so it does not buffer all instances first. Ideally, ask it to prefer array compaction as that is the most efficient, but it will not help much in your case. Finally ask it to include CBLOCK compression for best file size efficiency. Ask it to test the generator on smaller cases, and verify the correctness and integrity of the implementation using KLayout as golden reference and to set up a test harness that gets extended during the implementation.

    Matthias

  • Hello,

    This layout is quite symmetric. You can generate the dots of 1 quadrant only (including the dots on the axis) and then instantiate that "quadrant" cell 4 times in a top cell. This will give you a factor of ~4 for free without AI, lol...

    Cheers,

    Tomas

Sign In or Register to comment.