Hello,

I’m trying to calculate primenumbers on a GPU.

I tried it with opencl and cuda, but the appilcation always terminates when the number exceeds 10^7.

```
#define THREADSPERGPU 250000
__global__ void
testKernel( bool* g_odata, int gSize)
{
const unsigned int tid = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int actualNumber = tid;
bool prime;
while(actualNumber<gSize)
{
prime = true;
for(unsigned int i=2;i*i<=actualNumber;i++)
{
if(!(actualNumber%i))
{
prime = false;
break;
}
}
g_odata[actualNumber] = prime;
actualNumber+=THREADSPERGPU;
}
}
```

Till 10^6 I have no problems. CUDA exits with cudaError_enum at memory location. I tried this config in emudebug without any errors.

I also tried to write my own modulo function:

```
float r1 =actualNumber/(float)i;
int r2 = (int) r1;
if((r1-(float)r2)==0.0)
{
prime = false;
break;
}
```

This does function, also above 10^7, but because of the bad rounding capability of the device, most of the results are wrong (but in emudebug there are no errors).

So what do I do wrong or are there any restrictions, that I don’t know?

Thanks

PS: My device is a GTS250 with 1024 MB RAM, that should be enough for 10^9