Difference between revisions of "GPU610/NullPointerException"

From CDOT Wiki
Jump to: navigation, search
(Assignment 1)
(Assignment 1)
Line 14: Line 14:
  
 
while (count < n){
 
while (count < n){
 
 
                 flag = 1;
 
                 flag = 1;
 
 
                 i = 1;
 
                 i = 1;
 
 
                 checkKey = int((sqrt (prime))+1);
 
                 checkKey = int((sqrt (prime))+1);
 
 
                 //checks prime numbers for divisible values
 
                 //checks prime numbers for divisible values
 
 
                 while(primes[i] < checkKey and flag){
 
                 while(primes[i] < checkKey and flag){
 
 
                         if ((prime % primes[i])==0){
 
                         if ((prime % primes[i])==0){
 
 
                                 flag = 0;
 
                                 flag = 0;
 
 
                         }
 
                         }
 
 
                         i++;
 
                         i++;
 
 
                 }
 
                 }
 
 
                 if(flag){
 
                 if(flag){
 
 
                         primes[count] = prime;
 
                         primes[count] = prime;
 
 
                         count++;
 
                         count++;
 
 
                 }
 
                 }
 
 
                 prime +=2;
 
                 prime +=2;
 
 
         }
 
         }
  

Revision as of 14:28, 7 February 2013


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

Unlisted

Team Members

  1. Philip A Aziz
  2. Saad Mohammad
  3. Natesh Mayuranathan

Email All

Progress

Assignment 1

  • Philip Aziz - Calculating Prime Numbers

Only the inner loop would be possible to Parellelize but would still require to validate 1 prime number at a time due to need to validate against previous prime numbers.

while (count < n){

               flag = 1;
               i = 1;
               checkKey = int((sqrt (prime))+1);
               //checks prime numbers for divisible values
               while(primes[i] < checkKey and flag){
                       if ((prime % primes[i])==0){
                               flag = 0;
                       }
                       i++;
               }
               if(flag){
                       primes[count] = prime;
                       count++;
               }
               prime +=2;
       }



Time by Level
n Elapsed Time
10,000 0
100,000 1
1,000,000 8
10,000,000 220
100,000,000 6200


  • Saad Mohammad -
  • Natesh Mayuranathan -

Assignment 2

Assignment 3