1
edit
Changes
→Assignment 2
# include <ctime>
#include<iomanip>
#include<cstdlib>
# include <cuda_runtime.h>
//#include <times.h>
using namespace std;
{
bool prime = true;
//struct tms start_time, stop_time;
int number2;
number2 =(int) floor (sqrt (x));
clock_t start = getMilliSecs();
//Array to hold generated primes on host
cudaError_t error ;
//Kernal goes here
primegen<<<1,1>>>(prime,number2,(int)x,primes_d);
// extract error code from the kernel's execution
//display the primes
if(primes_h[i]>=2 && primes_h[i]<=(int)x){
}
cout << "Elapsed time: " << (getMilliSecs() - start) << "ms" << endl; // cout<< "time: "<< (stop_s-start_s)/double(CLOCKS_PER_SEC)<<endl;
//free allocated memory
delete [] primes_h;