CUDAbrot: A "Buddhabrot" Renderer using CUDA or HIP
===================================================
About
-----
This project contains a small CUDA program for rendering the Buddhabrot fractal
using a CUDA-capable GPU.
I'm aware that there are at least two other github projects named "cudabrot",
but both of them render the Mandelbrot set rather than the Buddhabrot. The
Buddhabrot set is a variant of the Mandelbrot set similar to an
[attractor](https://en.wikipedia.org/wiki/Attractor), and is generally more
processor-intensive to render. Therefore, rendering high-resolution Buddhabrot
images is an excellent application of GPU computing.
For more information on how the Buddhabrot set is rendered, see the
[Wikipedia article](https://en.wikipedia.org/wiki/Buddhabrot) for information
about the algorithm and the relationship to the Mandelbrot set.
Usage
-----
To compile and run this program, you need to be using a Linux system with CUDA
installed (the more recent the version, the better), and a CUDA-capable GPU.
See below for instructions on AMD, using HIP.
Compile the program simply by running `make`. Run it by running `./cudabrot`.
A summary of command-line arguments can be obtained by running
`./cudabrot --help`. Running the program will produce a single grayscale image.
Typically, a colored Buddhabrot image is created by rendering several single-
channel images with different parameters, then combining the results by
assigning each single-channel image to a color in the output image.
Compilation on AMD, using ROCm
------------------------------
This program has also been built and tested using ROCm 3.7 (but older versions
probably work) on AMD GPUs. To use this, you'll need to have
[installed ROCm](https://github.com/RadeonOpenCompute/ROCm), including `hip`,
`rocRAND`, and `hipRAND` (these should be installed by default if you just
follow the main ROCm installation instructions). Additionally, you'll need to
ensure that `hipcc` and `hipify-perl` are on your `PATH`. The makefile also
expects to be able to find `rocRAND` and `hipRAND` under `/opt/rocm/rocrand`
and `/opt/rocm/hiprand`, respectively.
If you satisfy all of the above requirements, then you should be able to
compile the program by running `make hip`. This will produce a `cudabrot`
binary that behaves the same way as the CUDA version. (Don't be intimidated by
these instructions--check the makefile, it's actually very simple!)
Examples and detailed description of options
--------------------------------------------
All examples below were rendered using an NVIDIA GTX 970 with 4GB of GPU RAM.
- `-d `: Example: `./cudabrot -d 0`. If you have more than one
GPU, providing the `-d` flag along with a device number allows you to run
computations on a GPU of your choosing. If the `-d` flag isn't specified,
the program defaults to using GPU 0.
- `-o