parallelbrot
Mandelbrot set renderer with CPU, OpenCL and CUDA backends — a Python package for generating fractal images, and an interactive real-time viewer.
Install
pip install parallelbrot
# or
uv add parallelbrot
Wheels are abi3, so one wheel per platform covers CPython 3.9 and up —
the wheel is built on 3.9 and installs unchanged on 3.14.
| Platform | Wheel |
|---|---|
| Linux x86_64, aarch64 | manylinux_2_28 |
| macOS arm64 | 15.0+ |
| macOS x86_64 | 14.0+ |
| Windows x64 | ✅ |
The macOS floors come from Homebrew's libomp, which the wheels bundle for
multi-threaded rendering. On older macOS, install from source or conda-forge.
Command line
parallelbrot # 1920x1080 -> mandelbrot.png
parallelbrot -o seahorse.png -s 3840x2160 \
-c -0.743644,0.131826 -z 4000 -i 1000 --colors ocean
parallelbrot --info # what backends are usable here
| Option | Default | Meaning |
|---|---|---|
-o, --output |
mandelbrot.png |
Output path |
-s, --size |
1920x1080 |
WIDTHxHEIGHT |
-c, --center |
-0.5,0.0 |
REAL,IMAG |
-z, --zoom |
1.0 |
Magnification |
-i, --iterations |
128 |
Escape limit |
--colors |
fire |
Palette |
-b, --backend |
auto |
auto, cpu, opencl, cuda |
-q, --quiet |
Suppress the summary line |
PNG writing is built in, so the CLI needs nothing beyond NumPy.
Python API
import parallelbrot as pb
image = pb.render(1920, 1080) # (1080, 1920, 4) float32 RGBA
Zoom in on the seahorse valley, and save it:
import parallelbrot as pb
image = pb.render(
1920, 1080,
center=(-0.743644, 0.131826),
zoom=4000,
max_iterations=1000,
color_scheme="fire",
)
pb.save_png("seahorse.png", image)
save_png needs nothing beyond NumPy. The array is ordinary float32, so
Pillow, matplotlib or imageio all work on it too if you already have them:
import matplotlib.pyplot as plt
plt.imshow(pb.render(800, 600, zoom=200, center=(-0.75, 0.1)))
plt.axis("off")
plt.show()
render()
| Argument | Default | Meaning |
|---|---|---|
width, height |
— | Output size in pixels |
center |
(-0.5, 0.0) |
Point on the complex plane at the image centre |
zoom |
1.0 |
Magnification; the view spans 4 / zoom |
max_iterations |
128 |
Escape limit — raise it as you zoom in |
color_scheme |
"fire" |
ultra_fractal, fire, ocean or psychedelic |
backend |
"auto" |
auto, cpu, opencl or cuda |
origin |
"upper" |
upper puts row 0 at the top, as images expect |
Returns an (height, width, 4) float32 array with values in [0, 1].
Choosing a backend
import parallelbrot as pb
pb.available_backends() # ('cpu',) — compiled in and a device is present
pb.compiled_backends() # ('cpu', 'opencl') — compiled in, device or not
pb.device_name("opencl") # 'NVIDIA GeForce RTX 4070' or None
pb.has_openmp() # is the CPU backend multi-threaded?
backend="auto" picks the fastest backend that has a working device, falling
back to the CPU.
Rendering releases the GIL, so calls from separate threads run in parallel:
import parallelbrot as pb
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor() as pool: # renders a zoom
frames = list(pool.map( # sequence in parallel
lambda z: pb.render(640, 480, zoom=z), [2**i for i in range(12)]
))
Which backends do you get?
| CPU (OpenMP) | OpenCL | CUDA | |
|---|---|---|---|
pip install / uv add |
✅ | — | — |
| conda-forge | ✅ | ✅ | ✅ |
| built from source | ✅ | if headers found | if nvcc found |
PyPI wheels are CPU-only on purpose. Linking OpenCL makes the extension require an ICD loader at import time, which would break the package on machines without a GPU driver — including for people who only wanted the CPU backend. conda can declare that loader as a dependency, so the GPU builds live there.
The CPU backend is not a toy: OpenMP parallelises across rows with dynamic scheduling, since interior points cost far more than exterior ones. A 1920×1080 frame at 1000 iterations takes 37 ms on 16 cores, against 506 ms single-threaded.
Interactive viewer
A real-time pan-and-zoom window, built separately from the Python package.
make install-deps-ubuntu # or -fedora, -arch, -macos
make opencl && bin/mandelbrot_opencl # any GPU — recommended
make cuda && bin/mandelbrot_cuda # NVIDIA only, fastest
make cpu && bin/mandelbrot_cpu # always works
| Input | Action |
|---|---|
| Mouse drag | Pan |
| Mouse wheel | Zoom, centred on the cursor |
| Arrow keys | Pan |
+ / - |
Increase / decrease iterations |
C |
Cycle colour schemes |
R |
Reset view |
Esc |
Quit |
make help lists every target; make check-opencl and make check-cuda
report what your machine can do.
Viewer dependencies
| Component | Linux | macOS | Windows (MSYS2) |
|---|---|---|---|
| Compiler | g++ (GCC ≥ 9) |
Apple Clang | MinGW-w64 g++ |
| Build | make, pkg-config |
make, pkg-config |
GNU make, pkg-config |
| OpenGL | libgl1-mesa-dev, libglew-dev |
built-in | mingw-w64-x86_64-glew |
| GLFW 3 | libglfw3-dev |
brew install glfw |
mingw-w64-x86_64-glfw |
| OpenCL | ocl-icd-opencl-dev + driver |
built-in framework | mingw-w64-x86_64-opencl-icd |
| CUDA (optional) | nvidia-cuda-toolkit + driver 470+ |
not supported | CUDA Toolkit |
GPU drivers: NVIDIA needs the proprietary driver or nvidia-opencl-dev; AMD
needs rocm-opencl-runtime or mesa-opencl-icd; Intel needs
intel-opencl-icd. macOS provides OpenCL itself.
Building from source
git clone https://github.com/prathamhole14/parallelbrot
cd parallelbrot
uv sync # venv + dev dependencies, package built editable
uv run pytest
uv run python -c "import parallelbrot as p; print(p.compiled_backends())"
Without uv:
pip install -e . # rebuilds the C++ on import when sources change
pytest
Build options are Meson features, so absent tooling degrades the build rather than failing it:
uv sync -C setup-args=-Dopencl=enabled # fail if OpenCL is missing
uv sync -C setup-args=-Dopenmp=disabled # single-threaded CPU backend
python -m build --wheel # a cp3XX-abi3 wheel
macOS needs brew install libomp for a multi-threaded CPU backend — Apple
Clang ships without OpenMP. pb.has_openmp() tells you which you got.
Layout
include/parallelbrot/core.hpp Shared View struct + backend entry points
src/core/ Compute cores — no windowing, no Python
src/cpu|opencl|cuda/ Interactive frontends + device kernels
src/python/ CPython extension (limited API)
src/parallelbrot/ Python package
meson.build, pyproject.toml Wheel build
Makefile Interactive viewer binaries
The compute cores carry no GLFW, OpenGL or Python headers, so the same code serves the viewer, the Python package and the tests.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parallelbrot-0.1.1.tar.gz.
File metadata
- Download URL: parallelbrot-0.1.1.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d95a81585a48af810c18900a69ed711cdddf884c2940daaea47574e088ba2fb
|
|
| MD5 |
0c5bcaaabc1184956c463a60f29766e2
|
|
| BLAKE2b-256 |
d1c48602a27e9202a961d310ab43b3f6ed9f4524f4fa48530c707865bbd3d108
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1.tar.gz:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1.tar.gz -
Subject digest:
1d95a81585a48af810c18900a69ed711cdddf884c2940daaea47574e088ba2fb - Sigstore transparency entry: 2752603029
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parallelbrot-0.1.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: parallelbrot-0.1.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 260.2 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62b9f965fabc181c0f7e6c2fbd984f815b22d2581b1d44e052f3e5fa11f1bfa
|
|
| MD5 |
6aa47b11c0e8443a46c1f3dc50ae7094
|
|
| BLAKE2b-256 |
be9aee33c851aa91e61678806ba8a7e43598c86458cc05863785de599108cac2
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1-cp39-abi3-win_amd64.whl:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1-cp39-abi3-win_amd64.whl -
Subject digest:
f62b9f965fabc181c0f7e6c2fbd984f815b22d2581b1d44e052f3e5fa11f1bfa - Sigstore transparency entry: 2752603448
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parallelbrot-0.1.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: parallelbrot-0.1.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 130.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1fb98fe247c45ede436e4939594cf144caf623d4da64ab6b1e122ebd2efa5a3
|
|
| MD5 |
e1a191dc1112e3ee7be18535222d7c07
|
|
| BLAKE2b-256 |
d332617b747fb3358e0f7a4fb211d019abf248139fa50dd734c5dca1154f963e
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
e1fb98fe247c45ede436e4939594cf144caf623d4da64ab6b1e122ebd2efa5a3 - Sigstore transparency entry: 2752603312
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parallelbrot-0.1.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: parallelbrot-0.1.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 126.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e84255930cdbed38cf38099edf14304fc989f5d4836739ea7dbdc508ebad265
|
|
| MD5 |
1ceeaa8f65a860c7b84c28250f62b58e
|
|
| BLAKE2b-256 |
165a01f5d3e3fe66da6f20783f25cb3e515dcd2e27e4cbcb02434cf6191cbd3f
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
6e84255930cdbed38cf38099edf14304fc989f5d4836739ea7dbdc508ebad265 - Sigstore transparency entry: 2752603560
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parallelbrot-0.1.1-cp39-abi3-macosx_15_0_arm64.whl.
File metadata
- Download URL: parallelbrot-0.1.1-cp39-abi3-macosx_15_0_arm64.whl
- Upload date:
- Size: 258.3 kB
- Tags: CPython 3.9+, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a51fe8f2aab4de0269ac00fe397453a87f880e19f0f4621a287b0ef79f17f62a
|
|
| MD5 |
ee97c55c7b18070637e40f6cc4491bc5
|
|
| BLAKE2b-256 |
39b216ec7d33debd8759c84b5af20508684b30f3051e14daadc7bbcef06121f8
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1-cp39-abi3-macosx_15_0_arm64.whl:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1-cp39-abi3-macosx_15_0_arm64.whl -
Subject digest:
a51fe8f2aab4de0269ac00fe397453a87f880e19f0f4621a287b0ef79f17f62a - Sigstore transparency entry: 2752603631
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parallelbrot-0.1.1-cp39-abi3-macosx_14_0_x86_64.whl.
File metadata
- Download URL: parallelbrot-0.1.1-cp39-abi3-macosx_14_0_x86_64.whl
- Upload date:
- Size: 289.9 kB
- Tags: CPython 3.9+, macOS 14.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2606e6bf12a135f5fcddd56fd4fdaa8666e05921c1d276e0efacd7e7e0772b1
|
|
| MD5 |
be597947612fddc0a51868a97e7d86ca
|
|
| BLAKE2b-256 |
c618e6c0408a63f1e810deb32ff03bb35b53983f67fcdb2a5cb09c74b9213f6f
|
Provenance
The following attestation bundles were made for parallelbrot-0.1.1-cp39-abi3-macosx_14_0_x86_64.whl:
Publisher:
wheels.yml on prathamhole14/parallelbrot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallelbrot-0.1.1-cp39-abi3-macosx_14_0_x86_64.whl -
Subject digest:
e2606e6bf12a135f5fcddd56fd4fdaa8666e05921c1d276e0efacd7e7e0772b1 - Sigstore transparency entry: 2752603185
- Sigstore integration time:
-
Permalink:
prathamhole14/parallelbrot@d209606572f11b37c33ddea4872c866de7de0210 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/prathamhole14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@d209606572f11b37c33ddea4872c866de7de0210 -
Trigger Event:
push
-
Statement type: