Torch: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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 and could cause the install to fail.
You can compile [http://torch.ch/ Torch] on our [[RHEL | Red Hat Enterprise Linux (RHEL)]] machines. Please make sure to [[HelpDesk | contact staff]] if you 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.
'''Note you have to use Cuda 8 or Cuda 7.5 when compiling Torch. Certain newer GPU cards are not supported under Cuda 7.5. We will use Cuda 8 in this example.'''


First load the following software into your environment with GNU [[Modules]].
<pre>
<pre>
module add cuda/8.0.61 cudnn zeromq nodejs sox GraphicsMagick  
module add cuda/8.0.61 cudnn zeromq nodejs sox GraphicsMagick  
</pre>
Next we are going to create a python environment and active it (this assumes you are using the bash shell)
<pre>
virtualenv env  
virtualenv env  
source env/bin/activate  
source env/bin/activate  
</pre>
Then we are going to upgrade the python pip package manager and install two more dependencies
<pre>
pip install --upgrade pip
pip install --upgrade pip
pip install pyzmq ipython
pip install pyzmq ipython
</pre>
Next clone the repository from Torch ensuring you do it with the recursive option to get all its sub dependencies.
<pre>
git clone https://github.com/torch/distro.git torch --recursive  
git clone https://github.com/torch/distro.git torch --recursive  
</pre>
Finally build Torch, this will take awhile.
<pre>
cd torch && ./install.sh
cd torch && ./install.sh
</pre>
At the end it will give you example of how to activate your Torch environment here is an example.
<pre>
source install/bin/torch-activate
source install/bin/torch-activate
</pre>
</pre>

Latest revision as of 13:56, 23 October 2024

You can compile Torch on our Red Hat Enterprise Linux (RHEL) machines. Please make sure to contact staff if you 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. Certain newer GPU cards are not supported under Cuda 7.5. We will use Cuda 8 in this example.

First load the following software into your environment with GNU Modules.

module add cuda/8.0.61 cudnn zeromq nodejs sox GraphicsMagick 

Next we are going to create a python environment and active it (this assumes you are using the bash shell)

virtualenv env 
source env/bin/activate 

Then we are going to upgrade the python pip package manager and install two more dependencies

pip install --upgrade pip
pip install pyzmq ipython

Next clone the repository from Torch ensuring you do it with the recursive option to get all its sub dependencies.

git clone https://github.com/torch/distro.git torch --recursive 

Finally build Torch, this will take awhile.

cd torch && ./install.sh

At the end it will give you example of how to activate your Torch environment here is an example.

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)