Hi,
I want to run my Kernel in a Loop, until it gets a condition from the host.
similar to this.
global void myKernel(bool *devBool, other Parameters)
{
while(*devBool)
{
… do something …
}
}
int main(int argc, char** argv)
{
bool *hostBool;
bool *deviceBool;
cudaSetDeviceFlags(cudaDeviceMapHost);
cudaHostAlloc((void**)&hostBool, sizeof(bool), cudaHostAllocMapped);
cudaHostGetDevicePointer((void**)&deviceBool, (void*)hostBool, 0);
*hostBool = true;
dim3 dimBlock(10);
dim3 dimGrid(1);
myKernel<<dimGrid, dimBlock>> (devBool, other Parameters);
sleep(10000); //or something else what takes a long time
*hostBool = false;
cudaFreeHost(hostBool);
cudaFree(devBool);
}
How can I be on the safe side, that the threads are never killed, because the kernelExecTimeoutEnabled is true?