loop or previous error loading module 'cutorch'

58 views
Skip to first unread message

mark dana

unread,
May 29, 2020, 12:25:46 PM5/29/20
to torch7
Hi everyone!

I installed torch and GPU related dependencies by running the script:

```
apt-get update
apt-get -y install sudo
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh
. /root/torch/install/bin/torch-activate
apt-get update
sudo apt-get -y install libmatio-dev
~/torch/install/bin/luarocks install --server=https://luarocks.org/dev matio
sudo apt -y install nvidia-cuda-toolkit
~/torch/install/bin/luarocks install --server=https://luarocks.org/dev cutorch
git clone https://github.com/torch/cunn
cd cunn
~/torch/install/bin/luarocks make rocks/cunn-scm-1.rockspec
```

However when I try `th testcuda.lua` where `testcuda.lua` is

```
require 'torch'
require 'nn'
require 'nngraph'
require 'optim'
ok, cunn = pcall(require, 'cunn')
ok2, cutorch = pcall(require, 'cutorch')
print(ok,cunn,ok2,cutorch)
cutorch.setDevice(1)
```

The error message is
```
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-1728/cutorch/lib/THC/THCGeneral.c line=70 error=30 : unknown error
false   /root/torch/install/share/lua/5.1/trepl/init.lua:389: /root/torch/install/share/lua/5.1/trepl/init.lua:389: cuda runtime error (30) : unknown error at /tmp/luarocks_cutorch-scm-1-1728/cutorch/lib/THC/THCGeneral.c:70     false   /root/torch/install/share/lua/5.1/trepl/init.lua:389: loop or previous error loading module 'cutorch'       
/root/torch/install/bin/luajit: testcuda.lua:8: attempt to call field 'setDevice' (a nil value)
stack traceback:
        testcuda.lua:8: in main chunk
        [C]: in function 'dofile'
        /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x00405d50
```

`nvidia-smi` and `nvcc -V` all work well. Anyone knows how to solve it? Thanks a bunch to any possible help :)

mark dana

unread,
May 29, 2020, 12:39:30 PM5/29/20
to torch7
```
# cat /usr/local/cuda/version.txt
CUDA Version 9.0.176
```

```
# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
```
Reply all
Reply to author
Forward
0 new messages