Pytorch 0.4.0 cannot use other GPU When GPU 0 don‘t have free memory

Pytorch 0.4.0 cannot use other GPU When GPU 0 don‘t have free memory
when useing net.to(‘cuda:1’) and GPU0 do not have free memory , my program would trash at torch._C._cuda_init()

Hi, this is a known issue (#7320, #7071) and in fact there is already a fix in master. I haven’t tried it myself, but you could build PyTorch from source and see if it is fixed (if it is not you should probably let the core team know about it on github) :slight_smile:

2 Likes

In addition to RicCu’s reply above, you can use CUDA_VISIBLE_DEVICES flag to get around the issue for now.

1 Like

thankkkkkkkkk !!!! it’s work

this problem seems repaired at 0.3.1 but appear in 0.4.0 again

1 Like