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

ffi.lua:56: expected align(#) on line 579 #79

Open
LukaOo opened this issue Sep 7, 2016 · 19 comments
Open

ffi.lua:56: expected align(#) on line 579 #79

LukaOo opened this issue Sep 7, 2016 · 19 comments

Comments

@LukaOo
Copy link

LukaOo commented Sep 7, 2016

I have torch with Lua 5.2 installed on ubuntu 16.04. When I use require 'hdf5' I have got error

/root/torch/install/share/lua/5.2/hdf5/ffi.lua:56: expected align(#) on line 579
stack traceback:
/root/torch/install/share/lua/5.2/itorch/main.lua:166: in function </root/torch/install/share/lua/5.2/itorch/main.lua:159>
[C]: in function 'cdef'
/root/torch/install/share/lua/5.2/hdf5/ffi.lua:56: in function 'loadHDF5Header'
/root/torch/install/share/lua/5.2/hdf5/ffi.lua:60: in main chunk
[C]: in function 'dofile'
/root/torch/install/share/lua/5.2/torch/init.lua:54: in function 'include'
/root/torch/install/share/lua/5.2/hdf5/init.lua:29: in main chunk
[C]: in function 'require'
[string "hdf5 = require 'hdf5'..."]:1: in main chunk
[C]: in function 'xpcall'
/root/torch/install/share/lua/5.2/itorch/main.lua:209: in function </root/torch/install/share/lua/5.2/itorch/main.lua:173>
(...tail calls...)
/root/torch/install/share/lua/5.2/lzmq/poller.lua:75: in function 'poll'
/root/torch/install/share/lua/5.2/lzmq/impl/loop.lua:307: in function 'poll'
/root/torch/install/share/lua/5.2/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/root/torch/install/share/lua/5.2/lzmq/impl/loop.lua:370: in function 'start'
/root/torch/install/share/lua/5.2/itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: in ?

It seems the problem is in lua 5.2. I solved this issue when installed luajit.

@wpf5511
Copy link

wpf5511 commented Sep 11, 2016

I also get this problem , so I want to know does that mean I should reinstall torch use luajit?

@wpf5511
Copy link

wpf5511 commented Sep 11, 2016

@LukaOo

@LukaOo
Copy link
Author

LukaOo commented Sep 11, 2016

Yes, under luajit hdf5 works fine. I reinstalled torch with luajit

@FabbyD
Copy link

FabbyD commented Sep 14, 2016

Same as #73, is anyone aware of this problem? What if we can't use LuaJIT?

@himanshuUsc
Copy link

I am having the same issue . I am working on Ubuntu 16.04 . I have lua version 5.2.3.

@ambarpal
Copy link

@FabbyD Did you find a fix? I also have the same problem, working on Ubuntu 15.10 with Lua 5.2.3. I cannot install LuaJIT because of memory issues.

@FabbyD
Copy link

FabbyD commented Oct 29, 2016

Hmm, sadly no. Not by using Lua 5.1 atleast. I ended up using LuaJIT. I dont know what kind of memory issue you have, but it seems like most memory allocation in the torch library (mostly Tensors) are done in C which bypasses the LuaJIT's garbage collector. From what I have read, the memory limit in LuaJIT comes from its current GC. I know they are working on a new version that should get rid of this limitation (fingers crossed). Correct me if I'm wrong.
Anyways. Using LuaJIT on Ubuntu 16.04, I am able to load 20GB in memory from an hdf5 file. Have you given it a try? Since you are using Lua 5.2, you might have some refactoring to do since LuaJIT is not quite 5.2-compatible yet.

@ambarpal
Copy link

Ah, I see. I had this memory problem long ago with LuaJIT and then used 5.2 since. I will give it a try

@FabbyD
Copy link

FabbyD commented Oct 29, 2016

If you're loading straight Lua arrays from the HDF5 file then you most probably will still have the same problem (if you load more than 2GB).

@ambarpal
Copy link

LuaJIT made hdf5 work, but now I'm struggling to load models saved in Lua 5.2 into LuaJIT. Getting incompatible byteCodes all over the place. I guess I will get the array problem also once this fixes :(

@kprimice
Copy link

Any update on that issue? I would also prefer to use Lua 5.2

@ambarpal
Copy link

@kprimice I still don't know what fixed it. But going back to Ubuntu 14.04 with a previous version of GCC(4.8.4) and Lua 5.1 worked. Lua 5.1 does not have the memory issue, so I'm working with this for now

@lymrty
Copy link

lymrty commented Nov 24, 2016

lxy@lxy-Lenovo:~/neuraltalk2$ th eval.lua -model /home/lxy/model_id1-501-1448236541.t7 -image_folder /home/lxy/Flickr8k_Dataset/Flicker8k_Dataset/ -num_images 10
/home/lxy/torch/install/bin/lua: /home/lxy/torch/install/share/lua/5.2/trepl/init.lua:389: /home/lxy/torch/install/share/lua/5.2/trepl/init.lua:389: /home/lxy/torch/install/share/lua/5.2/hdf5/ffi.lua:56: expected align(#) on line 579
stack traceback:
[C]: in function 'error'
/home/lxy/torch/install/share/lua/5.2/trepl/init.lua:389: in function 'require'
eval.lua:8: in main chunk
[C]: in function 'dofile'
.../lxy/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: in ?

well, i am also meet this expected align(#) on line 579 issue when i am trying to running Andrej Karpathy's program NeuralTalk2, so thanks everyone who gives an solution about my issue.

@gdh1995
Copy link

gdh1995 commented Jan 19, 2017

Lua 5.1 on Ubuntu 16 also has such a problem.

I can't use LuaJIT because the memory cost of my project is larger than 4GB...

@obbrc
Copy link

obbrc commented Jan 21, 2017

I have the same issue on Ubuntu 16.04 using gcc-5. Following @ambarpal's suggestion, I have installed gcc/g++ 4.8 and used Lua 5.1, the above error is not happening anymore.

However I still have the same memory error (both Lua 5.1 and LuaJIT give "not enough memory" with 6GB while reading 9GB H5 file (system has more than 20GB memory).

@McLawrence
Copy link

McLawrence commented Jul 3, 2017

I get a similar error despite using LuaJIT:

th -e "require 'hdf5'" ...<UserName>/torch/install/share/lua/5.1/trepl/init.lua:389: ...s/<UserName>/torch/install/share/lua/5.1/hdf5/ffi.lua:56: ')' expected near '_close' at line 1436

@jeamland
Copy link

jeamland commented Aug 21, 2017

And another one on FreeBSD:

> uname -a
FreeBSD bjrbsd 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r320364: Mon Jun 26 12:35:03 PDT 2017     benno@bjrbsd:/src/obj/src/freebsd/sys/GENERIC-NODEBUG  amd64
> th -e "require 'hdf5'"
/src/torch/torch/install/share/lua/5.1/trepl/init.lua:389: /src/torch/torch/install/share/lua/5.1/hdf5/ffi.lua:56: unexpected symbol near '_Alignof' at line 133

@t-li
Copy link

t-li commented Nov 13, 2017

I happen to need to load a bunch of large json files and I am suffering from the same issue on Lua5.1/5.2. For those who need to bypass LuaJIT heap limitation, might want to try torch-tds. And call collectgarbage("collect") properly as a temporary solution.

@spx1997
Copy link

spx1997 commented Nov 18, 2018

torch-hdf5 with lua 5.2 and gcc 4.8 can work. I think it has a relationship with version of gcc. (ps: My version of g++ is also 4.8)

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