Skip to content

legoman0701/pyopencl_mandelbrot_fractal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Mandelbrot set fractals in Python and OpenCL

This Python project to render the Mandelbrot set fractal in real-time using OpenCL. By offloading the computationally intensive task to the GPU, it achieves significant performance gains compared to pure CPU-based implementations.

Getting started

git clone https://github.com/legoman0701/pyopencl_mandelbrot_fractal.git
python -m pip install pyopencl numpy pygame

Usage

python main.py

Controls

F: Toggle fullscreen mode
Arrow keys: Pan the view
A/Z: Zoom in/out
Q/S: Adjust the maximum iteration count (influences detail and color)

How it Works

  • Initializes an OpenCL context, connecting to the available GPU devices.
  • Compiles the OpenCL kernel code, which defines the parallel computation for each pixel.
  • Allocates device memory for input parameters (image dimensions, iteration count, etc.) and output buffer (the rendered image).
  • Enqueues the kernel to the command queue, specifying the work group size and global work size.
  • Transfers the rendered image data from device memory back to the host.
  • Renders the image using a pygame.

Images

main 1 2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages