Coder Social home page Coder Social logo

mandelbrot's Introduction

Mandelbrot

Mandelbrot set visualization with Python, C and CUDA.

Winner of Siraj Raval's weekly coding challenge

Picture

Dependencies:

CUDA Toolkit, Pygame, Numpy

Installation:

The included CUDA-extension must be compiled with nvcc-compiler. It creates a shared library containing the fast methods to iterate the values of the set which can be directly called from native Python code.

Linux (tested with Ubuntu 16.04 and Python 3.5):

Edit the Makefile and make sure your python path and GPU architecture are correct. List of compute levels for each Nvidia GPU: https://developer.nvidia.com/cuda-gpus

Run "make" in terminal and the extension is compiled. Finally run "python3 mandelbrot.py" to launch the program.

Windows:

Getting nvcc compile the Python extension isn't nearly as easy as on Linux. You probably have to compile the CUDA parts separately into a linked library and then import those into the Python C-extension. Compiling the Python C-extension requires Visual Studio 2015.

Usage:

Click with your mouse where you want to zoom and use numpad +/- to set the iterations to a comfortable level. At some point the precision of 64-bit floating point variables won't be enough to dive any deeper and you end up with mosaic pattern.

Performance:

The speed of the iterations seems to correlate very well with the raw double precision processing power. If your GPU can process them faster than your CPU, then the CUDA implementation will be faster after increasing the iteration level to the point where memory transfers aren't a bottleneck anymore.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.