0

Tile rendering is now mostly parallel up to 4 procs.

The initial recursive call for tile generation will spawn up to 3 extra
processes to work on each quadrant. It's not perfect yet since some
quadrants may have more or less work to do, and only 4 total workers are
supported.

Also, it waits for all chunks are finished before it dives into the
tiles, to prevent it from using more resources than requested.
This commit is contained in:
Andrew Brown
2010-09-11 00:12:38 -04:00
parent 1e296e858a
commit f9783d7a20
2 changed files with 78 additions and 15 deletions

View File

@@ -35,8 +35,11 @@ def main():
# Translate chunks from diagonal coordinate system
mincol, maxcol, minrow, maxrow, chunks = world.convert_coords(all_chunks)
print "processing chunks in background"
print "Rendering chunks"
results = world.render_chunks_async(chunks, False, options.procs)
for i, (col, row, filename) in enumerate(chunks):
results[col, row].wait()
print "{0}/{1} chunks rendered".format(i, len(chunks))
print "Writing out html file"
if not os.path.exists(destdir):
@@ -49,7 +52,7 @@ def main():
tiledir = os.path.join(destdir, "tiles")
if not os.path.exists(tiledir):
os.mkdir(tiledir)
world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir)
world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir, options.procs)
print "DONE"