The Torch scientific computing framework is an easy to use and efficient platform with wide support for machine learning algorithms. The underlying C/CUDA implementation is accessed through a fast scripting language called LuaJIT. Installation on the Jetson TK1 is straightforward. We also add extensions for cuDNN support. Looky here:
The Torch website lists all the good bits about why people should use Torch. There are a wide variety of applications that can be built using Torch. From the website:
Torch comes with a large ecosystem of community-driven packages in machine learning, computer vision, signal processing, parallel processing, image, video, audio and networking among others, and builds on top of the Lua community.
At the heart of Torch are the popular neural network and optimization libraries which are simple to use, while having maximum flexibility in implementing complex neural network topologies. You can build arbitrary graphs of neural networks, and parallelize them over CPUs and GPUs in an efficient manner.
The reason that you should pay attention to Torch is that it is being used by a lot of the big players in the deep learning/machine learning space, including such familiar names as Facebook, Google and Twitter.
Torch 7 Installation
Installation is straightforward. The entire installation takes about an hour. There is a script that was used for the basis of the video https://github.com/torch/ezinstall. There were some issues with permissions during installation, so I just manually entered the two installation scripts.
$ git clone https://github.com/torch/ezinstall.git
$ cd ezinstall
$ sudo ./install-deps
$ sudo ./install-luajit+torch
If you want to install the NVIDIA® cuDNN – GPU Accelerated Deep Learning extension for Torch 7, you must go to the NVIDIA site and download the library. Note: You must be a CUDA Registered Developer (it’s free to sign up) in order to download the cuDNN library. The current version is V2. Download the extension, and switch to that directory, i.e. $
Here’s a script to install it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|# Install cuDNN V2 on NVIDIA Jetson TK1|
|# Register as a NVIDIA developer and download the cuDNN package|
|# Package is named cudnn-6.5-linux-ARMv7-V2.tgz|
|# This script and the cuDNN package should be in the same directory, usually ~/Downloads|
|# This script places the library and include files for cudnn in the CUDA 6.5 directories|
|# Make sure this is executing as root|
|if [ $(id -u) != 0 ]; then|
|echo "This script requires root permissions"|
|echo "$ sudo "$0""|
|# unzip the archive|
|tar -zxvf cudnn-6.5-linux-ARMv7-v2.tgz|
|# copy the include file|
|cp cudnn.h /usr/local/cuda-6.5/include|
|cp libcudnn* /usr/local/cuda-6.5/lib|
You can then switch back to your Home directory.
Once the cuDNN library is installed, you can then install the Torch extensions for cuDNN:
$ sudo luarocks install cutorch
$ sudo luarocks install cunn
$ sudo luarocks install cudnn
FYI, luarocks install cudnn will install Torch bindings (written by Soumith, https://github.com/soumith/cudnn.torch) for cuDNN library.
Torch 7 tends to use a lot of memory. If you use Torch, you will probably need to have a swap file set up. You can refresh your memory on how to do that here on another blog entry on JetsonHacks.
This installation installs Torch 7 on a NVIDIA Jetson TK1 running Linux for Tegra (L4T) 21.3 with CUDA 6.5. The installation was done over a fresh install using JetPack 1.1. For more information about doing a fresh install, see this blog entry on JetsonHacks.