Fractals/mightymandel

From Wikibooks, open books for an open world
Jump to: navigation, search

mightymandel is Mandelbrot set explorer made by Claude Heiland-Allen. Here one can find unofficial docs about it

Features[edit]

  • draws parameter plane of complex quadratic polynomial with boundary of Mandelbrot set
  • License GPL3+ [1]
  • perturbation technique[2] with series approximation.
  • GPGPU[3] based on OpenGL 4 ( "my GPU is much faster than my CPU ")
  • writen in C ( C99) with full src code available[4]
  • multiprecision

Plane description[edit]

Claude Heiland-Allen[4] uses center and radius for the description of parameter plane.

Radius is defined as "the difference in imaginary coordinate between the center and the top of the axis-aligned view rectangle".

So plane is described by 3 numbers:

  • center_re
  • center_im
  • radius

where center = center_re + center_im * i

Installation[edit]

Requirements[edit]

  • opengl for GPGPU
    • version 4.1 (supports 3.3 as fallback without perturbation, limiting zoom depth dramatically)
    • libraries : gl, glew,[5] glfw3,[6]
  • multiprecision ( library MPFR[7])
  • rt [8]
  • programs:
    • gcc
    • make
    • bash
    • sed
    • git
    • pkg-config
    • ts ( for test suite, see /src/test.sh ) Use in Ubunty : sudo apt-get install moreutils
    • doxygen ( for doc)
    • for video :
      • AVConv - Automatic video converter
      • FFmpeg

One can check it with ldd :

 ldd -d -v ./src/mightymandel

or look at /src/Makefile :

-lGLEW -lGL -lrt -lmpfr -lm

Debian packages[edit]

On Debian Jessie, this suffices to install everything you need to compile:[9]

sudo aptitude install \
        build-essential \
        git \
        libglew-dev \
        libglfw3-dev \
        libmpfr-dev \
        pkg-config

Getting the source[edit]

First time :

 git clone https://gitorious.org/maximus/mightymandel.git

To update src run ( from program directory):

git pull

Then one can build the program.

Remote repository[edit]

 git remote show origin

the result :

* remote origin
  Fetch URL: https://gitorious.org/maximus/mightymandel.git
  Push  URL: https://gitorious.org/maximus/mightymandel.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (fast-forwardable)

Version[edit]

 git describe

Example output :

 v14-164-g9cd6fc7

Building[edit]

Got to the mightymandel directory :

cd ~/mightymandel

and make :


make -C src clean
make -C src

or, in case of problems :[10]

make -C src EXTRA_LINK_FLAGS="-lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi"

or edit Makefile and add extra flags, but then you will have problems after updating source.

One can also build and run test suite

Errors[edit]

glfw[edit]

Package glfw3 was not found in the pkg-config search path.

Download and install glfw:[11]


cd glfw-3.0.4
hash -r
cmake -G "Unix Makefiles"
make
sudo make install

Ubuntu 14.10 ( utopic ) has packages for glfw3[12] ( but CUDA packages are only for LTS version of Ubuntu , it is now 13.04)

Next error :

LINK    mightymandel
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_clipboard.c.o): undefined reference to symbol 'XConvertSelection'
/usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line

add to makefile ( on Ubuntu 13.10 64-bit) :

   -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi \

check[edit]

file  ./mightymandel
./mightymandel: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x2a424b6dcad8de5e29e3f0b17524dbf34de18aaa, not stripped

Runing[edit]

Go to the program directory and :

./src/mightymandel

Version[edit]

 ./src/mightymandel—version

example result :

v16-10-gd079448+2015-01-20-16-40-55

Examples[edit]

mm[edit]

One can run ( from program directory) example parameter file fp32.mm using :

./src/mightymandel ./examples/mm/fp32.mm


par[edit]

Now mightymandel does not load native fractint par files. They need to be transformed to ppar files.

How to preproces Fractint par file ?

  • Split txt file ( with parameters for many images ) into single image files ( with 7 lines of original file)
  • splite line with many parameters into lines with one parameter per line ( replace space into newline)
  • add ppar extension :[13]
  • remove all par files without :
    • "type=mandel" ( mightymandel can draw only mandelbrot set )
    • "corners=" or "center-mag="
#!/usr/bin/env bash
# chmod +x s.sh
# ./s.sh
for f in *.txt; 
do 	
 echo " found "$f " file ";
 #split -l 7 $f; 
 awk '/{/{n++}{print > n".p" }' $f
 echo $f "- split when { is found  and add p extension " ;
 rm $f;
 echo " input file " $f " is removed " ;
done

for f in *.p; 	
do
 echo " in "$f " file replace space with newline and add ppar extension"
 # tr '{}' '()' < infile > outfile
 tr ' ' '\n' < $f >$f"par"
 rm $f;
done

for f in *.ppar; 	
do
 echo "remove blank= empty lines"
 sed -i '/^$/d' $f
done

Comment : "pre-processing script removes the input without asking, which is a bit rude! And it doesn't support merging lines ending in \ " Claude

Here is split2ppar.sh by Claude

#!/bin/bash
tmp="$(mktemp -d --tmpdir=. split2ppar.XXXXXXXX)"
for file in "${@}"
do
  name="$(basename "${file}")"
  file="$(readlink -e "${file}")"
  pushd "${tmp}"
  awk "/{/{n++}{print > \"${name}_\"n\".par\" }" "${file}"
  popd
done
pushd "${tmp}"
for file in *.par
do
  ident="$(head -n 1 "${file}" | sed 's/ .*$//')"
  mv "${file}" "${ident}.par"       # rename input
  cat < "${ident}.par" |            # read input
  sed 's/;.*$//' |                  # delete ; comments
  tr '\n' ' ' |                     # join on one line with spaces
  sed 's/\\ *//g' |                 # merge lines ended with '\'
  tr -s ' ' |                       # compress multiple ' ' to single ' '
  sed 's/^.*{\([^}]*\)}.*$/\1/' |   # extract the part between { }
  tr ' ' '\n' |                     # split into separate lines
  cat > "${ident}.ppar"             # write output
done
popd
ls "${tmp}/"*

ppar[edit]

Preprocessed par files are in /examples/ppar directory. Use :

./src/mightymandel ./examples/ppar/1_02.ppar

test[edit]

One can run test suite :

 make -C src test EXTRA_LINK_FLAGS="-lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi"

Example output :

real       56m25.351s
user    33m50.995s
sys     21m38.976s

See also :

  • content of csv file int test directory
  • images in test directory

Benchmark[edit]

See file BENCHMARKS in program directory for more details

Check hardware[edit]

  • type and version of the Central processing unit ( CPU ) [14]
  • type and version of the graphics processing unit ( GPU )[15]
  • version of the video card[16] device driver[17] ( DRV ) and which version of OpenGl[18] it supports

Example output :

cat /proc/cpuinfo | grep model\ name

model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
model name	: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz

lspci | grep VGA

01:00.0 VGA compatible controller: NVIDIA Corporation GK104 [GeForce GTX 770] (rev a1)

 glxinfo | grep OpenGL\ version

OpenGL version string: 4.3.0 NVIDIA 319.32

Run benchmark[edit]

 time ./src/mightymandel --verbose warn --one-shot --de --weight -1.5 --glitch --size "1280x720" examples/mm/fp32-large-minibrot.mm
fp32-large-minibrot.mm,ok,fp32,322.402263,85.265842,14.734158,,

real	0m0.643s
user	0m0.188s
sys	0m0.236s

Images[edit]

Galleries :

comment[edit]

To extract comment from ppm file :[20]

 identify -format "%c" 1.ppm

or

 head -n 2 1.ppm | tail -n 1

example output :

mightymandel -1.8605739600158748e+00 + -9.3437424499999996e-07 i @ 3.5884749956982262e-09

and from png file :

extract k2000.png


colors[edit]

  • white = exterior of Mandelbrot set
  • black = boundary of Mandebot set ( using DEM )
  • red = glitches
  • yellow = known interior of Mandelbrot set
  • blue = uncalculated

Documentation[edit]

  • official online[21]

How to make offline doc with doxygen ?[edit]

How to contribute ?[edit]

git checkout master
git pull                         # get up to date
git checkout -b new-feature-42   # create a branch for your new feature
# make your changes, check that they compile and run ok
git add your-changed-files
git commit                       # write a description of your changes
git format-patch master          # save your changes to file(s)

If path file was not created try :

git format-patch origin/master # https://eothred.wordpress.com/2011/07/02/git-and-patches/

then email the .patch files to Claude

References[edit]

  1. License GPL3+
  2. Perturbation glitches
  3. General-purpose computing on graphics processing units in wikipedia
  4. Git repository
  5. The OpenGL Extension Wrangler Library
  6. OpenGl in C
  7. The GNU MPFR Library
  8. librt library
  9. README for mightymandel
  10. Fractal Forum - mightymandel
  11. and Ubuntu
  12. Package: glfw3 (3.0.4-1) [universe]
  13. how-to-add-an-extension-to-all-files-via-terminal
  14. CPU in wikipedia)
  15. GPU in wiki[edia
  16. Video card in wiki
  17. Device driver in wikipedia
  18. OpenGl in wikipedia
  19. online official doc gallery
  20. stackexchange question : How to extract comment from ppm file?
  21. official online doc