vectorize binning

In this exercises you will speed-up the filling of an histogram in cartesian coordinates starting from points in polar coordinates

  1. start from the code in binning.cpp

  2. compile it and use ‘perf record ./a.out’ & ‘perf report’ to identify “hot spots’

  3. modify it to use sin and cos from simpleSinCos.h

  4. optimize it to run faster in scalar mode

  5. modify the code to enable auto-vectorization

  6. Change the code to use gcc native-vectors

for each version compile with

  • c++ -g -O2 -Wall -fopt-info-vec -march=native binning.cpp

  • c++ -g -O3 -Wall -fopt-info-vec -march=native binning.cpp

  • c++ -g -Ofast -Wall -fopt-info-vec -march=native binning.cpp

  • try -funroll-loops

in case you decide to further optimize simpleSinCos make sure it reproduces the results.

For a full discussion of the optimization techniques that can be used in the solution look at the paper by Colfax

Bonus: add thread parallelization with OpenMP

More Bonuses: new compilers try harder: