matanox
matanox

Reputation: 13716

cuda torch integration - CudaTensor class not found

Probably, I'm not sufficiently familiar with the dependencies stack here, but I've installed a Deep Learning project that uses Torch and CUDA: https://github.com/donglixp/lang2logic.

Running the project (e.g. by issuing: ./pretrain.sh seq2seq jobqueries lstm), I get this error:

THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-1028/cutorch/lib/THC/THCGeneral.c line=66 error=30 : unknown error
package cunn not found! 
package cutorch not found!  
If cutorch and cunn are installed, your CUDA toolkit may be improperly configured.  
Check your CUDA toolkit installation, rebuild cutorch and cunn, and try again.  
Falling back on CPU mode    
~/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor>

The last error by the way, is issued from this self-explanatory piece of lua code, which checks for the availability of the CudaTensor class:

 if not torch.factory(className) then
    error(string.format('unknown Torch class <%s>', tostring(className)))
 end

After getting this error, I also installed Lua's cutorch and cunn through the following commands, which seemed to have finished well.

luarocks install cutorch
luarocks install cunn

But I still get the very same error.

The only installation quirk I've noticed had been that luarocks install class seemed to do nothing, and I'm not running on Scientific Linux as the original author, but rather on Ubuntu 16.04.

I had installed CUDA itself through: sudo apt-get install nvidia-cuda-toolkit

How would you address this integration error?

Thanks!

Upvotes: 0

Views: 732

Answers (1)

Fabrice Dugas
Fabrice Dugas

Reputation: 519

I would have preferred leaving only a comment, but I do not have enough reputation for that yet so here goes.

It seems like you have installation issues. The most obvious thing to try would be to uninstall torch entirely via rm -rf ~/torch and reinstall it following your link's instructions (replacing ClassNLLCriterion.cu file with theirs). Usually, following the instruction here should install cutorch and cunn for you but you can always install them via luarocks as you mentioned. This is also why luarocks install class didn't do anything because it was already installed.

In answer to your comment, torch.CudaTensor as the name suggests is a torch class defined in cutorch. It acts just like any other Tensor class from the torch library but it lives on GPU.

More information on how you installed torch could help.

You also of course need a CUDA compatible device in order to use cutorch.

Upvotes: 0

Related Questions