| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
For the moment, this repository contains only one example (but you may also be interested by exploring_coarrays).
ppm_coarray_buddhabrot.f90 is a CLI program drawing a Buddhabrot in a portable pixmap binary format (PPM) file, a very basic uncompressed image file format. Each Fortran image is computing its own Buddhabrot, and they are finally summed using the co_sum() collective subroutine. The process is therefore very similar to what is done in astrophotography.
In the Buddhabrot, the intensity of a pixel is proportional to the number of times it was visited by the $z_n$ complex sequence defining the Mandelbrot set, considering only sequences starting from points not in the Mandelbrot set (and therefore diverging $z_n$ sequences).
Instead of partitioning the complex plane in several images, we have chose to simply use a Monte Carlo algorithm: each image is computing a lot of $z_n$ sequences using $c$ random complex values. At the end, all the results are summed using the co_sum() collective subroutine.
You can modify the contrast by setting the multiplication factor parameter used in the grey level computation.
You can also study the Anti-Buddhabrot by reversing the modulus test:
if (real(z(iterations))**2 + aimag(z(iterations))**2 < 4._wp) thento consider only $z_n$ sequences starting from points inside the Mandelbrot set.
Starting from version 16, GFortran supports natively coarrays using shared memory mulithreading on single node machines:
$ gfortran -Ofast -fcoarray=lib ppm_coarray_buddhabrot.f90 -lcaf_shmem && ./a.outThe -lcaf_shmem is necessary until a -fcoarray=shared option is added in a later GFortran release.
You can force the number of images (8 for example) with:
$ export GFORTRAN_NUM_IMAGES=8You can also add the -march=native -mtune=native options for further optimization.
You needed to install OpenCoarrays and type that command (8 images here):
$ caf -Ofast ppm_coarray_buddhabrot.f90 && cafrun -n 8 ./a.out$ ifx -Ofast -coarray ppm_coarray_buddhabrot.f90 && ./a.outThe number of images can be set with the option -coarray-num-images=8.
Flang 22.1 offers an experimental support for coarrays with the option -fcoarray.
Distributed under the MIT license.
| Back | FazBrowse Home | New Git URL |