performance measurements

Each table row shows performance measurements for this C++ g++ program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1,0000.700.71868414  3% 100% 0% 1%
4,00011.1411.15872414  0% 1% 1% 100%
16,000177.98178.03872414  1% 14% 53% 34%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read mandelbrot benchmark to see what this program should do.

 notes

gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

 mandelbrot C++ g++ #3 program source code

/* The Computer Language Benchmarks Game
   http://benchmarksgame.alioth.debian.org/
   contributed by Greg Buchholz
   compile:  g++ -O3
*/

#include <stdio.h>
#include <stdlib.h>
#include<iostream>
#include<complex>

int main (int argc, char **argv)
{
  char  bit_num = 0, byte_acc = 0;
  const int iter = 50;
  const double lim = 2.0 * 2.0;
  
  std::ios_base::sync_with_stdio(false);
  int n = atoi(argv[1]);

  std::cout << "P4\n" << n << " " << n << std::endl;

  for(int y=0; y<n; ++y) 
    for(int x=0; x<n; ++x)
    {
       std::complex<double> Z(0,0),C(2*(double)x/n - 1.5, 2*(double)y/n - 1.0);
       
       //manually inlining "norm" results in a 5x-7x speedup on gcc
       for(int i=0; i<iter and Z.real()*Z.real() + Z.imag()*Z.imag() <= lim; ++i)
         Z = Z*Z + C;
        
       byte_acc = (byte_acc << 1) | ((norm(Z) > lim) ? 0x00:0x01);

       if(++bit_num == 8){ std::cout << byte_acc; bit_num = byte_acc = 0; }
       else if(x == n-1) { byte_acc  <<= (8-n%8);
                           std::cout << byte_acc;
                           bit_num = byte_acc = 0; }
    }
}

 make, command-line, and program output logs

Wed, 23 Apr 2014 23:12:58 GMT

MAKE:
/usr/bin/g++ -c -pipe -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -fopenmp -mfpmath=sse -msse2 mandelbrot.gpp-3.c++ -o mandelbrot.gpp-3.c++.o &&  \
        /usr/bin/g++ mandelbrot.gpp-3.c++.o -o mandelbrot.gpp-3.gpp_run -fopenmp 
rm mandelbrot.gpp-3.c++
0.37s to complete and log all make actions

COMMAND LINE:
./mandelbrot.gpp-3.gpp_run 16000

(BINARY) PROGRAM OUTPUT NOT SHOWN

Revised BSD license

  Home   Conclusions   License   Play