hughperkins / cltorch

An OpenCL backend for torch.
Other
291 stars 26 forks source link

Cannot load 'libcltorch.so' on OSX Yosemite #24

Closed simgt closed 9 years ago

simgt commented 9 years ago

Hi,

The installation went just fine, however I can't load the module. Here's the dump of the gdb session:

(gdb) r -l cltorch
Starting program: /Users/simon/.torch/install/bin/luajit -l cltorch
warning: `/BinaryCache/coreTLS/coreTLS-35.40.1~1/Objects/coretls.build/coretls.build/Objects-normal/x86_64/system_coretls_vers.o': can't open to read symbols: No such file or directory.
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_ciphersuites.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_handshake.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_record.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_stream_parser.a"
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClApply.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClBlas.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClDeviceUtils.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClGather.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClGeneral.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClKernels.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClReduce.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClReduceAll.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClReduceApplyUtils.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClScatter.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClStorage.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClStorageCopy.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensor.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorCopy.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorIndex.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMasked.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMath.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMath2.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathBlas.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathCompare.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathCompareT.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathPairwise.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathPointwise.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathScan.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTensorMathTransformReduce.cpp.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/luarocks_cltorch-scm-1-1483/cltorch/cltorch/build/src/lib/CMakeFiles/THCl.dir/THClTypeParseTraits.cpp.o': can't open to read symbols: No such file or directory.
/Users/simon/.torch/install/bin/luajit: /Users/simon/.torch/install/share/lua/5.1/cltorch/init.lua:19: cannot load '/Users/simon/.torch/install/lib/lua/5.1/libcltorch.so'
stack traceback:
    [C]: in function 'require'
    /Users/simon/.torch/install/share/lua/5.1/cltorch/init.lua:19: in main chunk
    [C]: at 0x010007a2b0
    [C]: at 0x01000011a0
[Inferior 1 (process 18172) exited with code 01]

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 :)

hughperkins commented 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.

simgt commented 9 years ago

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)
hughperkins commented 9 years ago

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:

simgt commented 9 years ago

OK, 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

hughperkins commented 9 years ago

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
simgt commented 9 years ago

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 ;) )

hughperkins commented 9 years ago

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

simgt commented 9 years ago

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 :)

hughperkins commented 9 years ago

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! :-)

mickeyinfoshan commented 8 years ago

@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.

hughperkins commented 8 years ago

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
mickeyinfoshan commented 8 years ago

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]
hughperkins commented 8 years ago

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?

mickeyinfoshan commented 8 years ago

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
hughperkins commented 8 years ago

Ah :-P Hmmm... that's disappointing :-P Hmmmm....

hughperkins commented 8 years ago

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)

hughperkins commented 8 years ago

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?

mickeyinfoshan commented 8 years ago

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?

hughperkins commented 8 years ago

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
bhive01 commented 8 years ago

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
hughperkins commented 8 years ago

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)
hughperkins commented 8 years ago

(forgot to add link to travis build, it is here: https://travis-ci.org/hughperkins/cltorch/builds/100248975 )

bhive01 commented 8 years ago

It was #21. It's grinding away right now. Fantastic. :)

hughperkins commented 8 years ago

Ok cool :-) We should fix this sometime somehow really...

hughperkins commented 8 years ago

Request: can you provide the output of the following please?

local ffi = require('ffi')
print('ffi.os', ffi.os)
bhive01 commented 8 years ago

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]*
hughperkins commented 8 years ago

Ok, sorry, like this please, without the local:

ffi = require('ffi')
print('ffi.os', ffi.os)
bhive01 commented 8 years ago

Much better this time:

th> ffi = require('ffi')
                                                                      [0.0000s] 
th> print('ffi.os', ffi.os)
ffi.os  OSX
                                                                      [0.0000s] 
hughperkins commented 8 years ago

Thanks!

aisaksen commented 8 years ago

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.

hughperkins commented 8 years ago

Cool. Good information alsaksen :-)

coodoo commented 8 years ago

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!