jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

Can't run neural-style in GPU mode #175

Open d3antran opened 8 years ago

d3antran commented 8 years ago

My card is NVS 5200M and my CUDA version is 7.5. When I tried to use neural-style in GPU mode with this command:

th neural_style.lua -style_image picasso.jpg -content_image con.jpg -backend cudnn -cudnn_autotune -optimizer adam

it returned:

[libprotobuf WARNING google/protobuf/io/coded_stream.cc:505] Reading dangerously large protocol message.  If the message turns out to be larger than 1073741824 bytes, parsing will be halted for security reasons.  To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:78] The total number of bytes read was 574671192
Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel
conv1_1: 64 3 3 3
conv1_2: 64 64 3 3
conv2_1: 128 64 3 3
conv2_2: 128 128 3 3
conv3_1: 256 128 3 3
conv3_2: 256 256 3 3
conv3_3: 256 256 3 3
conv3_4: 256 256 3 3
conv4_1: 512 256 3 3
conv4_2: 512 512 3 3
conv4_3: 512 512 3 3
conv4_4: 512 512 3 3
conv5_1: 512 512 3 3
conv5_2: 512 512 3 3
conv5_3: 512 512 3 3
conv5_4: 512 512 3 3
fc6: 1 1 25088 4096
fc7: 1 1 4096 4096
fc8: 1 1 4096 1000
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-3053/cutorch/lib/THC/generic/THCStorage.cu line=40 error=2 : out of memory
/home/dean/torch/install/bin/luajit: /home/dean/torch/install/share/lua/5.1/nn/utils.lua:11: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-3053/cutorch/lib/THC/generic/THCStorage.cu:40
stack traceback:
    [C]: in function 'resize'
    /home/dean/torch/install/share/lua/5.1/nn/utils.lua:11: in function 'torch_Storage_type'
    /home/dean/torch/install/share/lua/5.1/nn/utils.lua:57: in function 'recursiveType'
    /home/dean/torch/install/share/lua/5.1/nn/Module.lua:123: in function 'type'
    /home/dean/torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
    /home/dean/torch/install/share/lua/5.1/nn/utils.lua:41: in function 'recursiveType'
    /home/dean/torch/install/share/lua/5.1/nn/Module.lua:123: in function 'cuda'
    ...dean/torch/install/share/lua/5.1/loadcaffe/loadcaffe.lua:46: in function 'load'
    neural_style.lua:73: in function 'main'
    neural_style.lua:500: in main chunk
    [C]: in function 'dofile'
    ...dean/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x004065d0'

I tried to lower the image_size to 100, to 10, and to 1, it still didnt work: it returned the same error.

The nvidia-smi command returns:

Mon Mar 14 12:00:29 2016       
+------------------------------------------------------+                       
| NVIDIA-SMI 352.63     Driver Version: 352.63         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  NVS 5200M           Off  | 0000:01:00.0     N/A |                  N/A |
| N/A   55C   P12    N/A /  N/A |    206MiB /  1023MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+

I dont know whether my GPU can use neural-style or not. On the NVIDIA webpage https://developer.nvidia.com/cuda-gpus, it says that my GPU is CUDA capable.

misterkivi commented 8 years ago

I have same problem on 570 GTX(1GB memory), hope anyone could help

`+------------------------------------------------------+`                       
| NVIDIA-SMI 352.79     Driver Version: 352.79         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 570     Off  | 0000:01:00.0     N/A |                  N/A |
| 40%   40C    P0    N/A /  N/A |    422MiB /  1279MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+