Open main menu

CDOT Wiki β

Changes

DPS915/CodeCookers

15 bytes added, 18:24, 3 October 2014
no edit summary
== Progress ==
=== Assignment 1 ===
'''Norbert''':Calculation of PI''' '''Problem Description''' 
For this assignment, I selected one application that I wished to parallelize. I profiled it to find the hotspot of the application and determine if it was feasible to speed up using the GPU.
[[File:outputdart.jpg| gif]] 
The ratio of the randomly thrown dart is: (hits within dartboard) vs. (hits within square) is equal to the ratio between the two areas i.e. PI/4. The more darts we throw, the better we can approximate PI.
[[File:dartoutput.jpg| ]]
Based on the Blaise Barney's pseudo code (shown above), I created an application which simulates the dart throwing n number of times, providing the approximate value of PI.
'''Program execution'''
During the execution, the program takes the number of iterations through the command line. It generates two random decimal numbers between 0 and 1 and determines if the randomly generated coordinates are inside in the circle. Then it calculates the size of PI. As we increase the number of iteration we are getting a more realistic value of PI.