How to choose device in ManagedCUDA?

Feb 2, 2015 at 8:55 PM
Edited Feb 2, 2015 at 8:56 PM
I have a computer which has two separate identical graphic cards (Nvidia).
I want to have two different runs on my computer each using its own separate
GPU. How can I do that in Managed Cuda?

I know that Cuda has cudaSetDevice or cudaChooseDevice to select amongst available devices.
So would you please give me an example of it in Managed Cuda?
Feb 2, 2015 at 9:10 PM
When you create a context you can use the deviceID to indentify the card to use (defaults to 0 if not given). So simply create two contexts, one for each card and call the SetCurrent() method to switch the device to use before copying data or launching kernels.
Also note that a context in Cuda's driver API (as used in managedCuda) is bound to a CPU-thread. So if you create two CPU-threads you can then use both devices independently...

Marked as answer by saeedm on 2/2/2015 at 3:31 PM
Feb 2, 2015 at 10:31 PM
Thanks Michael