Multi Threaded Rasterization
The rasterization of a band of data is very amenable to parallel processing since there is a lot of computational work. Modern workstations with dual CPU's can often support 4 simultaneous threads efficiently.gds_rip has been designed to take advantage of multiple rasterization threads.
There are two main processes inside of gdsriplib: the extraction of polygons from the CAD data (which is handled by gdsmachine) and the actual rasterization of those polygons. Only the rasterizer is multi-threaded -- not the polygon extraction step.
It might appear then, that the polygon extraction routine (since it is not multi-threaded) would be a bottleneck if it had to feed multiple rasterizers.
For the GDSII files we tested this is not the case. The flat panel CAD data makes very extensive use of large arrays and the actual GDSII file is very small; our measurements show that the polygon extraction takes only a fraction of the time needed to rasterizer those polygons.
Of course, if the GDSII input data is very large and deep, such as an integrated circuit layout, the polygon extraction time could be very high; in this case we would recommend a different product (qislib) which was designed to handle very large data files.
Dividing a Band Into Windows
Each band is very wide - for a large flat panel it can be 3 meters wide. To use multi threaded rasterization, we subdivide each band into an even number of windows as shown below.
To avoid problems at the window boundaries we insure that:
windows overlap by 8 pixels
no two adjacent windows are rasterized simultaneously. Otherwise the condition might arise where two threads contend for the same memory address.
How Many Windows?
The optimum number of windows is determined to some extent by the density of the CAD data. It does not make sense to extract hundreds of millions of polygons for the entire band at one time and try to feed them to the rasterizer. The user provides a database size (the -dbs argument when calling the library) for polygon vertices; gdsriplib estimates, based on that number, the window size. gdsrip can automatically change the polygon database size as needed to account for variations in the density of the polygons at any particular area.
The number of windows must also be an integer multiple of the number of threads in order that the program can make sure that no two adjacent windows are simultaneously rasterized. For example, if you have specified 4 threads, then the number of windows must be a multiple of 8 -- 8,16,24,32 and so on.
Other than setting the -dbs option and the number of threads, the programmer does not control the number of windows that a band is divided into.
Next Raster Interleaving