The SDK deviceQuery example shows full details of how to do this. You can enumerate the available GPUs on a system with cudaGetDeviceCount, and retrieve their particulars using cudaGetDeviceProperties. There is also cudaChooseDevice, which will select amongst available devices to find one which matches criteria supplied by the caller. Since CUDA 4.0, this call will establish a context on the nominated GPU at the time of calling. Prior to CUDA 4.0, this call didn't actually establish a context, it just told the runtime which GPU to try and use. That will configure the runtime to perform lazy context establishment on the nominated device. The canonical way to select a device in the runtime API is using cudaSetDevice.
0 Comments
Leave a Reply. |