garrettwrong / cuTWED

Linear memory CUDA Time Warp Edit Distance
GNU General Public License v3.0
28 stars 4 forks source link

how to choose which GPU to use inside cuTWED? #29

Closed mw66 closed 3 years ago

mw66 commented 3 years ago

Hi,

If a computer have multiple GPU, how to choose which GPU to use inside cuTWED?

(I'm aware of CUDA_VISIBLE_DEVICES the env var, but want to choose in cuTWED).

Thanks.

garrettwrong commented 3 years ago

Sure, there isn't a method to choose devices from cuTWED. You may choose CUDA devices from your application code before making cuTWED calls. Your application should be managing CUDA state/devices/memory/streams using the CUDA API.

I mentioned in the last issue that cuTWED should be agnostic to devices. It assumes the user has setup the device they intend to use, and managed their data into memory on that device appropriately. This is a very common implementation for CUDA runtime based software. Probably the most common. At a high level, in your case the pool of threads might each set a device, transfer memory, then call cuTWED. Hope that makes sense. Here is a link to the CUDA documentation for setting a device:

https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g159587909ffa0791bbe4b40187a4c6bb

Managing multiple devices/runtimes is a general CUDA programming pattern, not specific to cuTWED. If you need help writing your CUDA application I offer software consulting services. Thanks

garrettwrong commented 3 years ago

I will try to create an example of this the next time I update this software/documentation. Thanks for the suggestion.