Run python code with GPU

GPU running python code

step
1. Check the computer's graphics card (input in the console)
nvidia-smi

The following content appears.
Insert picture description here
There is only graphics card No. 0

2. Specify the GPU in the code
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

That's it! ! ! !

Guess you like

Origin blog.csdn.net/qq_44606064/article/details/106117381