Skip to content
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

Can't load libtorch.so #119

Closed
bhive01 opened this issue Jan 8, 2016 · 4 comments
Closed

Can't load libtorch.so #119

bhive01 opened this issue Jan 8, 2016 · 4 comments

Comments

@bhive01
Copy link

bhive01 commented Jan 8, 2016

Saw this and loved the idea. Downloaded and installed all of the required software (took a while!), but torch seems to be working fine. Installed the OpenCL part and downloaded the NiN model to run your demo, but I get an error.

Brandons-iMac:neural-style brandonhurr$ th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg -output_image profile.png -model_file models/nin_imagenet_conv.caffemodel -proto_file models/train_val.prototxt -gpu 0 -backend clnn -num_iterations 1000 -seed 123 -content_layers relu0,relu3,relu7,relu12 -style_layers relu0,relu3,relu7,relu12 -content_weight 10 -style_weight 1000 -image_size 512 -optimizer adam
/Users/brandonhurr/torch/install/bin/luajit: ...s/brandonhurr/torch/install/share/lua/5.1/trepl/init.lua:383: ...s/brandonhurr/torch/install/share/lua/5.1/trepl/init.lua:383: ...brandonhurr/torch/install/share/lua/5.1/cltorch/init.lua:19: cannot load '/Users/brandonhurr/torch/install/lib/lua/5.1/libcltorch.so'
stack traceback:
    [C]: in function 'error'
    ...s/brandonhurr/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'
    ...hurr/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x01010fbbc0

I verified that libtorch.so exists so I'm unsure why I can't get past this point.

Brandons-iMac:neural-style brandonhurr$ luajit -l clnn -e 'clnn.test()'
libthclnn_searchpath    /Users/brandonhurr/torch/install/lib/lua/5.1/libTHCLNN.so
Running 64 tests
|_______________________________________________________________  ==> Abs_backwardUsing Apple , OpenCL platform: Apple
Using OpenCL device: Iris Pro
____|___________________________________________________________  ==> ClassNLLCriterionMultipleTargetTHClReduceAll.cl build log: 
<program source>:9:10: warning: unused variable 'in1'
  float *in1 = &_in1;
         ^
<program source>:10:10: warning: unused variable 'out'
  float *out = &_out;
         ^

_____________________________________________________________|__  ==> mseApply_3t_0s_0pt_-2_-2_-2_*out = 0.00043487714720591 * (*in1 - *in2) build log: 
<program source>:37:12: warning: double precision constant requires cl_khr_fp64, casting to single precision
    *out = 0.00043487714720591 * (*in1 - *in2);
           ^

______________________________________________________________|_  ==> mse_nosizeaverageApply_3t_0s_0pt_-2_-2_-2_*out = 0.00040675208460443 * (*in1 - *in2) build log: 
<program source>:37:12: warning: double precision constant requires cl_khr_fp64, casting to single precision
    *out = 0.00040675208460443 * (*in1 - *in2);
           ^

________________________________________________________________  ==> Done                 

Completed 98 asserts in 64 tests with 0 errors

--------------------------------------------------------------------------------
@tigerneil
Copy link

@bhive01 I still cannot get this work in th.(in LuaJIT no problem)

LuaJIT 2.1.0-beta1 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/

 _____              _
|_   _|            | |
  | | ___  _ __ ___| |__
  | |/ _ \| '__/ __| '_ \
  | | (_) | | | (__| | | |
  \_/\___/|_|  \___|_| |_|

JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
th> require 'nn'
th> require 'clnn'
libthclnn_searchpath    /Users/zhuxiaohu/torch/install/lib/lua/5.1/libTHCLNN.so
th> require 'cltorch'
th> exit
th>> ^C

have u finally solved this problem?

@bhive01
Copy link
Author

bhive01 commented Jan 18, 2016

Yes, Apologies for not linking to the solution.

I got with someone on libtorch.
hughperkins/cltorch#24 (comment)

Found another message on the same library that suggested deleting #bin/bash from a single script file. Then it worked.
hughperkins/cltorch#21

See here on what to do. It works pretty well and is a lot of fun to play with. It looks like they might have pinned it down to another library TREPL.
torch/trepl#32

@bhive01 bhive01 closed this as completed Jan 18, 2016
@tigerneil
Copy link

thanks @bhive01 I found the problem is the usage of zsh shell. After I change to bash shell, everything goes OK. Hope all zsh guys knew this situation.

@markostam
Copy link

deleting the #!bin/bash worked for me as well on el capitan thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants