hughperkins / pytorch

Python wrappers for torch and lua
BSD 2-Clause "Simplified" License
431 stars 70 forks source link

Is LuaJIT supported as well? #9

Closed abhitopia closed 8 years ago

abhitopia commented 8 years ago

When I run my lua code using PyTorch, it seems to run Lua5.1 and not LuaJIT, any way I can change that?

hughperkins commented 8 years ago

So, what should happen is:

Can you confirm which platform you are using?

By the way, if you're on Mac, and wondering "why use lua on Mac", there are some complicated technical reasons involving memory: http://luajit.org/install.html

If you're building a 64 bit application on OSX which links directly or indirectly against LuaJIT, you need to link your main executable with these flags:

-pagezero_size 10000 -image_base 100000000

Also, it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). See: man rebase

Since our executable is python, we would need to rebuild python to do this. If you do want to rebuild python, to include these flags, we can probably work together to get pytorch to detect your version of python, or have an appropriate switch, so that it will link with luajit, instead of lua, on your system.

abhitopia commented 8 years ago

@hughperkins - You are right, I was indeed using my mac for the purpose. I am exploring TensorFlow now, and probably only come back to torch if it doesn't work for me. Thanks though.

hughperkins commented 8 years ago

ok, fair enough :-)