Closed simgt closed 9 years ago
Ok. Doesnt look similar to any errors I've seen before. I don't have a Mac, so I dont have any way to replicate the issue, or experiment, unfortunately.
So I'm thinking it can't find the THCl library, but libcltorch.so seems to be looking for THCl.dylib at the proper place.
$ otool -L /Users/simon/.torch/install/lib/lua/5.1/libcltorch.so
/Users/simon/.torch/install/lib/lua/5.1/libcltorch.so:
@rpath/libluaT.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libTHCl.dylib (compatibility version 0.0.0, current version 0.0.0)
libclBLAS.2.dylib (compatibility version 2.0.0, current version 2.4.0)
@rpath/libTH.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
libEasyCL.dylib (compatibility version 0.0.0, current version 0.0.0)
libclew.1.0.0.dylib (compatibility version 1.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
$ otool -l /Users/simon/.torch/install/lib/lua/5.1/libcltorch.so
[...]
Load command 20
cmd LC_RPATH
cmdsize 40
path @executable_path/../lib (offset 12)
Load command 21
cmd LC_RPATH
cmdsize 48
path /Users/simon/.torch/install/lib (offset 12)
One thing I've noticed, and dont understand fully, is that sometimes a .so/.dylib loaded by one executable/shared-object is not always available to others, but somehow does prevent the others from loading it themselves too. Two things that seem to be related to this are:
RTLD_GLOBAL | RTLD_NOW
, then the library is then available to all other sos loaded laterOK, thanks. I'm new to luarocks... how can I get a prompt when compiling in order to try some changes ? EDIT: cloned the repo, simpler
You could git clone
the code by hand, like:
git clone https://github.com/hughperkins/cltorch.git
cd cltorch
luarocks make rocks/cltorch-scm-1.rockspec
I'm so confused... This has absolutely nothing to do with cltorch. I'm using an non-POSIX shell (Fish) with a command that converts the torch activate script, which didn't set the DYLD_LIBRARY_PATH environment variable properly. Everything is working now... thanks for your help ! (I would have preferred a more interesting solution ;) )
Ah, interesting. By the way, there is a Mac-related issue that sounds like it might be maybe related to this: the th
command only works if you remove the first #! /bin/luajit
shebang line, otherwise the environment variables are not passed through. https://github.com/hughperkins/cltorch/issues/21#issuecomment-143385105
I don't have this issue... probably a little difference in the configuration. Anyway, I spent most of the night playing with cltorch and clnn and I love it, thanks for your awesome work ! I'm looking forward to submitting some patches :)
I don't have this issue... probably a little difference in the configuration.
Ok
Anyway, I spent most of the night playing with cltorch and clnn and I love it, thanks for your awesome work ! I'm looking forward to submitting some patches :)
Cool! :-)
@hughperkins I have the same issue when i try https://github.com/jcjohnson/neural-style and i've tried git clone
by hand, which made no difference.
As far as I know, the issue is caused by environment variables are not quite right. Can you print out the output of the following please:
env
cat ~/torch/install/bin/torch-activate
ls ~/torch/install/lib
ls ~/torch/install/lib/lua/5.1
source ~/torch/install/bin/torch-activate
env
env:
[edited by Hugh, to remove non-LUA stuff]
cat ~/torch/install/bin/torch-activate
:
export LUA_PATH='/Users/tianchishao/.luarocks/share/lua/5.1/?.lua;/Users/tianchishao/.luarocks/share/lua/5.1/?/init.lua;/Users/tianchishao/torch/install/share/lua/5.1/?.lua;/Users/tianchishao/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/tianchishao/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua'
export LUA_CPATH='/Users/tianchishao/.luarocks/lib/lua/5.1/?.so;/Users/tianchishao/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so'
export PATH=/Users/tianchishao/torch/install/bin:$PATH
export LD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib:$DYLD_LIBRARY_PATH
export LUA_CPATH='/Users/tianchishao/torch/install/lib/?.dylib;'$LUA_CPATH
ls ~/torch/install/lib
:
libEasyCL.dylib libclBLAS.dylib libthreadsmain.so
libTH.dylib libclew.1.0.0.dylib lua
libTHCl.dylib libclew.dylib luarocks
libclBLAS.2.4.0.dylib libluaT.dylib
libclBLAS.2.dylib libluajit.dylib
ls ~/torch/install/lib/lua/5.1
:
base64.so libTHCLNN.so libloadcaffe.so libsignal.so lzmq.so
cjson.so libTHNN.so libnn.so libsundown.so readline.so
crypto.so libclnn.so libnnx.so libsys.so treplutils.so
ffi libcltorch.so libpaths.so libthreads.so
ffi.so libimage.so libpng.so libtorch.so
lfs.so libjpeg.so libppm.so lzmq
env
:
[edited by Hugh to remove all non-LUA stuff]
LUA_PATH=/Users/tianchishao/.luarocks/share/lua/5.1/?.lua;/Users/tianchishao/.luarocks/share/lua/5.1/?/init.lua;/Users/tianchishao/torch/install/share/lua/5.1/?.lua;/Users/tianchishao/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/tianchishao/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua
LUA_CPATH=/Users/tianchishao/torch/install/lib/?.dylib;/Users/tianchishao/.luarocks/lib/lua/5.1/?.so;/Users/tianchishao/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
[edited by Hugh to remove all non-LUA stuff]
Ok. Your env is different after running source ~/torch/install/bin/torch-activate
;-) It now has LUA_PATH
and LUA_CPATH
set. Can you try rerunning your torch script, in the same terminal where you ran this, and see if that fixes the problem?
No, the problem is not fiexed yet. This's what i get:
/Users/tianchishao/torch/install/bin/luajit: ...s/tianchishao/torch/install/share/lua/5.1/trepl/init.lua:383: ...s/tianchishao/torch/install/share/lua/5.1/trepl/init.lua:383: ...tianchishao/torch/install/share/lua/5.1/cltorch/init.lua:19: cannot load '/Users/tianchishao/torch/install/lib/lua/5.1/libcltorch.so'
stack traceback:
[C]: in function 'error'
...s/tianchishao/torch/install/share/lua/5.1/trepl/init.lua:383: in function 'require'
neural_style.lua:55: in function 'main'
neural_style.lua:499: in main chunk
[C]: in function 'dofile'
...shao/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x0104b18bc0
Ah :-P Hmmm... that's disappointing :-P Hmmmm....
Can you repaste the following values from your enviornment please:
(edit: ie, do env
, and paste these values from the env
output, after running the torch-activate
script)
Hmmm, I just found your earlier env in my email, and it seems like you dont have a DYLD_LIBRARY_PATH or an LD_LIBRARY_PATH env var, right?
Hmmm, right. I can't find a DYLD_LIBRARY_PATH or an LD_LIBRARY_PATH env var. How can I fix this? Did I miss something?
Hmmm, interesting. Well, I'm not sure why they're not there, but they should be there, and I guess you can fix it by doing something like, directly in your terminal:
LD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib
DYLD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
or:
export LD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib
export DYLD_LIBRARY_PATH=/Users/tianchishao/torch/install/lib
I get the same exact error as this when trying to run the neural-style demo. The LD_LIBRARY_PATH and DYLD_LIBRARY_PATH seems to be there for me, but no go on the torch. I filed an issue: https://github.com/jcjohnson/neural-style/issues/119
Also running ElCap.
Brandons-iMac:neural-style brandonhurr$ env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
LUA_PATH=/Users/brandonhurr/.luarocks/share/lua/5.1/?.lua;/Users/brandonhurr/.luarocks/share/lua/5.1/?/init.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/brandonhurr/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua
LUA_CPATH=/Users/brandonhurr/torch/install/lib/?.dylib;/Users/brandonhurr/.luarocks/lib/lua/5.1/?.so;/Users/brandonhurr/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
Brandons-iMac:neural-style brandonhurr$ cat ~/torch/install/bin/torch-activate
export LUA_PATH='/Users/brandonhurr/.luarocks/share/lua/5.1/?.lua;/Users/brandonhurr/.luarocks/share/lua/5.1/?/init.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/brandonhurr/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua'
export LUA_CPATH='/Users/brandonhurr/.luarocks/lib/lua/5.1/?.so;/Users/brandonhurr/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so'
export PATH=/Users/brandonhurr/torch/install/bin:$PATH
export LD_LIBRARY_PATH=/Users/brandonhurr/torch/install/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/Users/brandonhurr/torch/install/lib:$DYLD_LIBRARY_PATH
export LUA_CPATH='/Users/brandonhurr/torch/install/lib/?.dylib;'$LUA_CPATH
Brandons-iMac:neural-style brandonhurr$ ls ~/torch/install/lib
libEasyCL.dylib libTHCl.dylib libclBLAS.2.dylib libclew.1.0.0.dylib libluaT.dylib libqlua.dylib libthreadsmain.so luarocks
libTH.dylib libclBLAS.2.4.0.dylib libclBLAS.dylib libclew.dylib libluajit.dylib libqtlua.dylib lua
Brandons-iMac:neural-style brandonhurr$ ls ~/torch/install/lib/lua/5.1
base64.so lfs.so libimage.so libpaths.so libqtide.so libsignal.so lzmq
cjson.so libTHCLNN.so libjpeg.so libpng.so libqtsvg.so libsundown.so lzmq.so
crypto.so libTHNN.so libloadcaffe.so libppm.so libqttorch.so libsys.so readline.so
ffi libclnn.so libnn.so libqtcore.so libqtuiloader.so libthreads.so treplutils.so
ffi.so libcltorch.so libnnx.so libqtgui.so libqtwidget.so libtorch.so
Brandons-iMac:neural-style brandonhurr$ source ~/torch/install/bin/torch-activate
Brandons-iMac:neural-style brandonhurr$ env
LUA_PATH=/Users/brandonhurr/.luarocks/share/lua/5.1/?.lua;/Users/brandonhurr/.luarocks/share/lua/5.1/?/init.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?.lua;/Users/brandonhurr/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/brandonhurr/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua
LUA_CPATH=/Users/brandonhurr/torch/install/lib/?.dylib;/Users/brandonhurr/.luarocks/lib/lua/5.1/?.so;/Users/brandonhurr/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
Hmmm. Unfortunately I have no way of reproducing this. Travis OS X version seems to work ok for me
If it was me, and I had a Mac handy, what I'd probably try doing is modify init.lua to preload all the libraries that seem relevant, and then rebuild, ie luarocks make rocks/cltorch-scm-1.rockspec
. For the preload, I think it will look something like, in init.lua:
ffi.load(package.searchpath('libpaths', package.cpath), true)
And keep adding lines for all the libraries that are being loaded. You can use ldd
to check the list, eg:
user@pear:~/git$ ldd ~/torch/install/lib/lua/5.1/libcltorch.so
linux-vdso.so.1 => (0x00007fffaa9f5000)
libluaT.so => /home/user/torch/install/lib/libluaT.so (0x00007fa0ab126000)
libTHCl.so => /home/user/torch/install/lib/libTHCl.so (0x00007fa0aaec3000)
libTH.so => /home/user/torch/install/lib/libTH.so (0x00007fa0aaa83000)
libEasyCL.so => /home/user/torch/install/lib/libEasyCL.so (0x00007fa0aa84e000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa0aa524000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa0aa30e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa0a9f49000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa0a9d2a000)
libclew.so.1.0.0 => /home/user/torch/install/lib/../lib/libclew.so.1.0.0 (0x00007fa0a9b24000)
libclBLAS.so.2 => /home/user/torch/install/lib/../lib/libclBLAS.so.2 (0x00007fa0a9848000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa0a9541000)
libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007fa0a7d38000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa0a7b30000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fa0a7920000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa0ab56f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa0a771c000)
so, candidates to try loading include: libTHCl.so, libTH.so, libEasyCL.so, libclew.so, libclBLAS.so.2. The othre libraries in the list are pretty standard, unlikely to be causing issues.
You can also try creating an empty script, and just preloading one of the lower level libraries, eg libclew.so has no dependencies, then gradually add higher and higher level libraries, until all are loaded, or there is some issue. clew has no depednencies, other than standard ones:
ldd ~/torch/install/lib/libclew.so
linux-vdso.so.1 => (0x00007fffbab8d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8502a50000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f850268b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8502e81000)
(forgot to add link to travis build, it is here: https://travis-ci.org/hughperkins/cltorch/builds/100248975 )
It was #21. It's grinding away right now. Fantastic. :)
Ok cool :-) We should fix this sometime somehow really...
Request: can you provide the output of the following please?
local ffi = require('ffi')
print('ffi.os', ffi.os)
Seems to fail
th> local ffi = require('ffi')
*[0.0000s]*
th> print('ffi.os', ffi.os)
[string "print('ffi.os', ffi.os)"]:1: attempt to index global 'ffi' (a nil
value)
stack traceback:
[string "print('ffi.os', ffi.os)"]:1: in main chunk
[C]: in function 'xpcall'
...s/brandonhurr/torch/install/share/lua/5.1/trepl/init.lua:668: in
function 'repl'
...hurr/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main
chunk
[C]: at 0x01083a2bc0
*[0.0001s]*
Ok, sorry, like this please, without the local
:
ffi = require('ffi')
print('ffi.os', ffi.os)
Much better this time:
th> ffi = require('ffi')
[0.0000s]
th> print('ffi.os', ffi.os)
ffi.os OSX
[0.0000s]
Thanks!
This problem happens in iTorch as well, and the removing #!/bin/sh
trick doesn't work.
However, I added source ~/torch/install/bin/torch-activate
to the top of install/bin/itorch_launcher
(first executable line of the script) and that fixed things.
Cool. Good information alsaksen :-)
Just a quick update that I could confirm this issue has something to do with zsh
on osx
, for now one could switch back to bash
and run all examples successfully.
libthclnn_searchpath /Users/____/torch/install/lib/lua/5.1/libTHCLNN.so
Using Apple , OpenCL platform: Apple
Using OpenCL device: Iris
Running with OpenCL on GPU 0
I'm not quite sure about the root cause and where to report this issue, but hopefully this helps @hughperkins to track down the issue.
Btw, great job building out the library, love your work!
Hi,
The installation went just fine, however I can't load the module. Here's the dump of the gdb session:
Apparently the module is trying to load some object files coming from the compilation temporary directory.. which have been deleted at the end of the installation. I'm looking into this, will post my progress here. Any suggestions appreciated :)