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

'bundle install' for nmatrix fails on MacOS unless user has special compiler flags #8

Closed
nethsix opened this issue Jul 11, 2016 · 13 comments
Assignees

Comments

@nethsix
Copy link
Collaborator

nethsix commented Jul 11, 2016

@chrhansen , @Arafatk

'bundle install' now breaks (see message below) since nmatrix requires gcc that supports special flags. If we want this gem to be used widely, it may be good to keep additional installation steps to a minimum? Is nmatrix required for accuracy in rspec testing or for performance reason? Would it make sense for someone to have the option to install the gem with nmatrix turned off unless required?

Thanks for your help.

Installing nmatrix 0.2.1 with native extensions                        [27/1864]

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/nethsix/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160711-52226-1
5l5d7y.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... Exception `Runt
imeError' at extconf.rb:141 - You need a version of g++ which supports -std=c++0
x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-b
rew-gcc.sh to install a more recent g++.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.                                                      [4/1864]
        --curdir
        --ruby=/Users/nethsix/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in `<main>': You need a version of g++ which supports -std=c++0x 
or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-bre
w-gcc.sh to install a more recent g++. (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in /Users/nethsix/.rvm/gems/ruby-2.2.4@ruby-tens
orflow-nethsix/gems/nmatrix-0.2.1 for inspection.
Results logged to /Users/nethsix/.rvm/gems/ruby-2.2.4@ruby-tensorflow-nethsix/ex
tensions/x86_64-darwin-15/2.2.0/nmatrix-0.2.1/gem_make.out
An error occurred while installing nmatrix (0.2.1), and Bundler cannot continue.
Make sure that `gem install nmatrix -v '0.2.1'` succeeds before bundling.
@arafatkatze
Copy link
Collaborator

@nethsix I am very sorry for the trouble.
The gem is working fine for me, but I get your point. After a short discussion, Christian used NMatrix in tests for checking if the shape of the arrays are correct (or not) and made a ruby equivalent of assertAllClose as you can see here (This was to make sure that the tests don't fail, as long as the results are within a tolerance value of the expected).
We may need NMatrix down the road for other purposes but for now we can also do without it.

As for checking dimensions, we can use this function

def dimension_finder(array)
  if array.any? { |nested_array| nested_array.is_a?(Array) }
    dim = array.group_by { |nested_array| nested_array.is_a?(Array) && dimension_finder(nested_array) }.keys
    [array.size] + dim.first if dim.size == 1 && dim.first
  else
    [array.size]
  end
end

And for comparing the arrays we could flatten them and then check them element wise. That is, if we want to. If you guys think this way is better, then I can do it.
@chrhansen What do you think ?

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 11, 2016

@Arafatk @chrhansen No trouble at all! I am sure I can make it work on my MacOS as well, and I will. My only concern is how this may deter casual users from installing the gem.

@chrhansen
Copy link
Collaborator

@nethsix Thanks for bringing this up! It was a bit of a concern for me when submitting #6. I mentioned it also to @MohawkJohn over at SciRuby/nmatrix#505 (comment) and they've created and issue SciRuby/nmatrix#525 to fix this for mac users.

Short term I don't mind rewriting all_be_close like what @Arafatk suggest above (and remove NMatrix), but eventually I think we would need something like NMatrix (or perhaps NArray?).

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 12, 2016

@chrhansen Nice. Glad to know NMatrix is working on a fix. Like you, I do believe that we may need NMatrix more moving forward.

@chrhansen
Copy link
Collaborator

@Arafatk could you assign this issue to me, or give permissions to assign issues?

I think I'll remove nmatrix and just do a manual check of shape and values similar to what @Arafatk suggests, if you guys agree.

@arafatkatze arafatkatze modified the milestone: @ch Jul 13, 2016
@arafatkatze
Copy link
Collaborator

arafatkatze commented Jul 13, 2016

@chrhansen This is nice and It would be good.

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 16, 2016

@chrhansen Nice!!!!

@chrhansen
Copy link
Collaborator

@nethsix thanks!

Off-topic, but now that I have you: do you by any chance have suggestions how to build Tensorflow on Travis-ci? I've tried a bunch of things, here, but currently I'm stuck at bazel build failing because of a C++ compiler error. Feel free to comment on chrhansen#1 if you have have any hints.

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 18, 2016

@chrhansen I believe that Travis CI uses some container technology like Docker, Vagrant, etc., to run the build and this could be related bazel not having the appropriate authorization. Perhaps this is related to: http://stackoverflow.com/questions/37213455/bazel-build-fails-with-executing-genrule-six-archive-copy-six-failed-error. It could also be something simpler as in not being in the correct directory when running the bazel command.

I will try to look at it more in-depth later.

@chrhansen
Copy link
Collaborator

chrhansen commented Jul 18, 2016

@nethsix Thanks. Could be – I've tried a couple things since two days ago.

I found out that in the node-tensorflow/node-tensorflow-project they have successfully compiled and built Tensorflow with bazel on Travis-CI for the Node.js-wrapper. So I'm currently seeing if I can copy their work. They have quite a bit of custom shell-scripts in here https://github.com/node-tensorflow/node-tensorflow/tree/master/tools though, which are cumbersome to sort through.

Are you using https://gitter.im/Arafatk/tensorflow.rb, or perhaps there's a better place to discuss this than in this issue? :)

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 18, 2016

@chrhansen I am now on gitter! I don't have experience using gitter so please do share how to use it effectively!

Thus far, for me (due to my lack of gitter experience), as much as possible I prefer discussions to be under 'issues', mainly because:

  • It tends to help everyone to think carefully before writing, thus keeping discussions short and to the point
  • Chat can get noisy after sometime, and it's easy for important discussions to scroll by in one's absence. Perhaps gitter can keep discussion for separate issues distinct?

@chrhansen
Copy link
Collaborator

@nethsix Ok! I also haven't used Gitter before, so really don't know if it's more helpful (reaching out to people) or more noise. My point was more that, I wanted to message you, and only had the issue-note option. I also prefer discussions to be within issues, but only if the discussion is related to the issue, which my Travis-compiler-question isn't.

@nethsix
Copy link
Collaborator Author

nethsix commented Jul 19, 2016

@chrhansen Agree. We're polluting this thread as we chat. On to Gitter!

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