cudaSafeCall() Runtime API error 33: invalid resource handle?

This error occurs when i call a kernel on the GPUs in the same time:

for(int i = 0; i < numDevice; i++)
{
cutilSafeCall(cudaSetDevice(i) );
toto<<< dimGrid, dimBlock, 0, tabStream[i] >>>(dn[i], fn[i], d_ta[i], d_qa[i], d_a[i], d_b[i], d_r[i]);
cutilSafeCall( cudaGetLastError() );
}

What does it mean? Thanks for your help.

This error occurs when i call a kernel on the GPUs in the same time:

for(int i = 0; i < numDevice; i++)
{
cutilSafeCall(cudaSetDevice(i) );
toto<<< dimGrid, dimBlock, 0, tabStream[i] >>>(dn[i], fn[i], d_ta[i], d_qa[i], d_a[i], d_b[i], d_r[i]);
cutilSafeCall( cudaGetLastError() );
}

What does it mean? Thanks for your help.

It’s seems like the first iteration pass and the others not… I don’t know why?
Furthermore, before these commands i allocated and copied on the GPUs all these
variables without problems…

It’s seems like the first iteration pass and the others not… I don’t know why?
Furthermore, before these commands i allocated and copied on the GPUs all these
variables without problems…

The normal way to do it is to start one CPU thread for each GPU.

CUDA has context pop and push APIs. I’m not sure whether these would allow the same CPU thread to operate on contexts in different devices. Can someone help?

That is the old school way. CUDA 4.0 enables exactly what the OP is doing.

was the stream tabStream[i] created while cudaSetDevice(i) was active? That’s the only thing I can think of that would cause an invalid resource handle error. If any of the pointers were wrong, you would be getting “invalid device pointer”.

Never had a second nVidia GPU to play withExternal Image… I think you are right. It’s probably some problem with the tabStream.

Thanks you for your answers, your are right!!!
tabStream[i] must be created when cudaSetDevice(i) is actived.