hughperkins / distro-cl

OpenCL Torch
147 stars 17 forks source link

OpenCL Torch

This is a distro of torch library enabled for OpenCL

Installation

Pre-requisites

Procedure

Please proceed as follows:

git clone --recursive https://github.com/hughperkins/distro -b distro-cl ~/torch-cl
cd ~/torch-cl
bash install-deps
./install.sh

Thats it! To test, you can do for example:

source ~/torch-cl/install/bin/torch-activate
luajit -l torch -e 'torch.test()'
luajit -l nn -e 'nn.test()'
luajit -l cltorch -e 'cltorch.test()'
luajit -l clnn -e 'clnn.test()'

If you're using CUDA, you can also run:

luajit -l cutorch -e 'cutorch.test()'
luajit -l cunn -e 'nn.testcuda()'

Alternative minimal no-gui install-deps

If you are using Ubuntu, and you dont need qt, itorch, or anything gui-like, then, instead of the line bash install-deps in the above instructions, you can do instead, according to your ubuntu version one of:

bash install-deps-nogui-ubuntu1404.sh

or:

bash install-deps-nogui-ubuntu1604.sh

This will install faster, since no qt packages will be installed.

Updating

Note that nn, torch, cutorch, and cunn are pinned, via the rocks-cl repository in your ~/torch-cl/install/etc/luarocks/config.lua file. So, doing any of luarocks install nn, luarocks install torch, luarocks install cltorch, luarocks install clnn, luarocks install cutorch, or luarocks install cunn should no longer break your installation (though they will, if you remove the pinning). However, on the whole, the recommended way of updating distro-cl is:

cd ~/torch-cl
git pull
git submodule update --init --recursive
./install.sh

If any errors like fatal: reference is not a tree, you have two options:

Unit-tests

To run, do:

source ~/torch-cl/install/bin/torch-activate
luajit -l torch -e 'torch.test()'
luajit -l nn -e 'nn.test()'
luajit -l cltorch -e 'cltorch.test()'
luajit -l clnn -e 'clnn.test()'

If you're using CUDA, you can also run:

luajit -l cutorch -e 'cutorch.test()'
luajit -l cunn -e 'nn.testcuda()'

Requests for additional operations etc

FAQ

How does this relate to mainline torch?

It's a stabilized version of torch mainline. Torch mainline is kind of in permanent 'sid'-style experimental mode. This is great for rapidly evolving torch, but it kind of sucks to develop solid libraries against :-D This distro holds Torch stable, and allows for porting new features as and when, without getting emails at 4am because something has changed in Torch mainline, and broken clnn :-D

Wont this be behind main Torch bleeding edge?

Yes. But hopefully stable. And working. Please file an issue for any features you want from upstream.

Can I use cunn and cutorch from this distro?

Yes

Do you support ubuntu 16.04?

Yes. I am running Ubuntu 16.04 :-)

How to request new features, or pull new features from upstream?

Please file an issue.

Why dont you have any github stars?

They're all on the project pages (for now), ie:

Related projects

The OpenCL is enabled by using the following two projects, which are installed implicitly by this distro:

An hcc implementation for Torch is in progress here:

Recent changes