yoonkim / lstm-char-cnn

LSTM language model with CNN over characters
MIT License
826 stars 221 forks source link

OpenCL version #17

Open aigujin opened 8 years ago

aigujin commented 8 years ago

Hi, Would it be hard, by including cltorch and clnn libraries, to modify your code to support an OpenCL GPU implementation? As you mentioned, you've adapted Andrei's code for this and it has an OpenCL option to run (e.g., -opencl 1)

aigujin commented 8 years ago

Hi again,

I did a little of code modification and included option for using an OpenCL libraries. You can see that my GPU card has been recognized:

using OpenCL on GPU 0...    
loading data files...    
Word vocab size: 43617, Char vocab size: 84    
reshaping tensors...    
data load done. Number of batches in train: 653, val: 110, test: 1    
Word vocab size: 43617, Char vocab size: 84, Max word length (incl. padding):     53    
creating an LSTM-CNN with 2 layers    
Using Apple , OpenCL platform: Apple
Using OpenCL device: ATI Radeon HD 6770M
number of parameters in the model: 15431727    
cloning rnn    
cloning criterion 

However, the code breaks after that with this message:

/User/**/torch/install/bin/luajit: ...v/torch/install/share/lua/5.1/nn/TemporalConvolution.lua:41: attempt to call field 'TemporalConvolution_updateOutput' (a nil value)
stack traceback:
    .../torch/install/share/lua/5.1/nn/TemporalConvolution.lua:41: in function 'func'
    .../torch/install/share/lua/5.1/nngraph/gmodule.lua:311: in function 'neteval'
    .../torch/install/share/lua/5.1/nngraph/gmodule.lua:346: in function 'func'
    .../torch/install/share/lua/5.1/nngraph/gmodule.lua:311: in function 'neteval'
    .../torch/install/share/lua/5.1/nngraph/gmodule.lua:346: in function 'forward'
    main.lua:368: in function 'feval'
    main.lua:435: in main chunk
    [C]: in function 'dofile'
    .../torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x010cf78bb0

I cannot get a hold of this error but I see they are from nn library. Does it mean that OpenCL project do not have the same set of operations in nn package when comparing to CUDA project?