Logo by miles - Contribute your own Logo!
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. September 19, 2017, 07:03:18 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: mandelbrotG5  (Read 264 times)
Description: A parallel python program for generating images of the Mandelbrot set.
0 Members and 1 Guest are viewing this topic.
python.wiz
Forums Newbie
*
Posts: 2


« on: June 02, 2016, 12:40:07 AM »

Code is here on github: https://github.com/ChrisCalderon/mandelbrotG5

I'd love any feedback. It uses the multiprocessing module in the python standard library to make processes. Each child process writes a row of pixels, and the parent process writes data from the shared array using pypng.

Right now I'm able to render a 30k x 20k image in 3 hours, 10 minutes on my laptop.
« Last Edit: June 02, 2016, 12:51:32 AM by python.wiz, Reason: added benchmark info » Logged
claude
Fractal Bachius
*
Posts: 510



WWW
« Reply #1 on: June 02, 2016, 02:40:57 AM »

I didn't run it, but code looks simple and clear, the kind of thing I'd look for if I wanted to learn multiprocessing in Python.

I doubt you'll win any speed records using Python though, but you could probably do quite a bit better if you call out to a C function for the inner loop of Mandelbrot iterations.

For speed comparison, my fastest double-precision renderer renders a 20000x20000 image of the whole set with maxiters 1000000 in 6m40s on my quad core desktop (3GHz amd64).  You can get the image here (might want to save without viewing in browser, it decompresses pretty big): https://mathr.co.uk/mandelbrot/2016-06-02_mandelbrot_20000px.png (9.7MB)  (I did try 30000x20000 but it crashed, possibly int overflow leading to bad malloc)

To get it that fast I use biased interior checking, documented here https://mathr.co.uk/blog/2014-11-02_practical_interior_distance_rendering.html

C source code for mine is around https://code.mathr.co.uk/mandelbrot-graphics but the Javascript version might be easier to port to Python if you're curious: https://mathr.co.uk/mandelbrot/web/m-render.js
Logged
python.wiz
Forums Newbie
*
Posts: 2


« Reply #2 on: June 02, 2016, 10:28:51 PM »

Thanks for saying the code looks clear smiley . I've changed it a bit, and now it renders a 30k x 20k in 46 minutes! I don't know how much faster I can get it in python. I could try switching to doing work on tiles and use more of numpy's vectorized stuff, but I'm pretty happy with it right now. Idk what other desktop renderers' UIs are like, but I've just updated my CLI too. Now instead of specifying a height and width in pixels, you specify a zoom level.

One thing I can see being a problem with it is the size of the images it creates; the 30k x 20k PNG is ~190MB. Another scaling problem my code has is that the image data is held entirely in RAM throughout the render process, meaning the largest picture I could possibly render is around 210k x 140k (my laptop has 32 GB of RAM.)
« Last Edit: June 02, 2016, 10:39:02 PM by python.wiz » Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.25 seconds with 27 queries. (Pretty URLs adds 0.008s, 2q)