Difference between revisions of "Team Titans"

From CDOT Wiki
Jump to: navigation, search
(Assignment 1)
(Assignment 1)
Line 9: Line 9:
 
== Progress ==
 
== Progress ==
 
=== Assignment 1 ===
 
=== Assignment 1 ===
 +
===Calculation of Pi===
 +
 +
 +
I decided on finding a technique which is the most efficient way to calculate pi. I found one way of doing this on http://www.codecodex.com/wiki/Calculate_digits_of_pi. By parallelizing the code, it could reduce the computation time considerably.
 +
 +
After profiling, I get the following results:
 +
 +
Flat profile:
 +
 +
Each sample counts as 0.01 seconds.
 +
  %  cumulative  self              self    total
 +
time  seconds  seconds    calls  Ts/call  Ts/call  name
 +
100.00      1.56    1.56                            pi_digits(int)
 +
 
===Image Manipulation===
 
===Image Manipulation===
  

Revision as of 04:08, 15 October 2015


GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary

Team Titans

Team Members

  1. Vanessa Fernandes
  2. Maira Zaidi

Email All

Progress

Assignment 1

Calculation of Pi

I decided on finding a technique which is the most efficient way to calculate pi. I found one way of doing this on http://www.codecodex.com/wiki/Calculate_digits_of_pi. By parallelizing the code, it could reduce the computation time considerably.

After profiling, I get the following results:

Flat profile:

Each sample counts as 0.01 seconds.

 %   cumulative   self              self     total
time   seconds   seconds    calls  Ts/call  Ts/call  name

100.00 1.56 1.56 pi_digits(int)

Image Manipulation

Image Resampling/Rescaling is the method used to create a new and potentially better version of an image with a different size. I chose to decipher the code mentioned on http://www.cplusplus.com/forum/general/2615/ to better understand how it works. The following performs a basic pixel enlarging resample:

  bool Resample(int newWidth, int newHeight)
   {
       if(_data == NULL) return false;
       //
       // Get a new buuffer to interpolate into
       unsigned char* newData = new unsigned char [newWidth * newHeight * 3];
       double scaleWidth =  (double)newWidth / (double)_width;
       double scaleHeight = (double)newHeight / (double)_height;
       for(int cy = 0; cy < newHeight; cy++)
       {
           for(int cx = 0; cx < newWidth; cx++)
           {
               int pixel = (cy * (newWidth *3)) + (cx*3);
               int nearestMatch =  (((int)(cy / scaleHeight) * (_width *3)) + ((int)(cx / scaleWidth) *3) );
               newData[pixel    ] =  _data[nearestMatch    ];
               newData[pixel + 1] =  _data[nearestMatch + 1];
               newData[pixel + 2] =  _data[nearestMatch + 2];
           }
       }
  }


However, I've noticed the code needed to be modified so the user can decide the dimensions of the image instead of it being hard coded. Therefore, we can parallelize the above portion of the code to make it more efficient while looking similar to the for loops but functions differently and potentially better at runtime.

The following displays the gprof profile:

Flat profile:

Each sample counts as 0.01 seconds.

 %   cumulative   self              self     total
time   seconds   seconds    calls  Ts/call  Ts/call  name 

100.00 0.03 RawBitMap::Resample(int,int)

 0.00      0.03     0.00        1     0.00     0.00  _GLOBAL__sub_I_main

Assignment 2

Assignment 3