All Projects → soumith → torch-ship-binaries

soumith / torch-ship-binaries

Licence: other
A page describing how to ship torch binaries without sharing the source code of your scripts.

torch-ship-binaries

A page describing how to ship torch binaries without sharing the source code of your scripts.

  1. Create a self-contained torch install:
git clone https://github.com/torch/distro.git torch
cd torch
./install.sh

(you can add and remove packages from install.sh, i've added what I usually need all the time).

  1. Convert your lua scripts into bytecode:
luajit -b [script.lua] [script.out]

More doc here: http://luajit.org/running.html

  1. Place the byte-code scripts in torch/myscripts

  2. Create a shell script in the root of torch that sets the proper environment for your end-user, and passes the commandline options into your main lua script: torch/run.sh

#!/bin/bash
currdir=`dirname $0`
currdir=$(cd "$currdir" && pwd)
export PATH=$currdir/install/bin/:$PATH
export LD_LIBRARY_PATH=$currdir/install/lib/:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$currdir/install/lib/:$DYLD_LIBRARY_PATH
$currdir/install/bin/luajit myscripts/main.out $*
  1. Zip it and ship it, ask your thirdparty to unzip and start the program with "run.sh" All the commandline options will be passed to the entry lua script, so you can have command-line options using torch.CmdLine or penlight etc.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].