Difference between revisions of "GPU610/DPS915 CUDA PI"

From CDOT Wiki
Jump to: navigation, search
(Code Snippet)
Line 23: Line 23:
  
 
==== '''Code Snippet''' ====
 
==== '''Code Snippet''' ====
 +
    Serial Pi Calculation Algorithm
 +
   
 
     // loops through user amount of rounds of sets of points
 
     // loops through user amount of rounds of sets of points
 
     for(i = 0; i < points; i++)
 
     for(i = 0; i < points; i++)
Line 47: Line 49:
 
==== '''Introduction''' ====
 
==== '''Introduction''' ====
 
In Phase 2, I've parallelized the serial program to run on a custom kernel on a CUDA-enabled device.
 
In Phase 2, I've parallelized the serial program to run on a custom kernel on a CUDA-enabled device.
 +
 +
==== '''Source File(s)''' ====
 +
Link: https://drive.google.com/file/d/0B8GUuIUqdEJEbDBRNkhWYnpGSnM
 +
 +
==== '''Code Snippet''' ====
 +
Serial Pi Calculation Algorithm
 +
 +
// loops through user amount of rounds of sets of points
 +
for(i = 0; i < points; i++)
 +
{
 +
x = randNum();
 +
y = randNum();
 +
 +
// check if point resides within the circle
 +
if (((x*x) + (y*y)) <= 1.0)
 +
{
 +
score++;
 +
}
 +
}
 +
// calculate pi
 +
pi = 4.0 * (float)score/(float)points;
  
 
==== '''Compilation and Running''' ====
 
==== '''Compilation and Running''' ====
Line 57: Line 80:
 
[[File:Pi_serial_vs_cuda_results.jpg|border]]
 
[[File:Pi_serial_vs_cuda_results.jpg|border]]
  
==== '''Source File(s)''' ====
 
Link: https://drive.google.com/file/d/0B8GUuIUqdEJEbDBRNkhWYnpGSnM
 
  
 
==== '''Conclusion''' ====
 
==== '''Conclusion''' ====

Revision as of 01:27, 4 November 2013


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

CUDA PI Calcuation (Monte Carlo)

Team Pi CUDA

Welcome to GPU610AA Fall 2013 Team Pi CUDA Page.

My name is Peter Huang and I'm a student in the GPU610 class for the Fall Semester of 2013. Having no background whatsoever in parallel programming, I've decided to choose something that is out of my scope of understanding and interest (video game programming) to challenge myself. Thus, I've decided to investigate the benefits of parallel programming applied to the Monte Carlo statistical method to approximating the value of pi.

Announcements

N/A

Team Members

  1. Peter Huang

eMail All

Progress

Assignment 1

Introduction

For the initial profiling, I've decided to investigate the Monte Carlo Statistics Methodology of approximating the value of Pi. A brief explanation of Monte Carlo Pi calculation can be found here: https://www.youtube.com/watch?v=VJTFfIqO4TU

Source File(s)

Link: https://drive.google.com/file/d/0B8GUuIUqdEJES3VEOGRnYmRNaEk

Code Snippet

   Serial Pi Calculation Algorithm 
    
   // loops through user amount of rounds of sets of points
   for(i = 0; i < points; i++)
   {
      x = randNum();
      y = randNum();
      
      // check if point resides within the circle
      if (((x*x) + (y*y)) <= 1.0)
      {
         score++;
      }     
   }
   // calculate pi
   pi = 4.0 * (float)score/(float)points;

Compilation and Running

Pi serial execution example.jpg

Serial Results

Pi serial results.jpg

Assignment 2

Introduction

In Phase 2, I've parallelized the serial program to run on a custom kernel on a CUDA-enabled device.

Source File(s)

Link: https://drive.google.com/file/d/0B8GUuIUqdEJEbDBRNkhWYnpGSnM

Code Snippet

Serial Pi Calculation Algorithm

// loops through user amount of rounds of sets of points for(i = 0; i < points; i++) { x = randNum(); y = randNum();

// check if point resides within the circle if (((x*x) + (y*y)) <= 1.0) { score++; } } // calculate pi pi = 4.0 * (float)score/(float)points;

Compilation and Running

Pi cuda execution example.jpg

Parallel (CUDA) Results

Pi cuda results.jpg

Serial VS CUDA

Pi serial vs cuda results.jpg


Conclusion

Assignment 3

Agenda

N/A

Progress

N/A

Meetings

N/A

Discussion

N/A