black screen and driver shutdown

i just started coding with cuda

here is my kernel function, it report no error.

but when i copy data back to the host, it reports an unknow error and black screen occurs. after that, a driver error and full of color dot on my screen.

i thought it could be a memory overrun, but i didn’t find one

what should i do?


device void ConservationForce(DpdEnvPtr d_DpdEnv,DpdParticle * d_Particle, int NumPart,int PartIdx)


float Rx=0.0f,Ry=0.0f,Rz=0.0f,R=0.0f;

float Factor=0.0f;

for (int i=0;i<NumPart;i++){

	Factor = (d_DpdEnv->Aij[d_Particle[PartIdx].PType][d_Particle[i].PType] / (1.0f/((d_Particle[PartIdx].x - d_Particle[i].x)*(d_Particle[PartIdx].x - d_Particle[i].x)+(d_Particle[PartIdx].y - d_Particle[i].y)*(d_Particle[PartIdx].y - d_Particle[i].y)+(d_Particle[PartIdx].z - d_Particle[i].z)*(d_Particle[PartIdx].z - d_Particle[i].z))-1.0f));

	d_Particle[PartIdx].FX = Factor * (d_Particle[PartIdx].x - d_Particle[i].x);

	d_Particle[PartIdx].FY = Factor * (d_Particle[PartIdx].y - d_Particle[i].y);

	d_Particle[PartIdx].FZ = Factor * (d_Particle[PartIdx].z - d_Particle[i].z);



global void DpdSimuInitKernel(DpdEnvPtr d_DpdEnv,DpdParticle * d_Particle, int NumPart)


int PartIdx;

PartIdx = blockIdx.x*blockDim.x + threadIdx.x;

for (int i=0;i<300;i++){




this line returns an error

cudaSafeCall() Runtime API error in file <>, line 92 : the launch timed out and was terminated.

[codebox]cutilSafeCall( cudaMemcpy(h_Particle,d_Particle,sizeof(DpdParticle)*NumPart

,cudaMemcpyDeviceToHost) );[/codebox]