Difference between revisions of "The parallelizing Express"

From CDOT Wiki
Jump to: navigation, search
(The parallelizing Express)
(Assignment 1)
Line 357: Line 357:
 
   0.00      7.43    0.00  347184    0.00    0.00  update_stack(Board*)
 
   0.00      7.43    0.00  347184    0.00    0.00  update_stack(Board*)
 
   0.00      7.43    0.00      24    0.00    0.00  std::__deque_buf_size(unsigned long)
 
   0.00      7.43    0.00      24    0.00    0.00  std::__deque_buf_size(unsigned long)
 +
 +
 +
----
 +
 +
=== '''ColorTransfer''' ===
 +
 +
The Source code can be found [https://github.com/tatsy/ImageProcessing/tree/master/ColorTransfer here]
 +
This program is an implementation of image color transfer detailed by Erik Reinhard and coded by [https://github.com/tatsy Tatsy]
 +
This program takes 2 images the first image denoted by the args is the image taking in colours.
 +
The second image is an image that the program will use to edit the first image using the colours found.
 +
 +
 +
==== '''Creating and Running the Project with gprof profiling''' ====
 +
 +
 +
Perform the following steps in a Linux/Unix System:
 +
 +
STEP 1 - Download the following zip and extracts its contents
 +
-> Link:
 +
STEP 2 - Install all the required entries(make,cmake,git,gprof,etc) with the following terminal command:
 +
-> sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev binutils
 +
STEP 3 - Download and Install OpenCV from their official page located [http://opencv.org/ here]. You can do this with the following steps and commands:
 +
-> Download the latest source data of [http://opencv.org/ OpenCV] for Linux/Mac
 +
-> Extract the zipped source data into its appropriately named folder opencv-(latest version)
 +
-> Open terminal and enter us the cd command to enter the extracted folder opencv-(latest version)
 +
-> Create a build directy with the command mkdir build
 +
-> Use the cd command to enter the build folder
 +
-> Use the following cmake command to generate the appropriate files for the make command: cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
 +
-> Use make with the -j7 command to allow for up to 7 jobs when preparing the install: make -j7
 +
-> Install with: sudo make install
 +
-> OpenCV should be installed
 +
STEP 4 - Use the Test Folder provided by the dropbox link above to see if OpenCV is working correctly. You can follow these steps to do so
 +
-> In terminal cd into the test folder
 +
-> cmake .
 +
-> make
 +
-> run display image with the follow command ./DisplayImage ahri.jpg
 +
-> If the image provided is displayed OpenCV should be in working order.
 +
STEP 5 - Build the ColorTransfer program with the folder provided by the dropbox link and create a flat profile using gprof
 +
-> Create the files for make using the following command: cmake -DCMAKE_CXX_FLAGS=-pg -DCMAKE_EXE_LINKER_FLAGS=-pg -DCMAKE_SHARED_LINKER_FLAGS=-pg .
 +
-> The additional options include -pg within the cmake so that the appropriate gmon.out can be created for gprof
 +
-> After the files are generated use the make command
 +
-> Run the created program with 2 arguments arg1 being the image beind editted and arg2 being the image to take colours from (two images are provided for your convenience).
 +
-> If using the provided image the command should like: ./ColorTransfer ahri.jpg ahri2.jpg
 +
-> This should generate the colour transferred output image as well as the appropriate gmon.out file
 +
-> Use the either of the following commands for the flat profile: gprof -p -b ./ColorTransfer > ColorTransfer.flt  OR  gprof test_gprof gmon.out > analysis.txt
 +
 +
 +
==== '''Example Output''' ====
 +
 +
If using the examples provided you should have the following image results:
 +
 +
 +
==== '''Profile''' ====

Revision as of 22:22, 17 February 2017

                          ______                         
                    _.-*'"      "`*-._                   
               _.-*'                  `*-._              
            .-'                            `-.           
 /`-.    .-'                  _.              `-.        
:    `..'                  .-'_ .                `.      
|    .'                 .-'_.' \ .                 \     
|   /                 .' .*     ;               .-'"     
:   L                    `.     | ;          .-'         
 \.' `*.          .-*"*-.  `.   ; |        .'            
 /      \        '       `.  `-'  ;      .'              
: .'"`.  .       .-*'`*-.  \     .      (_               
|              .'        \  .             `*-.           
|.     .      /           ;                   `-.        
:    db      '       d$b  |                      `-.     
.   :PT;.   '       :P"T; :                         `.   
:   :bd;   '        :b_d; :                           \  
|   :$$; `'         :$$$; |                            \ 
|    TP              T$P  '                             ;
:                        /.-*'"`.                       |

.sdP^T$bs. /' \ $$$._.$$$$b.--._ _.' .--.  ; `*$$$$$$P*' `*--*' ' / \  :

  \                        .'   ; ;   [bug]              
   `.                  _.-'    ' /                       
     `*-.                      .'                        
         `*-._            _.-*'                          
              `*=--..--=*'


The parallelizing Express

Repository

Team Members

  1. Abbas Zoeb
  2. Jadrian Sunga
  3. Marko Radmanovic
Email All

Progress

Assignment 1

SudokuMP

SudokuMP solves sudoku puzzles given a txt file arranging the puzzle and the size of the puzzle. There are two methods to solve said puzzles the brute force method and the humanistic solver. Profiling wasn't performed on the humanistic solver since it manages to solve all the 16x16 puzzles extremely quickly the worst of them still being under 12ms. The project can be found here: SudokuMP

16x16 easy 1

Command line: ./sudoku src/16x16/easy1.txt 16

   Before :                                                  After :
   00 00 00 00 | 00 00 00 08 | 00 00 07 00 | 00 05 04 00     11 01 09 10 | 06 13 03 08 | 02 14 07 12 | 16 05 04 15  
   00 00 04 00 | 00 02 16 00 | 01 05 00 11 | 09 12 00 00     06 15 04 13 | 10 02 16 14 | 01 05 03 11 | 09 12 08 07  
   00 08 00 07 | 05 00 15 11 | 09 04 16 00 | 02 00 00 00     14 08 03 07 | 05 12 15 11 | 09 04 16 06 | 02 10 13 01  
   05 00 12 16 | 01 09 00 00 | 00 13 00 00 | 00 00 00 06     05 02 12 16 | 01 09 07 04 | 08 13 10 15 | 03 11 14 06
   -----------------------------------------------------     -----------------------------------------------------
   15 00 10 00 | 00 00 02 00 | 00 00 05 00 | 00 00 16 03     15 11 10 09 | 08 07 02 12 | 13 01 05 04 | 14 06 16 03  
   00 07 00 00 | 00 00 00 10 | 06 15 08 00 | 00 09 02 00     12 07 14 03 | 13 05 04 10 | 06 15 08 16 | 01 09 02 11  
   01 00 13 00 | 14 00 00 00 | 10 07 00 09 | 00 08 00 05     01 16 13 04 | 14 06 11 03 | 10 07 02 09 | 12 08 15 05  
   08 06 00 00 | 00 00 01 00 | 14 00 00 03 | 13 04 00 10     08 06 02 05 | 09 15 01 16 | 14 12 11 03 | 13 04 07 10  
   -----------------------------------------------------     -----------------------------------------------------
   13 00 16 06 | 15 00 00 09 | 00 11 00 00 | 00 00 01 02     13 14 16 06 | 15 10 05 09 | 04 11 12 08 | 07 03 01 02  
   03 00 08 00 | 12 00 06 01 | 00 00 00 07 | 00 16 00 13     03 10 08 11 | 12 04 06 01 | 15 02 14 07 | 05 16 09 13  
   00 05 01 00 | 00 14 08 07 | 16 00 00 00 | 00 00 12 00     09 05 01 02 | 03 14 08 07 | 16 06 13 10 | 11 15 12 04  
   07 04 00 00 | 00 11 00 00 | 00 09 00 00 | 00 14 00 08     07 04 15 12 | 16 11 13 02 | 03 09 01 05 | 10 14 06 08  
   -----------------------------------------------------     -----------------------------------------------------
   16 00 00 00 | 00 00 12 00 | 00 00 06 01 | 15 02 00 09     16 13 07 14 | 04 03 12 05 | 11 08 06 01 | 15 02 10 09  
   00 00 00 01 | 00 08 10 06 | 12 16 00 13 | 04 00 03 00     02 09 05 01 | 11 08 10 06 | 12 16 15 13 | 04 07 03 14  
   00 00 11 08 | 02 00 09 15 | 00 03 04 00 | 00 13 00 00     10 12 11 08 | 02 01 09 15 | 07 03 04 14 | 06 13 05 16  
   00 03 06 00 | 00 16 00 00 | 05 00 00 00 | 00 00 00 00     04 03 06 15 | 07 16 14 13 | 05 10 09 02 | 08 01 11 12  


NOTE : The profiles for this project were quite large so only the most used functions are listed here. The entire profile file can be find through the links provided above the respective flat profile.

Link to full profile : FULL

Flat Profile :

Each sample counts as 0.01 seconds.
no time accumulated
 %   cumulative   self              self     total           
time   seconds   seconds    calls   s/call   s/call  name    
65.87      0.81     0.81    59789     0.00     0.00  create_copy_board(Board*)
21.14      1.07     0.26    59777     0.00     0.00  choose_cell_bf(Board*, int&, int&)
 6.51      1.15     0.08    59790     0.00     0.00  Board::Board(int)
 6.51      1.23     0.08    59777     0.00     0.00  Board::~Board()
 0.00      1.23     0.00   179709     0.00     0.00  clear_number(Board*, int, Align, int)
 0.00      1.23     0.00   179370     0.00     0.00  Board* const& std::forward<Board* const&>(std::remove_reference<Board* const&>::type&)
 0.00      1.23     0.00    59903     0.00     0.00  update_solution(Board*, int, int, int)
 0.00      1.23     0.00    59790     0.00     0.00  _ZN9__gnu_cxx13new_allocatorIP5BoardE9constructIS2_IRKS2_EEEvPT_DpOT0_
 0.00      1.23     0.00    59790     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__construct_helper<Board*, Board* const&>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      1.23     0.00    59790     0.00     0.00  decltype (_S_construct({parm#1}, {parm#2}, (forward<Board* const&>)({parm#3}))) std::allocator_traits<std::allocator<Board*> >::construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      1.23     0.00    59790     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::push_back(Board* const&)
 0.00      1.23     0.00    59790     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::push(Board* const&)
 0.00      1.23     0.00    59790     0.00     0.00  operator new(unsigned long, void*)
 0.00      1.23     0.00    59784     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::_Deque_iterator(std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      1.23     0.00    59780     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::end()
 0.00      1.23     0.00    59778     0.00     0.00  void __gnu_cxx::new_allocator<Board*>::destroy<Board*>(Board**)
 0.00      1.23     0.00    59778     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator*() const
 0.00      1.23     0.00    59778     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::empty() const
 0.00      1.23     0.00    59778     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::empty() const
 0.00      1.23     0.00    59778     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator--()
 0.00      1.23     0.00    59778     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__destroy_helper<Board*>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      1.23     0.00    59778     0.00     0.00  void std::allocator_traits<std::allocator<Board*> >::destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      1.23     0.00    59778     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::back()
 0.00      1.23     0.00    59778     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::pop_back()
 0.00      1.23     0.00    59778     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::pop()
 0.00      1.23     0.00    59778     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::top()
 0.00      1.23     0.00    59778     0.00     0.00  bool std::operator==<Board*, Board*&, Board**>(std::_Deque_iterator<Board*, Board*&, Board**> const&, std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      1.23     0.00    59777     0.00     0.00  update_stack(Board*)
 0.00      1.23     0.00       24     0.00     0.00  std::__deque_buf_size(unsigned long)

16x16 easy 2

Command line: ./sudoku src/16x16/easy2.txt 16

   Before :                                                  After :
   00 00 00 00 | 13 00 12 00 | 03 00 05 00 | 00 08 01 10     09 16 06 02 | 13 04 12 07 | 03 11 05 15 | 14 08 01 10
   01 00 15 04 | 09 00 16 14 | 13 12 00 00 | 06 00 00 03     01 07 15 04 | 09 05 16 14 | 13 12 10 08 | 06 11 02 03  
   00 13 00 05 | 00 00 00 10 | 00 09 00 02 | 07 12 00 00     11 13 03 05 | 01 08 06 10 | 14 09 04 02 | 07 12 15 16  
   08 00 00 00 | 00 15 02 00 | 00 01 06 00 | 00 00 04 00     08 14 10 12 | 03 15 02 11 | 07 01 06 16 | 05 13 04 09  
   -----------------------------------------------------     -----------------------------------------------------
   00 04 00 00 | 00 00 00 00 | 00 00 00 05 | 02 00 00 14     16 04 07 09 | 06 10 15 12 | 11 08 01 05 | 02 03 13 14  
   00 00 01 06 | 00 00 00 00 | 15 13 00 14 | 00 00 16 12     03 08 01 06 | 11 02 04 09 | 15 13 07 14 | 10 05 16 12  
   00 12 00 00 | 00 00 00 08 | 00 03 00 04 | 01 00 07 00     10 12 11 13 | 16 14 05 08 | 02 03 09 04 | 01 06 07 15  
   00 00 00 15 | 00 03 01 00 | 16 00 00 10 | 00 04 08 11     05 02 14 15 | 07 03 01 13 | 16 06 12 10 | 09 04 08 11  
   -----------------------------------------------------    -----------------------------------------------------
   00 00 00 00 | 00 00 08 16 | 00 04 00 01 | 00 14 00 00     12 03 02 10 | 15 07 08 16 | 09 04 13 01 | 11 14 05 06  
   00 15 00 00 | 00 06 09 00 | 10 05 11 00 | 00 16 12 01     04 15 08 07 | 14 06 09 02 | 10 05 11 03 | 13 16 12 01  
   00 11 09 00 | 00 00 00 00 | 08 00 00 00 | 00 02 03 07     06 11 09 16 | 10 01 13 05 | 08 15 14 12 | 04 02 03 07  
   13 00 00 00 | 00 12 11 00 | 06 02 16 07 | 00 00 00 00     13 01 05 14 | 04 12 11 03 | 06 02 16 07 | 15 09 10 08  
   -----------------------------------------------------     -----------------------------------------------------
   00 10 12 00 | 00 13 03 00 | 04 00 15 00 | 16 00 00 05     14 10 12 08 | 02 13 03 06 | 04 07 15 09 | 16 01 11 05  
   02 00 04 00 | 00 00 07 01 | 00 00 00 06 | 00 00 14 13     02 09 04 11 | 05 16 07 01 | 12 10 03 06 | 08 15 14 13  
   00 00 00 03 | 08 09 00 00 | 01 16 02 11 | 12 10 00 00     07 05 13 03 | 08 09 14 15 | 01 16 02 11 | 12 10 06 04  
   00 00 16 01 | 12 11 00 00 | 05 14 00 00 | 03 07 09 00     15 06 16 01 | 12 11 10 04 | 05 14 08 13 | 03 07 09 02  

Link to full profile : FULL

Flat Profile :

Each sample counts as 0.01 seconds.
no time accumulated
 %   cumulative   self              self     total           
time   seconds   seconds    calls  Ts/call  Ts/call  name    
 0.00      0.00     0.00      975     0.00     0.00  clear_number(Board*, int, Align, int)
 0.00      0.00     0.00      633     0.00     0.00  Board* const& std::forward<Board* const&>(std::remove_reference<Board* const&>::type&)
 0.00      0.00     0.00      325     0.00     0.00  update_solution(Board*, int, int, int)
 0.00      0.00     0.00      217     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::_Deque_iterator(std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      0.00     0.00      213     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::end()
 0.00      0.00     0.00      211     0.00     0.00  Board::Board(int)
 0.00      0.00     0.00      211     0.00     0.00  void __gnu_cxx::new_allocator<Board*>::destroy<Board*>(Board**)
 0.00      0.00     0.00      211     0.00     0.00  _ZN9__gnu_cxx13new_allocatorIP5BoardE9constructIS2_IRKS2_EEEvPT_DpOT0_
 0.00      0.00     0.00      211     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator*() const
 0.00      0.00     0.00      211     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::empty() const
 0.00      0.00     0.00      211     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::empty() const
 0.00      0.00     0.00      211     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator--()
 0.00      0.00     0.00      211     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__destroy_helper<Board*>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      0.00     0.00      211     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__construct_helper<Board*, Board* const&>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      0.00     0.00      211     0.00     0.00  void std::allocator_traits<std::allocator<Board*> >::destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      0.00     0.00      211     0.00     0.00  decltype (_S_construct({parm#1}, {parm#2}, (forward<Board* const&>)({parm#3}))) std::allocator_traits<std::allocator<Board*> >::construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      0.00     0.00      211     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::back()
 0.00      0.00     0.00      211     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::pop_back()
 0.00      0.00     0.00      211     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::push_back(Board* const&)
 0.00      0.00     0.00      211     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::pop()
 0.00      0.00     0.00      211     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::top()
 0.00      0.00     0.00      211     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::push(Board* const&)
 0.00      0.00     0.00      211     0.00     0.00  bool std::operator==<Board*, Board*&, Board**>(std::_Deque_iterator<Board*, Board*&, Board**> const&, std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      0.00     0.00      211     0.00     0.00  operator new(unsigned long, void*)
 0.00      0.00     0.00      210     0.00     0.00  update_stack(Board*)
 0.00      0.00     0.00      210     0.00     0.00  choose_cell_bf(Board*, int&, int&)
 0.00      0.00     0.00      210     0.00     0.00  create_copy_board(Board*)
 0.00      0.00     0.00      210     0.00     0.00  Board::~Board()
 0.00      0.00     0.00       24     0.00     0.00  std::__deque_buf_size(unsigned long)

16x16 medium 1

Command line: ./sudoku src/16x16/medium1.txt 16

   Before :                                                  After :
   00 00 06 15 | 00 12 09 04 | 11 02 07 16 | 00 03 00 13     05 01 06 15 | 08 12 09 04 | 11 02 07 16 | 14 03 10 13  
   00 10 00 00 | 01 00 00 15 | 12 00 08 00 | 00 02 00 00     14 10 13 03 | 01 05 06 15 | 12 09 08 04 | 16 02 11 07  
   07 11 16 02 | 00 00 00 03 | 05 15 01 06 | 09 00 00 00     07 11 16 02 | 13 10 14 03 | 05 15 01 06 | 09 04 12 08  
   00 12 00 00 | 07 11 00 00 | 00 03 13 14 | 06 15 05 00     08 12 09 04 | 07 11 16 02 | 10 03 13 14 | 06 15 05 01  
   -----------------------------------------------------     -----------------------------------------------------
   00 06 12 00 | 00 00 11 00 | 00 00 03 10 | 00 13 14 15     04 06 12 01 | 02 09 11 08 | 16 07 03 10 | 05 13 14 15  
   00 00 10 00 | 00 14 00 00 | 00 01 00 00 | 00 00 09 00     03 16 10 07 | 15 14 05 13 | 06 01 04 12 | 11 08 09 02  
   02 09 00 00 | 03 00 00 00 | 14 00 15 05 | 12 00 06 00     02 09 11 08 | 03 16 10 07 | 14 13 15 05 | 12 01 06 04  
   15 00 00 13 | 00 06 12 00 | 09 00 00 00 | 10 07 00 03     15 05 14 13 | 04 06 12 01 | 09 08 11 02 | 10 07 16 03  
   -----------------------------------------------------     -----------------------------------------------------
   10 02 00 00 | 05 03 00 14 | 15 06 00 01 | 08 09 00 11     10 02 07 16 | 05 03 13 14 | 15 06 12 01 | 08 09 04 11  
   00 00 00 14 | 00 00 01 06 | 04 00 00 00 | 07 00 00 00     12 13 03 14 | 09 15 01 06 | 04 11 10 08 | 07 16 02 05  
   11 00 08 09 | 00 00 07 00 | 00 14 00 00 | 00 06 15 12     11 04 08 09 | 10 02 07 16 | 03 14 05 13 | 01 06 15 12  
   00 15 01 00 | 11 00 08 00 | 00 00 00 07 | 00 00 03 00     06 15 01 05 | 11 04 08 12 | 02 16 09 07 | 13 14 03 10  
   -----------------------------------------------------     -----------------------------------------------------
   16 00 02 00 | 14 00 00 10 | 13 05 00 15 | 04 00 01 00     16 07 02 11 | 14 08 03 10 | 13 05 06 15 | 04 12 01 09  
   00 00 00 00 | 00 00 00 00 | 08 00 00 00 | 00 00 07 14     01 03 15 06 | 12 13 04 09 | 08 10 16 11 | 02 05 07 14  
   00 00 00 00 | 16 00 00 00 | 00 00 14 03 | 00 00 00 00     09 08 05 12 | 16 01 02 11 | 07 04 14 03 | 15 10 13 06  
   00 00 00 00 | 06 00 15 05 | 01 12 00 00 | 00 11 08 00     13 14 04 10 | 06 07 15 05 | 01 12 02 09 | 03 11 08 16  

Link to full profile : FULL

Flat Profile :

Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total           
time   seconds   seconds    calls  ms/call  ms/call  name    
70.23      0.33     0.33    23099     0.01     0.02  create_copy_board(Board*)
14.90      0.40     0.07    23083     0.00     0.00  choose_cell_bf(Board*, int&, int&)
10.64      0.45     0.05    23100     0.00     0.00  Board::Board(int)
 4.26      0.47     0.02    23083     0.00     0.00  Board::~Board()
 0.00      0.47     0.00    69645     0.00     0.00  clear_number(Board*, int, Align, int)
 0.00      0.47     0.00    69300     0.00     0.00  Board* const& std::forward<Board* const&>(std::remove_reference<Board* const&>::type&)
 0.00      0.47     0.00    23215     0.00     0.00  update_solution(Board*, int, int, int)
 0.00      0.47     0.00    23100     0.00     0.00  _ZN9__gnu_cxx13new_allocatorIP5BoardE9constructIS2_IRKS2_EEEvPT_DpOT0_
 0.00      0.47     0.00    23100     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__construct_helper<Board*, Board* const&>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      0.47     0.00    23100     0.00     0.00  decltype (_S_construct({parm#1}, {parm#2}, (forward<Board* const&>)({parm#3}))) std::allocator_traits<std::allocator<Board*> >::construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      0.47     0.00    23100     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::push_back(Board* const&)
 0.00      0.47     0.00    23100     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::push(Board* const&)
 0.00      0.47     0.00    23100     0.00     0.00  operator new(unsigned long, void*)
 0.00      0.47     0.00    23090     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::_Deque_iterator(std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      0.47     0.00    23086     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::end()
 0.00      0.47     0.00    23084     0.00     0.00  void __gnu_cxx::new_allocator<Board*>::destroy<Board*>(Board**)
 0.00      0.47     0.00    23084     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator*() const
 0.00      0.47     0.00    23084     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::empty() const
 0.00      0.47     0.00    23084     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::empty() const
 0.00      0.47     0.00    23084     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator--()
 0.00      0.47     0.00    23084     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__destroy_helper<Board*>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      0.47     0.00    23084     0.00     0.00  void std::allocator_traits<std::allocator<Board*> >::destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      0.47     0.00    23084     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::back()
 0.00      0.47     0.00    23084     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::pop_back()
 0.00      0.47     0.00    23084     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::pop()
 0.00      0.47     0.00    23084     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::top()
 0.00      0.47     0.00    23084     0.00     0.00  bool std::operator==<Board*, Board*&, Board**>(std::_Deque_iterator<Board*, Board*&, Board**> const&, std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      0.47     0.00    23083     0.00     0.02  update_stack(Board*)
 0.00      0.47     0.00       24     0.00     0.00  std::__deque_buf_size(unsigned long)


16x16 hard 1

Command line: ./sudoku src/16x16/hard1.txt 16

   Before :                                                  After :
   02 00 00 00 | 00 00 00 16 | 00 06 00 00 | 00 00 00 05     02 07 14 03 | 09 15 13 16 | 04 06 10 08 | 01 11 12 05  
   00 10 08 00 | 00 00 00 00 | 00 00 00 00 | 00 13 15 00     04 10 08 06 | 05 01 11 12 | 02 07 14 03 | 16 13 15 09  
   00 01 12 05 | 00 00 00 00 | 00 00 00 00 | 10 04 08 00     11 01 12 05 | 03 07 02 14 | 13 09 16 15 | 10 04 08 06  
   13 00 15 09 | 06 00 00 00 | 00 00 01 12 | 07 02 00 00     13 16 15 09 | 06 08 04 10 | 11 05 01 12 | 07 02 14 03  
   -----------------------------------------------------     -----------------------------------------------------
   00 00 00 08 | 12 11 00 00 | 00 00 03 02 | 09 00 00 00     01 06 04 08 | 12 11 07 05 | 16 14 03 02 | 09 10 13 15  
   16 00 00 00 | 15 13 10 00 | 00 08 06 04 | 00 00 00 00     16 03 02 14 | 15 13 10 09 | 01 08 06 04 | 05 07 11 12  
   00 00 13 00 | 00 04 01 06 | 07 12 05 00 | 00 00 00 00     10 09 13 15 | 08 04 01 06 | 07 12 05 11 | 03 16 02 14  
   00 00 00 00 | 14 02 16 03 | 10 15 09 00 | 00 00 00 00     07 05 11 12 | 14 02 16 03 | 10 15 09 13 | 06 01 04 08  
   -----------------------------------------------------     -----------------------------------------------------
   15 00 00 16 | 10 00 00 00 | 00 00 04 05 | 00 00 00 07     15 02 09 16 | 10 06 08 13 | 12 01 04 05 | 11 14 03 07  
   00 11 00 07 | 00 00 15 00 | 00 10 00 06 | 04 00 05 01     14 11 03 07 | 16 09 15 02 | 08 10 13 06 | 04 12 05 01  
   12 00 05 01 | 00 03 14 00 | 00 16 02 00 | 13 08 00 10     12 04 05 01 | 07 03 14 11 | 15 16 02 09 | 13 08 06 10  
   00 13 06 00 | 00 00 00 04 | 14 00 00 00 | 02 15 09 00     08 13 06 10 | 01 05 12 04 | 14 03 11 07 | 02 15 09 16  
   -----------------------------------------------------     -----------------------------------------------------
   03 00 07 11 | 00 16 00 00 | 00 00 15 00 | 08 05 00 04     03 12 07 11 | 02 16 09 01 | 06 13 15 14 | 08 05 10 04  
   00 00 00 13 | 00 00 05 08 | 03 11 00 00 | 14 00 00 00     06 15 01 13 | 04 12 05 08 | 03 11 07 10 | 14 09 16 02  
   00 00 00 04 | 11 00 00 00 | 00 00 00 16 | 15 00 00 00     05 08 10 04 | 11 14 03 07 | 09 02 12 16 | 15 06 01 13  
   00 00 00 00 | 13 10 06 15 | 05 04 08 01 | 00 00 00 00     09 14 16 02 | 13 10 06 15 | 05 04 08 01 | 12 03 07 11  

Link to full profile : FULL

Flat Profile :

 Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total          
time   seconds   seconds    calls   s/call   s/call  name    
66.17      5.94     5.94   432968     0.00     0.00  create_copy_board(Board*)
22.28      7.94     2.00   432950     0.00     0.00  choose_cell_bf(Board*, int&, int&)
 6.02      8.48     0.54   432969     0.00     0.00  Board::Board(int)
 4.46      8.88     0.40   432950     0.00     0.00  Board::~Board()
 0.67      8.94     0.06  1299222     0.00     0.00  clear_number(Board*, int, Align, int)
 0.22      8.96     0.02   433074     0.00     0.00  update_solution(Board*, int, int, int)
 0.22      8.98     0.02   432950     0.00     0.00  update_stack(Board*)
 0.00      8.98     0.00  1298907     0.00     0.00  Board* const& std::forward<Board* const&>(std::remove_reference<Board* const&>::type&)
 0.00      8.98     0.00   432969     0.00     0.00  _ZN9__gnu_cxx13new_allocatorIP5BoardE9constructIS2_IRKS2_EEEvPT_DpOT0_
 0.00      8.98     0.00   432969     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__construct_helper<Board*, Board* const&>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      8.98     0.00   432969     0.00     0.00  decltype (_S_construct({parm#1}, {parm#2}, (forward<Board* const&>)({parm#3}))) std::allocator_traits<std::allocator<Board*> >::construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      8.98     0.00   432969     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::push_back(Board* const&)
 0.00      8.98     0.00   432969     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::push(Board* const&)
 0.00      8.98     0.00   432969     0.00     0.00  operator new(unsigned long, void*)
 0.00      8.98     0.00   432957     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::_Deque_iterator(std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      8.98     0.00   432953     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::end()
 0.00      8.98     0.00   432951     0.00     0.00  void __gnu_cxx::new_allocator<Board*>::destroy<Board*>(Board**)
 0.00      8.98     0.00   432951     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator*() const
 0.00      8.98     0.00   432951     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::empty() const
 0.00      8.98     0.00   432951     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::empty() const
 0.00      8.98     0.00   432951     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator--()
 0.00      8.98     0.00   432951     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__destroy_helper<Board*>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      8.98     0.00   432951     0.00     0.00  void std::allocator_traits<std::allocator<Board*> >::destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      8.98     0.00   432951     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::back()
 0.00      8.98     0.00   432951     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::pop_back()
 0.00      8.98     0.00   432951     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::pop()
 0.00      8.98     0.00   432951     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::top()
 0.00      8.98     0.00   432951     0.00     0.00  bool std::operator==<Board*, Board*&, Board**>(std::_Deque_iterator<Board*, Board*&, Board**> const&, std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      8.98     0.00       24     0.00     0.00  std::__deque_buf_size(unsigned long)
 0.00      8.98     0.00        6     0.00     0.00  std::_Deque_iterator<State*, State*&, State**>::_Deque_iterator(std::_Deque_iterator<State*, State*&, State**> const&)


16x16 hard 2

Command line: ./sudoku src/16x16/hard2.txt 16

   Before :                                                  After :
   00 00 00 13 | 15 00 00 07 | 08 11 00 16 | 00 00 00 00     10 03 14 13 | 15 12 05 07 | 08 11 09 16 | 01 04 02 06  
   00 00 00 00 | 00 01 14 00 | 00 00 00 02 | 00 00 05 00     07 15 11 16 | 03 01 14 13 | 10 06 04 02 | 12 08 05 09  
   00 00 08 00 | 10 00 00 00 | 00 00 15 12 | 00 00 03 14     09 06 08 01 | 10 11 02 04 | 05 07 15 12 | 13 16 03 14  
   00 00 00 00 | 06 00 00 09 | 01 00 13 00 | 00 10 07 00     04 05 02 12 | 06 16 08 09 | 01 14 13 03 | 15 10 07 11  
   -----------------------------------------------------     -----------------------------------------------------
   00 07 05 00 | 12 10 00 08 | 00 00 06 00 | 00 13 00 00     03 07 05 02 | 12 10 11 08 | 14 04 06 15 | 16 13 09 01  
   00 00 00 11 | 00 00 00 00 | 07 00 00 00 | 00 15 00 03     12 08 01 11 | 14 13 16 06 | 07 02 05 09 | 04 15 10 03  
   00 00 06 04 | 00 15 09 00 | 12 03 11 00 | 00 00 00 07     16 13 06 04 | 02 15 09 01 | 12 03 11 10 | 05 14 08 07  
   14 00 00 15 | 00 00 00 00 | 00 00 00 13 | 06 00 00 00     14 09 10 15 | 05 04 07 03 | 16 01 08 13 | 06 12 11 02  
   -----------------------------------------------------     -----------------------------------------------------
   00 04 00 09 | 07 00 00 00 | 15 00 00 00 | 00 11 00 10     02 04 13 09 | 07 14 12 05 | 15 16 03 06 | 08 11 01 10  
   01 14 00 00 | 00 00 03 00 | 00 09 07 00 | 00 00 13 04     01 14 12 10 | 16 06 03 15 | 11 09 07 08 | 02 05 13 04  
   05 00 00 00 | 00 08 00 11 | 04 10 00 00 | 14 00 00 15     05 16 03 06 | 09 08 13 11 | 04 10 02 01 | 14 07 12 15  
   00 00 15 07 | 00 02 00 00 | 00 00 14 00 | 00 00 06 00     08 11 15 07 | 04 02 01 10 | 13 12 14 05 | 09 03 06 16  
   -----------------------------------------------------     -----------------------------------------------------
   00 10 09 00 | 00 00 00 14 | 00 13 00 00 | 00 00 00 08     11 10 09 05 | 01 07 15 14 | 02 13 12 04 | 03 06 16 08  
   00 02 00 08 | 11 00 04 00 | 03 00 16 00 | 00 00 00 00     06 02 07 08 | 11 09 04 12 | 03 05 16 14 | 10 01 15 13  
   13 00 00 00 | 00 05 00 16 | 00 15 00 07 | 11 00 14 12     13 01 04 03 | 08 05 06 16 | 09 15 10 07 | 11 02 14 12  
   00 12 00 00 | 13 03 10 00 | 06 08 00 11 | 00 00 00 00     15 12 16 14 | 13 03 10 02 | 06 08 01 11 | 07 09 04 05  

Link to full profile : FULL

Flat Profile :

 Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total          
time   seconds   seconds    calls   s/call   s/call  name    
63.01      4.68     4.68   347198     0.00     0.00  create_copy_board(Board*)
24.77      6.52     1.84   347184     0.00     0.00  choose_cell_bf(Board*, int&, int&)
 7.54      7.08     0.56   347199     0.00     0.00  Board::Board(int)
 4.04      7.38     0.30   347184     0.00     0.00  Board::~Board()
 0.54      7.42     0.04  1041882     0.00     0.00  clear_number(Board*, int, Align, int)
 0.13      7.43     0.01   347294     0.00     0.00  update_solution(Board*, int, int, int)
 0.00      7.43     0.00  1041597     0.00     0.00  Board* const& std::forward<Board* const&>(std::remove_reference<Board* const&>::type&)
 0.00      7.43     0.00   347199     0.00     0.00  _ZN9__gnu_cxx13new_allocatorIP5BoardE9constructIS2_IRKS2_EEEvPT_DpOT0_
 0.00      7.43     0.00   347199     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__construct_helper<Board*, Board* const&>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      7.43     0.00   347199     0.00     0.00  decltype (_S_construct({parm#1}, {parm#2}, (forward<Board* const&>)({parm#3}))) std::allocator_traits<std::allocator<Board*> >::construct<Board*, Board* const&>(std::allocator<Board*>&, Board**, Board* const&)
 0.00      7.43     0.00   347199     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::push_back(Board* const&)
 0.00      7.43     0.00   347199     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::push(Board* const&)
 0.00      7.43     0.00   347199     0.00     0.00  operator new(unsigned long, void*)
 0.00      7.43     0.00   347191     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::_Deque_iterator(std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      7.43     0.00   347187     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::end()
 0.00      7.43     0.00   347185     0.00     0.00  void __gnu_cxx::new_allocator<Board*>::destroy<Board*>(Board**)
 0.00      7.43     0.00   347185     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator*() const
 0.00      7.43     0.00   347185     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::empty() const
 0.00      7.43     0.00   347185     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::empty() const
 0.00      7.43     0.00   347185     0.00     0.00  std::_Deque_iterator<Board*, Board*&, Board**>::operator--()
 0.00      7.43     0.00   347185     0.00     0.00  std::enable_if<std::__and_<std::allocator_traits<std::allocator<Board*> >::__destroy_helper<Board*>::type>::value, void>::type std::allocator_traits<std::allocator<Board*> >::_S_destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      7.43     0.00   347185     0.00     0.00  void std::allocator_traits<std::allocator<Board*> >::destroy<Board*>(std::allocator<Board*>&, Board**)
 0.00      7.43     0.00   347185     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::back()
 0.00      7.43     0.00   347185     0.00     0.00  std::deque<Board*, std::allocator<Board*> >::pop_back()
 0.00      7.43     0.00   347185     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::pop()
 0.00      7.43     0.00   347185     0.00     0.00  std::stack<Board*, std::deque<Board*, std::allocator<Board*> > >::top()
 0.00      7.43     0.00   347185     0.00     0.00  bool std::operator==<Board*, Board*&, Board**>(std::_Deque_iterator<Board*, Board*&, Board**> const&, std::_Deque_iterator<Board*, Board*&, Board**> const&)
 0.00      7.43     0.00   347184     0.00     0.00  update_stack(Board*)
 0.00      7.43     0.00       24     0.00     0.00  std::__deque_buf_size(unsigned long)



ColorTransfer

The Source code can be found here This program is an implementation of image color transfer detailed by Erik Reinhard and coded by Tatsy This program takes 2 images the first image denoted by the args is the image taking in colours. The second image is an image that the program will use to edit the first image using the colours found.


Creating and Running the Project with gprof profiling

Perform the following steps in a Linux/Unix System:

STEP 1 - Download the following zip and extracts its contents

-> Link:

STEP 2 - Install all the required entries(make,cmake,git,gprof,etc) with the following terminal command:

-> sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev binutils

STEP 3 - Download and Install OpenCV from their official page located here. You can do this with the following steps and commands:

-> Download the latest source data of OpenCV for Linux/Mac
-> Extract the zipped source data into its appropriately named folder opencv-(latest version)
-> Open terminal and enter us the cd command to enter the extracted folder opencv-(latest version)
-> Create a build directy with the command mkdir build
-> Use the cd command to enter the build folder
-> Use the following cmake command to generate the appropriate files for the make command: cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
-> Use make with the -j7 command to allow for up to 7 jobs when preparing the install: make -j7
-> Install with: sudo make install
-> OpenCV should be installed

STEP 4 - Use the Test Folder provided by the dropbox link above to see if OpenCV is working correctly. You can follow these steps to do so

-> In terminal cd into the test folder
-> cmake .
-> make
-> run display image with the follow command ./DisplayImage ahri.jpg
-> If the image provided is displayed OpenCV should be in working order.

STEP 5 - Build the ColorTransfer program with the folder provided by the dropbox link and create a flat profile using gprof

-> Create the files for make using the following command: cmake -DCMAKE_CXX_FLAGS=-pg -DCMAKE_EXE_LINKER_FLAGS=-pg -DCMAKE_SHARED_LINKER_FLAGS=-pg .
-> The additional options include -pg within the cmake so that the appropriate gmon.out can be created for gprof
-> After the files are generated use the make command
-> Run the created program with 2 arguments arg1 being the image beind editted and arg2 being the image to take colours from (two images are provided for your convenience).
-> If using the provided image the command should like: ./ColorTransfer ahri.jpg ahri2.jpg
-> This should generate the colour transferred output image as well as the appropriate gmon.out file
-> Use the either of the following commands for the flat profile: gprof -p -b ./ColorTransfer > ColorTransfer.flt  OR  gprof test_gprof gmon.out > analysis.txt


Example Output

If using the examples provided you should have the following image results:


Profile