Closed guangmingboy closed 6 years ago
net.cuda() will use GPU 0 default.
If you want to run the the code in GPU 0, you can run ''python demo_MNIST.py' and both net.cuda() or net.cuda(0) works.
If you want to run the the code in GPU 1, you can run ''python demo_MNIST.py' with net.cuda(1). or you can run 'CUDA_VISIBLE_DEVICES=1 python demo_MNIST.py' with net.cuda() or net.cuda(0).
if torch.cuda.is_available(): net.cuda() should be if torch.cuda.is_available(): net.cuda(cfg.cuda_num) ?
When I run demo_MNIST.py, It shows RuntimeError: cuda runtime error (2) : out of memory at THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/generic/THCStorage.cu line=58 error=2 : out of memory