=== Assignment 2 ===
We chose to work on the program that finds out how many primes are between 1 and NA2 featured a significantly improved prime-counting algorithm, coupled with GPU integration.
Assignment 2 was very successful.
We are submitting the files now Going from A1 to A2, our code experienced a speed-up of 6,015,300% (7:00pm April 11thor 60,154x faster (literally - A1 was <u>'''''that'''''</u> inefficient)).
This Wiki page will Kernel code for A2: <pre>__global__ void findPrimes(int* answer, int n){ int i = threadIdx.x; int j = blockIdx.x * blockDim.x + threadIdx.x; __shared__ int blockSum[ntpb]; int check = j+1; blockSum[i] = 0; __syncthreads(); if(check >= 2 && check <= n) { bool flag = true; //Assume prime for(int x = 2; x < check && flag; x++) //Check all numbers 2 to "check" if(check % x == 0) //If divisible by x flag = false; //Found to not be updated with details before A3's due date prime if(11flag) //If prime blockSum[i] = 1; //Add one to our numbers } __syncthreads(); //Ensure all threads are caught up for (int stride = blockDim.x >> 1; stride > 0; stride >>= 1) { if (i < stride) blockSum[i] += blockSum[i + stride]; __syncthreads(); } if (i == 0) answer[blockIdx.x] = blockSum[0];}</pre> Sample output from A2, for demonstration:55pm April 12th [[Image:gtsmyth A2.png|widthpx| ]] Demonstration of how efficient A2 runs for n = 1,000 (for comparison, A1 took 20.78 seconds).
=== Assignment 1 ===