New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running without CUDA: No LuaRocks module found for cutorch #14

Closed
cpury opened this Issue Sep 3, 2015 · 25 comments

Comments

Projects
None yet
@cpury

cpury commented Sep 3, 2015

Trying to run with the default parameters. Getting this error:

/Users/x/torch/install/bin/luajit: /Users/x/torch/install/share/lua/5.1/trepl/init.lua:363: module 'cutorch' not found:No LuaRocks module found for cutorch
    no field package.preload['cutorch']
    no file '/Users/x/.luarocks/share/lua/5.1/cutorch.lua'
    no file '/Users/x/.luarocks/share/lua/5.1/cutorch/init.lua'
    no file '/Users/x/torch/install/share/lua/5.1/cutorch.lua'
    no file '/Users/x/torch/install/share/lua/5.1/cutorch/init.lua'
    no file './cutorch.lua'
    no file '/Users/x/torch/install/share/luajit-2.1.0-alpha/cutorch.lua'
    no file '/usr/local/share/lua/5.1/cutorch.lua'
    no file '/usr/local/share/lua/5.1/cutorch/init.lua'
    no file '/Users/x/.luarocks/lib/lua/5.1/cutorch.so'
    no file '/Users/x/torch/install/lib/lua/5.1/cutorch.so'
    no file './cutorch.so'
    no file '/usr/local/lib/lua/5.1/cutorch.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'error'
    /Users/x/torch/install/share/lua/5.1/trepl/init.lua:363: in function 'require'
    neural_style.lua:42: in function 'main'
    neural_style.lua:370: in main chunk
    [C]: in function 'dofile'
    .../x/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x01028fc7b0

I tried explicitly using the nn engine. Also to install cutorch, which fails due to Specify CUDA_TOOLKIT_ROOT_DIR.

Note, this is OSX.

Thanks!

@jcjohnson

This comment has been minimized.

Owner

jcjohnson commented Sep 3, 2015

If you don't have cutorch installed then you won't be able to run in GPU mode. You can run in CPU only mode by passing the flag -gpu -1.

@cpury

This comment has been minimized.

cpury commented Sep 3, 2015

Ah missed that line!

Ok now I'm getting

[...]
Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel
/Users/x/torch/install/bin/luajit: models/VGG_ILSVRC_19_layers_deploy.prototxt.cpu.lua:7: attempt to call method 'ceil' (a nil value)
stack traceback:
    models/VGG_ILSVRC_19_layers_deploy.prototxt.cpu.lua:7: in main chunk
    [C]: in function 'dofile'
    ./loadcaffe_wrapper.lua:48: in function 'load'
    neural_style.lua:53: in function 'main'
    neural_style.lua:370: in main chunk
    [C]: in function 'dofile'
    .../x/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x010919c7b0
@jcjohnson

This comment has been minimized.

Owner

jcjohnson commented Sep 3, 2015

That should be fixed if you update your nn to the latest version; the ceil() method was added pretty recently in torch/nn@929cfc5.

@cpury

This comment has been minimized.

cpury commented Sep 3, 2015

Ha, thanks man that worked!! :)

@mintisan

This comment has been minimized.

mintisan commented Sep 4, 2015

@jcjohnson
how do i install cutorck, I execute luarocks install cutorch,but i encounter error below
image

@jcjohnson

This comment has been minimized.

Owner

jcjohnson commented Sep 4, 2015

Do you have CUDA installed?

@mintisan

This comment has been minimized.

mintisan commented Sep 4, 2015

@jcjohnson
like brew cask install cuda?

OS : Mac

@jcjohnson

This comment has been minimized.

Owner

jcjohnson commented Sep 4, 2015

I don't think you can install cuda with homebrew; try following the steps here:

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/#axzz3km0bJe3r

Alternatively you can run neural-style in CPU only mode with the flag -gpu -1.

@mintisan

This comment has been minimized.

mintisan commented Sep 4, 2015

@jcjohnson Thanks , I will have a try.

ps : in CPU mode is too slow :D

@reillydonovan

This comment has been minimized.

reillydonovan commented Oct 2, 2015

I'm receiving the same error, however CUDA is installed. I can get CUDA to work with DeepDreamVideo and when I type:

nvidia-smi
Thu Oct 1 17:17:11 2015
+------------------------------------------------------+
| NVIDIA-SMI 346.46 Driver Version: 346.46 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GRID K520 Off | 0000:00:03.0 Off | N/A |
| N/A 32C P0 37W / 125W | 10MiB / 4095MiB | 0% Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+

However, when I try to install cutorch, I'm returned:
luarocks install cutorch
Installing https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec... switching to 'build' mode
Cloning into 'cutorch'...
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 81 (delta 7), reused 25 (delta 0), pack-reused 0
Receiving objects: 100% (81/81), 122.26 KiB | 0 bytes/s, done.
Resolving deltas: 100% (7/7), done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/ubuntu/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/ubuntu/torch/install/lib/luarocks/rocks/cutorch/scm-1" && make -j$(getconf _NPROCESSORS_ONLN) install

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Torch7 in /home/ubuntu/torch/install
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (found
suitable version "7.0", minimum required is "5.5")
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindCUDA.cmake:806 (find_package_handle_standard_args)
CMakeLists.txt:7 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_cutorch-scm-1-6030/cutorch/build/CMakeFiles/CMakeOutput.log".

Error: Build error: Failed building.

Any suggestions on how to properly install cutorch? It seems like it can find CUDA but just isn't using it because of some kind of directory issue

@kirilledelman

This comment has been minimized.

kirilledelman commented Mar 9, 2016

Did you do this step? ( your actual dir will vary )

Set up the required environment variables:
export PATH=/Developer/NVIDIA/CUDA-7.0/bin:$PATH
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.0/lib:$DYLD_LIBRARY_PATH
@lihuibng

This comment has been minimized.

lihuibng commented Apr 26, 2016

run the command below of densecap:
th run_model.lua -input_image imgs/elephant.jpg -gpu -1
got error :
/Users/xxx/torch/install/bin/lua: /Users/wuyuangui/torch/install/share/lua/5.2/trepl/init.lua:384: /Users/xxx/torch/install/share/lua/5.2/trepl/init.lua:384: /Users/xxx/torch/install/share/lua/5.2/trepl/init.lua:384: module 'cutorch' not found:No LuaRocks module found for cutorch
no field package.preload['cutorch']
no file '/Users/xxx/.luarocks/share/lua/5.2/cutorch.lua'
no file '/Users/xxx/.luarocks/share/lua/5.2/cutorch/init.lua'
no file '/Users/xxx/torch/install/share/lua/5.2/cutorch.lua'
no file '/Users/xxx/torch/install/share/lua/5.2/cutorch/init.lua'
no file '/Users/xxx/.luarocks/share/lua/5.1/cutorch.lua'
no file '/Users/xxx/.luarocks/share/lua/5.1/cutorch/init.lua'
no file '/Users/xxx/torch/install/share/lua/5.1/cutorch.lua'
no file '/Users/xxx/torch/install/share/lua/5.1/cutorch/init.lua'
no file './cutorch.lua'
no file '/Users/xxx/torch/install/share/luajit-2.1.0-beta1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch/init.lua'
no file '/Users/xxx/.luarocks/lib/lua/5.2/cutorch.so'
no file '/Users/xxx/torch/install/lib/lua/5.2/cutorch.so'
no file '/Users/xxx/torch/install/lib/cutorch.dylib'
no file '/Users/xxx/.luarocks/lib/lua/5.1/cutorch.so'
no file '/Users/xxx/torch/install/lib/lua/5.1/cutorch.so'
no file './cutorch.so'
no file '/usr/local/lib/lua/5.1/cutorch.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/Users/xxx/torch/install/share/lua/5.2/trepl/init.lua:384: in function 'require'
run_model.lua:5: in main chunk
[C]: in function 'dofile'
...ngui/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: in ?

any idea ?
my Mac got the Inter GPu, so I want to run the command in CPU only models.

@jmbeach

This comment has been minimized.

jmbeach commented Apr 28, 2016

Yeah I would appreciate mac help.

I'm downloading cuda now from here.

I'm thinking if it still doesn't work, there's nothing stopping me from editing this file: /usr/local/Cellar/cmake/3.3.1/share/cmake/Modules/FindCUDA.cmake and manually setting the variable:

set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda/")

or something like that

@jmbeach

This comment has been minimized.

jmbeach commented Apr 28, 2016

@jmbeach

This comment has been minimized.

jmbeach commented Apr 28, 2016

Ok, everyone just download from the above installer and follow those directions. That did the trick for me (at least got me past that error)

@lihuibng

This comment has been minimized.

lihuibng commented Apr 30, 2016

but I did not got a NVIDIA GPU, the GPU is Intel Iris Graphics 6100 1536 MB , I install thie CUDA toolkit and driver , there is another error ' CUDA driver version is insufficient for CUDA runtime version.', any idea?

@jcjohnson

This comment has been minimized.

Owner

jcjohnson commented Apr 30, 2016

@lihuibng CUDA won't work on an Intel GPU; it only works on NVIDIA GPUs. OpenCL might work on the Intel GPU, but you probably won't have enough memory for neural-style to work. Your best bet is CPU mode.

@jmbeach

This comment has been minimized.

jmbeach commented Apr 30, 2016

Yeah, I realized I don't have an Nvidia card either (don't know why I thought I did) and was running in CPU and still got an error about some png library

@vinhqdang

This comment has been minimized.

vinhqdang commented May 5, 2016

Hello

Is there a way to automatically select CPU or GPU mode? I have two computers, one with CUDA and one without. I maintained one code repository but I have to modify the code locally.

@sdziscool

This comment has been minimized.

sdziscool commented May 5, 2016

@vinhqdang yes, I wrote a few wiki pages just for people like you

the wiki You can find the instructions under "basic usage" in the "An Introduction to Neural Style" page

@vinhqdang

This comment has been minimized.

vinhqdang commented May 5, 2016

Hello @sdziscool

Thanks a lot for pointing me out a very interesting project 👍 However, I think it is not really my question.

I would like to have something like:

if CUDA is supported on the system:
  run with -gpu 0 -gpu_backend cuda (default parameters)
elif OpenCL is supported:
  run with -gpu_backend opencl
else:
  run with -gpu -1
@sdziscool

This comment has been minimized.

sdziscool commented May 5, 2016

@vinhqdang
Mmmh that's not going to be easy, the most basic thing you could do is check if deviceQuery or nvcc and clinfo actually return anything other than an error.

For now you're better of running everything with OpenCL via -backend clnn after you installed all the dependencies. I haven't tested it but it seems like both CPUs and NVIDIA have OpenCL support. You can check if they have OpenCL support by simply running clinfo after having installed the correct drivers.

Such a command would always use the GPU though because 95% of GPUs support OpenCL, so you'd have to check if a server was running headless without GPU or not. basically

elif OpenCL is supported:

will always return true, so you'd need a way to differentiate between an OpenCL enabled CPU and an OpenCL enabled GPU which is another challenge on it's own.

I'm sorry I can't provide you with a concrete answer but I hope i was able to help you somewhat!
Also I'd recommend opening up a new issue instead of interfering with an old one, as your problem is completely unrelated to this issue.

@htoyryla

This comment has been minimized.

htoyryla commented May 5, 2016

I think it should be possible to adapt to which modules have been installed as seen by lua, instead of actual HW capabilities, but have not checked that. Something like discussed here http://stackoverflow.com/questions/15429236/how-to-check-if-a-module-exists-in-lua

But on the other hand a fully automatic selection would be limiting... someone with a GPU with limited RAM may want to run neural-style job with CPU sometimes. Actually I didn't see the problem behind the request. There is no need to "modify code", just to use the correct parameters for -gpu and -backend when running neural-style.

@FuzzieLL

This comment has been minimized.

FuzzieLL commented Oct 19, 2016

@lihuibng have you solved the GPU problem? I got the same error message: CUDA driver version is insufficient for CUDA runtime version. My GPU is Intel Iris too.

@kpranav1998

This comment has been minimized.

kpranav1998 commented May 13, 2018

th computeProposals.lua $DEEPMASK/pretrained/deepmask -gpu -1
/home/pranav/torch/install/bin/luajit: /home/pranav/torch/install/share/lua/5.1/trepl/init.lua:389: module 'cutorch' not found:No LuaRocks module found for cutorch
no field package.preload['cutorch']
no file '/home/pranav/.luarocks/share/lua/5.1/cutorch.lua'
no file '/home/pranav/.luarocks/share/lua/5.1/cutorch/init.lua'
no file '/home/pranav/torch/install/share/lua/5.1/cutorch.lua'
no file '/home/pranav/torch/install/share/lua/5.1/cutorch/init.lua'
no file './cutorch.lua'
no file '/home/pranav/torch/install/share/luajit-2.1.0-beta1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch/init.lua'
no file '/home/pranav/.luarocks/lib/lua/5.1/cutorch.so'
no file '/home/pranav/torch/install/lib/lua/5.1/cutorch.so'
no file '/home/pranav/torch/install/lib/cutorch.so'
no file './cutorch.so'
no file '/usr/local/lib/lua/5.1/cutorch.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/pranav/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
computeProposals.lua:11: in main chunk
[C]: in function 'dofile'
...anav/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

I am still getting the same error pls help in this case .I am not able to run in cpu mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment