Issue
I want to do some timing comparisons between CPU & GPU as well as some profiling and would like to know if there's a way to tell pytorch to not use the GPU and instead use the CPU only? I realize I could install another CPU-only pytorch, but hoping there's an easier way.
Solution
You can just set the CUDA_VISIBLE_DEVICES
variable to empty via shell before running your torch code.
export CUDA_VISIBLE_DEVICES=""
Should tell torch that there are no GPUs.
export CUDA_VISIBLE_DEVICES="0"
will tell it to use only one GPU (the one with id 0) and so on.
Answered By - Umang Gupta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.