Can we assign GPUs to different threads in testing?

How can we assign GPU to threads using threading module?