correct kernel lauch

Dear cuda-developers,

how to launch a kernel correctly, when I have to pass a deviceID and streamID and the size of shared manory I would like to allacoate?

I know I can call a as follow:

MyKernel<<< numBlocks, threadsPerBlock, deviceID, streamID>>>(args);


MyKenrel<<< numBlocks, threadsPerBlock, sharedMemorySize, streamID >>> ( args );

But how to do both in one?

thank you in advance.

cheers greg

Oh I see,

I can use cudaSetDevice() instead of setting deviceID in the kernel call, right?

regards greg

Yes …you are right
Once you use cudaSetDevice(), all subsequent cuda calls are particular to the current device.
Make sure you use cudaResetDevice() once you are finished with a particular device.