Skip to content

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

Notifications You must be signed in to change notification settings

soumith/torch-ship-binaries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published