SciRuby / nmatrix

Dense and sparse linear algebra library for Ruby via SciRuby
Other
469 stars 133 forks source link

Trouble installing on Amazon EC2 #563

Closed Coolnesss closed 7 years ago

Coolnesss commented 7 years ago

I'm trying to install nmatrix as part of my Rails build, using Elastic Beanstalk. When i run eb deploy, which deploys the code and runs bundle install, I get

(...)
  Installing nmatrix 0.2.3 with native extensions

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

      current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.3/ext/nmatrix
  /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170121-15040-1utdg3g.rb extconf.rb
  Cannot allocate memory - /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170121-15040-1utdg3g.rb extconf.rb 2>&1
(...)

Also when i SSH to the server and run gem install nmatrix -v 0.2.3 it hangs forever. Is it possible that my EC2 instance doesn't have enough memory to... compile nmatrix libraries? Any ideas? My instance should have 512MB of RAM.

lokeshh commented 7 years ago

Are you sure it hangs forever when you do 'gem install nmatrix -v 2.3'? It does take quite a time. Leave it for like half an hour and see if that works.

Coolnesss commented 7 years ago

Hey @lokeshh, thanks for your reply. Indeed, I left it for quite some time now and I managed to get the following error

virtual memory exhausted: Cannot allocate memory
make: *** [storage/yale/yale.o] Error 1

make failed, exit code 2

Does this mean i need to up the memory on my instance?

lokeshh commented 7 years ago

Does your hard disk have enough space left?

Coolnesss commented 7 years ago

df -h has the following output

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        488M   56K  488M   1% /dev
tmpfs           498M     0  498M   0% /dev/shm
/dev/xvda1      7,8G  2,9G  4,8G  38% /

Should this suffice for the installation? I think virtual memory refers to swap and RAM combined, so maybe i need to add more swap?

Coolnesss commented 7 years ago

Thanks, solved by adding more swap to my instance.