alterzero / DBPN-Pytorch

The project is an official implement of our CVPR2018 paper "Deep Back-Projection Networks for Super-Resolution" (Winner of NTIRE2018 and PIRM2018)
https://alterzero.github.io/projects/DBPN.html
MIT License
566 stars 164 forks source link

RuntimeError: cuda runtime error (30) : unknown error at ..\aten\src\THC\THCGeneral.cpp:87 #39

Closed aligoglos closed 5 years ago

aligoglos commented 5 years ago

I tried to run eval.py but got this error:

python eval.py
Namespace(chop_forward=False, gpu_mode=True, gpus=1, input_dir='Input', model='models/DBPN_x8.pth', model_type='DBPN', output='Results/', residual=False, seed=123, self_ensemble=False, testBatchSize=1, test_dataset='MySet', threads=1, upscale_factor=8)
===> Loading datasets
===> Building model
THCudaCheck FAIL file=..\aten\src\THC\THCGeneral.cpp line=87 error=30 : unknown error
Traceback (most recent call last):
  File "eval.py", line 64, in <module>
    model = torch.nn.DataParallel(model, device_ids=gpus_list)
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\parallel\data_parallel.py", line 131, in __init__
    _check_balance(self.device_ids)
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\parallel\data_parallel.py", line 18, in _check_balance
    dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\parallel\data_parallel.py", line 18, in <listcomp>
    dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\cuda\__init__.py", line 298, in get_device_properties
    init()  # will define _get_device_properties and _CudaDeviceProperties
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\cuda\__init__.py", line 144, in init
    _lazy_init()
  File "C:\Users\127051\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\cuda\__init__.py", line 162, in _lazy_init
    torch._C._cuda_init()

os : windows 10 python : 3.5.4 torch : 1.0.1

aligoglos commented 5 years ago

I think it's torch issue in windows. I think solution is to add torch.cuda.current_device() before any other cuda calls, so you can add to this scripts after import torch

import torch
torch.cuda.current_device()