This post describes how to compile and run the pichart benchmark to compare your desktop computer with the Raspberry Pi. If your computer is running Microsoft Windows, Plan 9, OpenVMS or any other generally non-POSIX standards compliant operating system, it would be easiest to first boot into the Raspberry Pi Desktop for PC before proceeding. If you are running Windows 10 it would also be possible to install Windows Subsystem for Linux.
After logging in and obtaining a command-line shell, download the pichart source archive and unpack it with the commands
$ wget http://fractal.math.unr.edu/~ejolson/pi ... urrent.tgz
$ tar zxf pichart-current.tgz
Alternatively, use a web browser to download this
file. If your tar command doesn't natively support gzip compressed files unpack the archive using
$ gunzip <pichart-current.tgz | tar xf -
After unpacking the archive the source code will be contained in a subdirectory called pichart-current. Change to that directory and open the Makefile in a text editor. There are three lines that you may wish to change: CFLAGS, CC and TARGETS. By default these lines are set to build pichart-openmp and pichart-serial using the system C compiler with generic optimizations. Best performance, however, may be achieved by selecting architecture specific tuning options and a custom C compiler. If the chosen C compiler supports the Intel/MIT Cilk parallel programming extensions you may further want to include pichart-cilk in the list of build targets.
For this example we will be using a custom C compiler installed in /usr/local/gcc-6.5 and specify -march=native -mtune=native to build architecture optimized executables. As this compiler supports the Cilk parallel processing extensions, we also build pichart-cilk to compare with the OpenMP version. To do this, change the Makefile so the first lines read as
CFLAGS=-O3 -mtune=native -march=native -ffast-math -Wall -lm -lrt
TARGETS=pichart-serial pichart-openmp pichart-cilk
Note, if you are using a version of the GNU C compiler earlier than 5.x or later than 7.x, then it does not support Cilk and you should not add pichart-cilk to the TARGETS line. Note also that I've included the option -lrt because the clock_gettime function used by the timing routines in the benchmark are contained in the librt library of the particular version of Linux being used. Linking with -lrt is not usually needed.
Compile the source using the command
If all goes well, there should now be three executables in the directory: pichart-cilk, pichart-openmp and pichart-serial. If your computer only has a single processor core, then use run pichart-serial to create the pie chart; otherwise, use either pichart-openmp or pichart-cilk to make the comparison.
The computer being tested in this example is a dual-processor Intel Pentium III server running at 650 MHz. This machine has two cores so I'll run both pichart-cilk and pichart-openmp to see which one gives the best result. The programs accept an option -t which can be used to give a descriptive label to the benchmark run as it appears in the pie chart. Otherwise, the default label "My Computer" is used. Between each run I'll copy the output file pichart.svg to a safe place so it doesn't get overwritten by the next run.
Code: Select all
$ ./pichart-cilk -t "dual PIII 650MHz"
pichart -- Raspberry Pi Performance CILKPLUS version 23
Prime Sieve P=14630843 Threads=2 Sec=4.76001 Mops=196.287
Merge Sort N=16777216 Threads=2 Sec=10.6594 Mops=37.7746
Fourier Transform N=4194304 Threads=2 Sec=9.29035 Mflops=49.6616
Lorenz 96 N=32768 K=16384 Threads=2 Sec=28.9737 Mflops=111.178
Making pie charts...done.
$ cp pichart.svg p3cilk.svg
$ ./pichart-openmp -t "dual PIII 650MHz"
pichart -- Raspberry Pi Performance OPENMP version 23
Prime Sieve P=14630843 Threads=2 Sec=4.70759 Mops=198.473
Merge Sort N=16777216 Threads=4 Sec=10.9022 Mops=36.9333
Fourier Transform N=4194304 Threads=2 Sec=9.49918 Mflops=48.5698
Lorenz 96 N=32768 K=16384 Threads=2 Sec=27.9837 Mflops=115.111
Making pie charts...done.
$ cp pichart.svg p3openmp.svg
The merge sort and Fourier transforms are faster using Cilk while prime sieve and Lorenz 96 are faster using OpenMP. The differences are small enough, however, that the pie charts generated in either case are visually identical.
The resulting scalable vector graphics pie charts can be viewed using geeqie or by loading them into gimp. Gimp can also be used to convert the SVG format to, for example, PNG. For reference, here is a PNG image file corresponding to the Cilk pie chart that the above run produced:
Update: The computer tested above was actually a dual-processor Pentium III running at 650MHz. The labels on the pie chart have been fixed using Gimp.