├── .travis.yml ├── README.md ├── clean-old.sh ├── install-all ├── install-deps └── install-luajit+torch /.travis.yml: -------------------------------------------------------------------------------- 1 | matrix: 2 | include: 3 | - os: linux 4 | dist: precise 5 | sudo: required 6 | - os: linux 7 | dist: trusty 8 | sudo: required 9 | - os: osx 10 | 11 | script: ./install-deps 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [DEPRECEATED REPOSITORY, DO NOT USE] 2 | 3 | # For those new, please use the instructions from our website to install torch: http://torch.ch/docs/getting-started.html#_ 4 | 5 | 6 | ## Updating from a previous version 7 | Note that if you are coming from a previous version you are advise to clean up the old installation with the following command 8 | 9 | ```bash 10 | curl -s https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh | bash 11 | ``` 12 | -------------------------------------------------------------------------------- /clean-old.sh: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Clean old installation 3 | # Removes all the files Torch related coming from a prev. install 4 | ###################################################################### 5 | 6 | # Some space 7 | echo 8 | 9 | # Check if we are on Mac (OS X) 10 | if [[ `uname` == 'Darwin' ]]; then 11 | echo 'Removing old Torch files from your Mac...' 12 | # Removing folders 13 | rm -rf /usr/local/lib/{luarocks/,lua/,torch/,torchrocks/} 14 | rm -rf /usr/local/share/{torch,cmake/torch/,lua} 15 | rm -rf /usr/local/etc/{luarocks/,torchrocks/} 16 | rm -rf /usr/local/include/{torch,TH,THC,lauxlib.h,lua.h,lua.hpp,luaT.h,luaconf.h,luajit.h,lualib.h,qtlua} 17 | rm -rf ~/.luarocks 18 | # Removing files 19 | rm -f /usr/local/bin/{torch,th,qlua,json2lua,lua2json,torch-lua,torch-qlua,torch-rocks,torch-rocks-admin,luajit,luarocks,macqlua,mdcat,qlua} 20 | rm -f /usr/local/lib/{*lua*,*TH*} 21 | fi 22 | 23 | # Check if we are on Linux (Ubuntu) 24 | if [[ `uname` == 'Linux' ]]; then 25 | echo 'Removing old Torch files from your Linux...' 26 | # Removing folders 27 | sudo rm -rf /usr/local/lib/{luarocks/,lua/,torch/,torchrocks/} 28 | sudo rm -rf /usr/local/share/{torch,cmake/torch/,lua} 29 | sudo rm -rf /usr/local/etc/{luarocks/,torchrocks/} 30 | sudo rm -rf /usr/local/include/{torch,TH,THC,lauxlib.h,lua.h,lua.hpp,luaT.h,luaconf.h,luajit.h,lualib.h,qtlua} 31 | sudo rm -rf ~/.luarocks 32 | sudo rm -rf ~/.cache/luarocks* 33 | # Removing files 34 | sudo rm -f /usr/local/bin/{torch,th,qlua,json2lua,lua2json,torch-lua,torch-qlua,torch-rocks,torch-rocks-admin,luajit,luarocks,mdcat,qlua} 35 | sudo rm -f /usr/local/lib/{*lua*,*TH*} 36 | fi 37 | 38 | echo 39 | echo 'All files from previous installation/s have been removed from your system.' 40 | echo 'You can now install the new Torch7! :)' 41 | echo 42 | -------------------------------------------------------------------------------- /install-all: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ###################################################################### 4 | # Complete install: 5 | # Install all dependencies for Torch7, then Torch7 itself. 6 | ###################################################################### 7 | { 8 | 9 | set -e 10 | 11 | function TPUT() 12 | { 13 | #check for TTY and tput and redefine our existence based upon the results 14 | if [[ -t 1 && -t 2 ]] && command -v "tput" >& /dev/null \ 15 | && tput setaf 1 >& /dev/null ; then 16 | function TPUT() 17 | { 18 | tput "$@" 19 | } 20 | else 21 | function TPUT() { : ; } 22 | fi 23 | 24 | #now call thy self 25 | TPUT "$@" 26 | } 27 | 28 | function ERROR() 29 | { 30 | TPUT setaf 1 >&2 31 | while read; do 32 | echo "ERROR: $REPLY" 33 | done <<< "$@" >&2 34 | TPUT sgr0 >&2 35 | } 36 | 37 | function WARN() 38 | { 39 | TPUT setaf 3 40 | while read; do 41 | echo "WARN: $REPLY" 42 | done <<< "$@" 43 | TPUT sgr0 44 | } 45 | 46 | function INFO() 47 | { 48 | TPUT setaf 2 49 | while read; do 50 | echo "INFO: $REPLY" 51 | done <<< "$@" 52 | TPUT sgr0 53 | } 54 | 55 | 56 | DEPS_URL="https://raw.githubusercontent.com/${_GITHUB_USER:-torch}/ezinstall/${_GITHUB_BRANCH:-master}/install-deps" 57 | TORCH_URL="https://raw.githubusercontent.com/${_GITHUB_USER:-torch}/ezinstall/${_GITHUB_BRANCH:-master}/install-luajit+torch" 58 | 59 | INFO "Preparing to install dependencies..." 60 | 61 | # Pull in dependencies 62 | if ! DEPS_SCRIPT="$( curl -s "$DEPS_URL" )" || \ 63 | [[ -z "$DEPS_SCRIPT" || "$DEPS_SCRIPT" = "Not Found" ]]; then 64 | ERROR "Failed to curl $DEPS_URL. Exitting." 65 | exit 1 66 | fi 67 | 68 | # Install dependencies 69 | if ! echo "$DEPS_SCRIPT" | bash ; then 70 | WARN "At least one of the dependencies failed to install. Continuing anyway." 71 | else 72 | INFO "Dependencies installed successfully." 73 | fi 74 | 75 | INFO "Preparing to install torch..." 76 | 77 | # Pull in torch 78 | if ! TORCH_SCRIPT="$( curl -s "$TORCH_URL" )" || \ 79 | [[ -z "$TORCH_SCRIPT" || "$TORCH_SCRIPT" = "Not Found" ]]; then 80 | ERROR "Failed to curl $TORCH_URL. Exitting." 81 | fi 82 | 83 | # Install torch 84 | if ! echo "$TORCH_SCRIPT" | bash ; then 85 | ERROR "Torch install returned an error. Installation may be incomplete." 86 | exit 1 87 | else 88 | INFO "Torch installed successfully." 89 | fi 90 | 91 | } 92 | -------------------------------------------------------------------------------- /install-deps: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | ###################################################################### 5 | # This script installs required dependencies for Torch7 6 | ###################################################################### 7 | { 8 | 9 | install_openblas() { 10 | # Get and build OpenBlas (Torch is much better with a decent Blas) 11 | cd /tmp/ 12 | rm -rf OpenBLAS 13 | git clone https://github.com/xianyi/OpenBLAS.git 14 | cd OpenBLAS 15 | if [ $(getconf _NPROCESSORS_ONLN) == 1 ]; then 16 | make NO_AFFINITY=1 USE_OPENMP=0 USE_THREAD=0 17 | else 18 | make NO_AFFINITY=1 USE_OPENMP=1 19 | fi 20 | RET=$?; 21 | if [ $RET -ne 0 ]; then 22 | echo "Error. OpenBLAS could not be compiled"; 23 | exit $RET; 24 | fi 25 | sudo make install 26 | RET=$?; 27 | if [ $RET -ne 0 ]; then 28 | echo "Error. OpenBLAS could not be installed"; 29 | exit $RET; 30 | fi 31 | } 32 | 33 | install_openblas_AUR() { 34 | # build and install an OpenBLAS package for Archlinux 35 | cd /tmp && \ 36 | curl https://aur.archlinux.org/cgit/aur.git/snapshot/openblas-lapack.tar.gz | tar zxf - && \ 37 | cd openblas-lapack 38 | makepkg -csi --noconfirm 39 | RET=$?; 40 | if [ $RET -ne 0 ]; then 41 | echo "Error. OpenBLAS could not be installed"; 42 | exit $RET; 43 | fi 44 | } 45 | 46 | checkupdates_archlinux() { 47 | # checks if archlinux is up to date 48 | if [[ -n $(checkupdates) ]]; then 49 | echo "It seems that your system is not up to date." 50 | echo "It is recommended to update your system before going any further." 51 | read -p "Continue installation ? [y/N] " yn 52 | case $yn in 53 | Y|y ) echo "Continuing...";; 54 | * ) echo "Installation aborted." 55 | echo "Relaunch this script after updating your system with 'pacman -Syu'." 56 | exit 0 57 | esac 58 | fi 59 | } 60 | 61 | # Based on Platform: 62 | if [[ `uname` == 'Darwin' ]]; then 63 | # GCC? 64 | if [[ `which gcc` == '' ]]; then 65 | echo "MacOS doesn't come with GCC: please install XCode and the command line tools." 66 | exit 1 67 | fi 68 | 69 | # Install Homebrew (pkg manager): 70 | if [[ `which brew` == '' ]]; then 71 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 72 | fi 73 | 74 | # Install dependencies: 75 | brew update 76 | brew install git readline cmake wget qt 77 | brew install libjpeg imagemagick zeromq graphicsmagick openssl 78 | brew link readline --force 79 | brew install caskroom/cask/brew-cask 80 | brew cask install xquartz 81 | brew remove gnuplot 82 | brew install gnuplot --with-wxmac --with-cairo --with-pdflib-lite --with-x11 --without-lua 83 | 84 | elif [[ "$(uname)" == 'Linux' ]]; then 85 | 86 | if [[ -r /etc/os-release ]]; then 87 | # this will get the required information without dirtying any env state 88 | DIST_VERS="$( ( . /etc/os-release &>/dev/null 89 | echo "$ID $VERSION_ID") )" 90 | DISTRO="${DIST_VERS%% *}" # get our distro name 91 | VERSION="${DIST_VERS##* }" # get our version number 92 | elif [[ -r /etc/redhat-release ]]; then 93 | DIST_VERS=( $( cat /etc/redhat-release ) ) # make the file an array 94 | DISTRO="${DIST_VERS[0],,}" # get the first element and get lcase 95 | VERS="${DIST_VERS[2]}" # get the third element (version) 96 | elif [[ -r /etc/lsb-release ]]; then 97 | DIST_VERS="$( ( . /etc/lsb-release &>/dev/null 98 | echo "${DISTRIB_ID,,} $DISTRIB_RELEASE") )" 99 | DISTRO="${DIST_VERS%% *}" # get our distro name 100 | VERSION="${DIST_VERS##* }" # get our version number 101 | else # well, I'm out of ideas for now 102 | echo '==> Failed to determine distro and version.' 103 | exit 1 104 | fi 105 | 106 | # Detect fedora 107 | if [[ "$DISTRO" = "fedora" ]]; then 108 | distribution="fedora" 109 | fedora_major_version="$VERSION" 110 | # Detect archlinux 111 | elif [[ "$DISTRO" = "arch" ]]; then 112 | distribution="archlinux" 113 | # Detect Ubuntu 114 | elif [[ "$DISTRO" = "ubuntu" ]] || [[ "$DISTRO" = "linuxmint" ]]; then 115 | export DEBIAN_FRONTEND=noninteractive 116 | distribution="ubuntu" 117 | ubuntu_major_version="${VERSION%%.*}" 118 | # Detect elementary OS 119 | elif [[ "$DISTRO" = "elementary" ]]; then 120 | export DEBIAN_FRONTEND=noninteractive 121 | distribution="elementary" 122 | elementary_version="${VERSION%.*}" 123 | # Detect CentOS 124 | elif [[ "$DISTRO" = "centos" ]]; then 125 | distribution="centos" 126 | centos_major_version="$VERSION" 127 | # Detect AWS 128 | elif [[ "$DISTRO" = "amzn" ]]; then 129 | distribution="amzn" 130 | amzn_major_version="$VERSION" 131 | else 132 | echo '==> Only Ubuntu, elementary OS, Fedora, Archlinux and CentOS distributions are supported.' 133 | exit 1 134 | fi 135 | 136 | # Install dependencies for Torch: 137 | if [[ $distribution == 'ubuntu' ]]; then 138 | sudo apt-get update 139 | # python-software-properties is required for apt-add-repository 140 | sudo apt-get install -y python-software-properties 141 | echo "==> Found Ubuntu version ${ubuntu_major_version}.xx" 142 | if [[ $ubuntu_major_version -lt '12' ]]; then 143 | echo '==> Ubuntu version not supported.' 144 | exit 1 145 | elif [[ $ubuntu_major_version -lt '14' ]]; then 146 | sudo add-apt-repository -y ppa:chris-lea/zeromq 147 | sudo add-apt-repository -y ppa:chris-lea/node.js 148 | elif [[ $ubuntu_major_version -lt '15' ]]; then 149 | sudo add-apt-repository -y ppa:jtaylor/ipython 150 | else 151 | sudo apt-get install -y software-properties-common \ 152 | libgraphicsmagick1-dev nodejs npm libfftw3-dev sox libsox-dev \ 153 | libsox-fmt-all 154 | fi 155 | 156 | gcc_major_version=$(gcc --version | grep ^gcc | awk '{print $4}' | \ 157 | cut -c 1) 158 | if [[ $gcc_major_version == '5' ]]; then 159 | echo '==> Found GCC 5, installing GCC 4.9.' 160 | sudo apt-get install -y gcc-4.9 libgfortran-4.9-dev g++-4.9 161 | fi 162 | 163 | sudo apt-get update 164 | sudo apt-get install -y build-essential gcc g++ curl \ 165 | cmake libreadline-dev git-core libqt4-core libqt4-gui \ 166 | libqt4-dev libjpeg-dev libpng-dev ncurses-dev \ 167 | imagemagick libzmq3-dev gfortran unzip gnuplot \ 168 | gnuplot-x11 ipython libreadline-dev 169 | 170 | if [[ $ubuntu_major_version -lt '14' ]]; then 171 | # Install from source after installing git and build-essential 172 | install_openblas || true 173 | else 174 | sudo apt-get install -y libopenblas-dev liblapack-dev 175 | fi 176 | 177 | elif [[ $distribution == 'elementary' ]]; then 178 | declare -a target_pkgs 179 | target_pkgs=( build-essential gcc g++ curl \ 180 | cmake libreadline-dev git-core libqt4-core libqt4-gui \ 181 | libqt4-dev libjpeg-dev libpng-dev ncurses-dev \ 182 | imagemagick libzmq3-dev gfortran unzip gnuplot \ 183 | gnuplot-x11 ipython ) 184 | sudo apt-get update 185 | # python-software-properties is required for apt-add-repository 186 | sudo apt-get install -y python-software-properties 187 | if [[ $elementary_version == '0.3' ]]; then 188 | echo '==> Found Ubuntu version 14.xx based elementary installation, installing dependencies' 189 | sudo apt-get install -y software-properties-common \ 190 | libgraphicsmagick1-dev nodejs npm libfftw3-dev sox libsox-dev \ 191 | libsox-fmt-all 192 | 193 | sudo add-apt-repository -y ppa:jtaylor/ipython 194 | else 195 | sudo add-apt-repository -y ppa:chris-lea/zeromq 196 | sudo add-apt-repository -y ppa:chris-lea/node.js 197 | fi 198 | sudo apt-get update 199 | sudo apt-get install -y "${target_pkgs[@]}" 200 | 201 | install_openblas || true 202 | 203 | elif [[ $distribution == 'archlinux' ]]; then 204 | echo "Archlinux installation" 205 | checkupdates_archlinux 206 | sudo pacman -S --quiet --noconfirm --needed \ 207 | cmake curl readline ncurses git \ 208 | gnuplot unzip libjpeg-turbo libpng libpng \ 209 | imagemagick graphicsmagick fftw sox zeromq \ 210 | ipython qt4 qtwebkit || exit 1 211 | pacman -Sl multilib &>/dev/null 212 | if [[ $? -ne 0 ]]; then 213 | gcc_package="gcc" 214 | else 215 | gcc_package="gcc-multilib" 216 | fi 217 | sudo pacman -S --quiet --noconfirm --needed \ 218 | ${gcc_package} gcc-fortran || exit 1 219 | # if openblas is not installed yet 220 | pacman -Qs openblas &> /dev/null 221 | if [[ $? -ne 0 ]]; then 222 | install_openblas_AUR || true 223 | else 224 | echo "OpenBLAS is already installed" 225 | fi 226 | 227 | elif [[ $distribution == 'fedora' ]]; then 228 | if [[ $fedora_major_version == '20' ]]; then 229 | sudo yum install -y cmake curl readline-devel ncurses-devel \ 230 | gcc-c++ gcc-gfortran git gnuplot unzip \ 231 | nodejs npm libjpeg-turbo-devel libpng-devel \ 232 | ImageMagick GraphicsMagick-devel fftw-devel \ 233 | sox-devel sox zeromq3-devel \ 234 | qt-devel qtwebkit-devel sox-plugins-freeworld \ 235 | ipython 236 | install_openblas || true 237 | elif [[ $fedora_major_version == '22' || $fedora_major_version == '23' ]]; then 238 | #using dnf - since yum has been deprecated 239 | #sox-plugins-freeworld is not yet available in repos for F22 240 | sudo dnf install -y cmake curl readline-devel ncurses-devel \ 241 | gcc-c++ gcc-gfortran git gnuplot unzip \ 242 | nodejs npm libjpeg-turbo-devel libpng-devel \ 243 | ImageMagick GraphicsMagick-devel fftw-devel \ 244 | sox-devel sox qt-devel qtwebkit-devel \ 245 | python-ipython czmq czmq-devel 246 | install_openblas || true 247 | else 248 | echo "Only Fedora 20 or Fedora 22 is supported for now, aborting." 249 | exit 1 250 | fi 251 | elif [[ $distribution == 'centos' ]]; then 252 | if [[ $centos_major_version == '7' ]]; then 253 | sudo yum install -y epel-release # a lot of things live in EPEL 254 | sudo yum install -y cmake curl readline-devel ncurses-devel \ 255 | gcc-c++ gcc-gfortran git gnuplot unzip \ 256 | nodejs npm libjpeg-turbo-devel libpng-devel \ 257 | ImageMagick GraphicsMagick-devel fftw-devel \ 258 | sox-devel sox zeromq3-devel \ 259 | qt-devel qtwebkit-devel sox-plugins-freeworld 260 | sudo yum install -y python-ipython 261 | install_openblas || true 262 | else 263 | echo "Only CentOS 7 is supported for now, aborting." 264 | exit 1 265 | fi 266 | elif [[ $distribution == 'amzn' ]]; then 267 | sudo yum install -y cmake curl readline-devel ncurses-devel \ 268 | gcc-c++ gcc-gfortran git gnuplot unzip \ 269 | nodejs npm libjpeg-turbo-devel libpng-devel \ 270 | ImageMagick GraphicsMagick-devel fftw-devel \ 271 | sox-devel sox zeromq3-devel \ 272 | qt-devel qtwebkit-devel sox-plugins-freeworld \ 273 | ipython libgfortran 274 | install_openblas || true 275 | fi 276 | 277 | else 278 | # Unsupported 279 | echo '==> platform not supported, aborting' 280 | exit 1 281 | fi 282 | 283 | ipython_exists=$(command -v ipython) 284 | if [[ $ipython_exists ]]; then { 285 | ipython_version=$(ipython --version|cut -f1 -d'.') 286 | if [[ $ipython_version != 2 && $ipython_version != 3 && $ipython_version != 4 ]]; then { 287 | echo 'WARNING: Your ipython version is too old. Type "ipython --version" to see this. Should be at least version 2' 288 | } fi 289 | } fi 290 | 291 | # Done. 292 | echo "==> Torch7's dependencies have been installed" 293 | 294 | } 295 | -------------------------------------------------------------------------------- /install-luajit+torch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ###################################################################### 4 | # Torch install 5 | # 6 | # This script installs Torch7, and a few extra packages 7 | # (penlight, optim, parallel, image). 8 | # 9 | # The install is done via Luarocks, which enables package 10 | # versions. This is the recommended method to deploy Torch, 11 | # torch-pkg is being deprecated. 12 | # 13 | # Once this script has been run once, you should be able to run 14 | # extra luarocks commands, and in particular install new packages: 15 | # $ luarocks install json 16 | # $ torch 17 | # > require 'json' 18 | # 19 | ###################################################################### 20 | { 21 | 22 | # Prefix: 23 | PREFIX=${PREFIX-/usr/local} 24 | echo "Installing Torch into: $PREFIX" 25 | 26 | if [[ `uname` == 'Linux' ]]; then 27 | export CMAKE_LIBRARY_PATH=/opt/OpenBLAS/include:/opt/OpenBLAS/lib:$CMAKE_LIBRARY_PATH 28 | fi 29 | 30 | # Build and install Torch7 31 | cd /tmp 32 | git clone https://github.com/torch/luajit-rocks.git 33 | cd luajit-rocks 34 | mkdir build; cd build 35 | git checkout master; git pull 36 | rm -f CMakeCache.txt 37 | cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release 38 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 39 | make 40 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 41 | make install || sudo -E make install 42 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 43 | # check if we are on mac and fix RPATH for local install 44 | path_to_install_name_tool=$(which install_name_tool) 45 | if [ -x "$path_to_install_name_tool" ] 46 | then 47 | install_name_tool -id ${PREFIX}/lib/libluajit.dylib ${PREFIX}/lib/libluajit.dylib 48 | fi 49 | 50 | # Statuses: 51 | sundown=ok 52 | cwrap=ok 53 | paths=ok 54 | torch=ok 55 | nn=ok 56 | dok=ok 57 | gnuplot=ok 58 | qtlua=ok 59 | qttorch=ok 60 | lfs=ok 61 | penlight=ok 62 | sys=ok 63 | xlua=ok 64 | image=ok 65 | optim=ok 66 | cjson=ok 67 | trepl=ok 68 | 69 | path_to_nvcc=$(which nvcc) 70 | if [ -x "$path_to_nvcc" ] 71 | then 72 | cutorch=ok 73 | cunn=ok 74 | fi 75 | 76 | # Install base packages: 77 | $PREFIX/bin/luarocks install sundown || sudo -E $PREFIX/bin/luarocks install sundown 78 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 79 | $PREFIX/bin/luarocks install cwrap || sudo -E $PREFIX/bin/luarocks install cwrap 80 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 81 | $PREFIX/bin/luarocks install paths || sudo -E $PREFIX/bin/luarocks install paths 82 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 83 | $PREFIX/bin/luarocks install torch || sudo -E $PREFIX/bin/luarocks install torch 84 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 85 | $PREFIX/bin/luarocks install nn || sudo -E $PREFIX/bin/luarocks install nn 86 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 87 | $PREFIX/bin/luarocks install dok || sudo -E $PREFIX/bin/luarocks install dok 88 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 89 | $PREFIX/bin/luarocks install gnuplot || sudo -E $PREFIX/bin/luarocks install gnuplot 90 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 91 | [ -n "$cutorch" ] && \ 92 | ($PREFIX/bin/luarocks install cutorch || sudo -E $PREFIX/bin/luarocks install cutorch || cutorch=failed ) 93 | [ -n "$cunn" ] && \ 94 | ($PREFIX/bin/luarocks install cunn || sudo -E $PREFIX/bin/luarocks install cunn || cunn=failed ) 95 | 96 | $PREFIX/bin/luarocks install qtlua || sudo -E $PREFIX/bin/luarocks install qtlua 97 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 98 | $PREFIX/bin/luarocks install qttorch || sudo -E $PREFIX/bin/luarocks install qttorch 99 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 100 | $PREFIX/bin/luarocks install luafilesystem || sudo -E $PREFIX/bin/luarocks install luafilesystem 101 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 102 | $PREFIX/bin/luarocks install penlight || sudo -E $PREFIX/bin/luarocks install penlight 103 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 104 | $PREFIX/bin/luarocks install sys || sudo -E $PREFIX/bin/luarocks install sys 105 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 106 | $PREFIX/bin/luarocks install xlua || sudo -E $PREFIX/bin/luarocks install xlua 107 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 108 | $PREFIX/bin/luarocks install image || sudo -E $PREFIX/bin/luarocks install image 109 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 110 | $PREFIX/bin/luarocks install optim || sudo -E $PREFIX/bin/luarocks install optim 111 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 112 | $PREFIX/bin/luarocks install lua-cjson || sudo -E $PREFIX/bin/luarocks install lua-cjson 113 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 114 | $PREFIX/bin/luarocks install trepl || sudo -E $PREFIX/bin/luarocks install trepl 115 | RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi 116 | 117 | # Done. 118 | echo "" 119 | echo "=> Torch7 has been installed successfully" 120 | echo "" 121 | echo " + Extra packages have been installed as well:" 122 | echo " $ luarocks list" 123 | echo "" 124 | echo " + To install more packages, do:" 125 | echo " $ luarocks search --all" 126 | echo " $ luarocks install PKG_NAME" 127 | echo "" 128 | echo " + Note: on MacOS, it's a good idea to install GCC 5 to enable OpenMP." 129 | echo " You can do this by with brew" 130 | echo " $ brew install gcc --without-multilib" 131 | echo " type the following lines before running the installation script" 132 | echo " export CC=gcc-5" 133 | echo " export CXX=g++-5" 134 | echo " For installing cunn, you will need instead the default AppleClang compiler," 135 | echo " which means you should open a new terminal (with unexported CC and CXX) and" 136 | echo " luarocks install cunn" 137 | echo "" 138 | echo " + packages installed:" 139 | echo " - sundown : " $sundown 140 | echo " - cwrap : " $cwrap 141 | echo " - paths : " $paths 142 | echo " - torch : " $torch 143 | echo " - nn : " $nn 144 | echo " - dok : " $dok 145 | echo " - gnuplot : " $gnuplot 146 | [ -n "$cutorch" ] && echo " - cutorch : " $cutorch 147 | [ -n "$cunn" ] && echo " - cunn : " $cunn 148 | echo " - qtlua : " $qtlua 149 | echo " - qttorch : " $qttorch 150 | echo " - lfs : " $lfs 151 | echo " - penlight : " $penlight 152 | echo " - sys : " $sys 153 | echo " - xlua : " $xlua 154 | echo " - image : " $image 155 | echo " - optim : " $optim 156 | echo " - cjson : " $cjson 157 | echo " - trepl : " $trepl 158 | echo "" 159 | 160 | } 161 | --------------------------------------------------------------------------------