Difference between revisions of "Torch"

From UMIACS
Jump to navigation Jump to search
(Created page with "You can compile [http://torch.ch/ Torch] on our RHEL7 machines. Please make sure to ask staff@umiacs.umd.edu if have issues as there are some local packages that are required...")
 
Line 10: Line 10:
 
pip install pyzmq ipython
 
pip install pyzmq ipython
 
git clone https://github.com/torch/distro.git torch --recursive  
 
git clone https://github.com/torch/distro.git torch --recursive  
cd torch && ./install.sh  
+
cd torch && ./install.sh
 +
source install/bin/torch-activate
 +
</pre>
 +
 
 +
Now you can test you your install with the command <code>th torch_test.th</code> where the contents of the file <code>torch_test.th</code> are the following.
 +
<pre>
 +
a = torch.Tensor(5,3)
 +
a = torch.rand(5,3)
 +
b = torch.rand(3,4)
 +
c = torch.Tensor(5,4)
 +
c:mm(a,b)
 +
 
 +
print(c)
 +
 
 +
require 'cutorch';
 +
a = a:cuda()
 +
b = b:cuda()
 +
c = c:cuda()
 +
c:mm(a,b)
 +
 
 +
print(c)
 
</pre>
 
</pre>

Revision as of 21:47, 7 March 2018

You can compile Torch on our RHEL7 machines. Please make sure to ask staff@umiacs.umd.edu if have issues as there are some local packages that are required and could cause the install to fail.

Note you have to use Cuda 8 or Cuda 7.5 when compiling Torch and that certain newer GPU cards are not supported under Cuda 7.5. We will use Cuda 8 in this example.

module add cuda/8.0.61 cudnn zeromq nodejs sox GraphicsMagick 
virtualenv env 
source env/bin/activate 
pip install --upgrade pip
pip install pyzmq ipython
git clone https://github.com/torch/distro.git torch --recursive 
cd torch && ./install.sh
source install/bin/torch-activate

Now you can test you your install with the command th torch_test.th where the contents of the file torch_test.th are the following.

a = torch.Tensor(5,3)
a = torch.rand(5,3)
b = torch.rand(3,4)
c = torch.Tensor(5,4)
c:mm(a,b)

print(c)

require 'cutorch';
a = a:cuda()
b = b:cuda()
c = c:cuda()
c:mm(a,b)

print(c)