Skip to content

Commit

Permalink
remove some spam, fix buggette in build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
hughperkins committed Mar 16, 2016
1 parent f8cdde5 commit 158a496
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Expand Up @@ -7,7 +7,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# why? see http://stackoverflow.com/questions/20858911/lua-open-returns-null-using-luajit/20875342#20875342
OPTION(USE_LUAJIT "Link with luajit.so. Wont work on Mac. Faster on linux" OFF)
endif()
message("USE_LUAJIT ${USE_LUAJIT}")

FIND_PACKAGE(Torch REQUIRED) # you need to run source ~/torch/install/bin/torch-activate if this line
# gives an error
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -29,7 +29,7 @@ if [[ x${TORCH_INSTALL} == x ]]; then {
exit 1
} fi

if [[ x${{USE_LUAJIT}} == x ]]; then { USE_LUAJIT=ON; } fi
if [[ x${USE_LUAJIT} == x ]]; then { USE_LUAJIT=ON; } fi
if [[ x${CYTHON} != x ]]; then { python setup.py cython_only || exit 1; } fi
(cd cbuild; cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_LUAJIT=${USE_LUAJIT} -DCMAKE_INSTALL_PREFIX=${TORCH_INSTALL} && make -j 4 install) || exit 1
python setup.py install || exit 1
Expand Down
7 changes: 0 additions & 7 deletions src/nnWrapper.cpp
Expand Up @@ -24,28 +24,21 @@ using namespace std;

lua_State *luaInit() {
#ifndef _WIN32
// cout << "luaInit" << endl;
#ifdef USE_LUAJIT
#define LUALIBNAME "libluajit"
#else
#define LUALIBNAME "libPyTorchLua"
#endif
cout << "lua libname " << LUALIBNAME << endl;
void *hdl = dlopen(LUALIBNAME ".so", RTLD_NOW | RTLD_GLOBAL);
if(hdl == 0) {
// //cout << "Failed to load libPyTorchLua.so, trying dylib..." << endl;
hdl = dlopen(LUALIBNAME ".dylib", RTLD_NOW | RTLD_GLOBAL);
}
if(hdl == 0) {
cout << "Failed to load both " LUALIBNAME ".so and " LUALIBNAME ".dylib, fatal" << endl;
cout << dlerror() << endl;
throw runtime_error(string("Couldnt load " LUALIBNAME ".so or " LUALIBNAME ".dylib") + dlerror());
} else {
////// cout << "loaded lua library" << endl;
}
// void *err = dlopen("libpaths.so", RTLD_NOW | RTLD_GLOBAL);
// void *err = dlopen("libluajit.so", RTLD_NOW | RTLD_GLOBAL);
// cout << "err " << (long)err << endl;

#endif

Expand Down
7 changes: 0 additions & 7 deletions src/nnWrapper.jinja2.cpp
Expand Up @@ -24,28 +24,21 @@ using namespace std;

lua_State *luaInit() {
#ifndef _WIN32
// cout << "luaInit" << endl;
#ifdef USE_LUAJIT
#define LUALIBNAME "libluajit"
#else
#define LUALIBNAME "libPyTorchLua"
#endif
cout << "lua libname " << LUALIBNAME << endl;
void *hdl = dlopen(LUALIBNAME ".so", RTLD_NOW | RTLD_GLOBAL);
if(hdl == 0) {
// //cout << "Failed to load libPyTorchLua.so, trying dylib..." << endl;
hdl = dlopen(LUALIBNAME ".dylib", RTLD_NOW | RTLD_GLOBAL);
}
if(hdl == 0) {
cout << "Failed to load both " LUALIBNAME ".so and " LUALIBNAME ".dylib, fatal" << endl;
cout << dlerror() << endl;
throw runtime_error(string("Couldnt load " LUALIBNAME ".so or " LUALIBNAME ".dylib") + dlerror());
} else {
////// cout << "loaded lua library" << endl;
}
// void *err = dlopen("libpaths.so", RTLD_NOW | RTLD_GLOBAL);
// void *err = dlopen("libluajit.so", RTLD_NOW | RTLD_GLOBAL);
// cout << "err " << (long)err << endl;

#endif

Expand Down

0 comments on commit 158a496

Please sign in to comment.