make paths generic so that it works with both torch-pkg and luarocks installations
make sure torch runs with one thread only