Saturday, October 14, 2017

Intall fbtorch

I referred to
https://github.com/facebookarchive/fbcunn/blob/master/INSTALL.md
in order to install fbtorch.

The key step for me is
curl -sk https://raw.githubusercontent.com/soumith/fblualib/master/install_all.sh | bash -e

which tries to install Folly, fbthrift, thpp and fblualib as the prerequisites.

It turns out that Folly and fbthrift are installed smoothly. However, some errors are raised for thpp. One solution is to install thpp manually. Here is how it goes:

1. Clone version 1.0 (stead of some default one)

git clone -b v1.0 https://github.com/facebook/thpp


2. Go under thpp/thpp and edit build.sh:
change the url in line 19 to
https://github.com/google/googletest/archive/release-1.7.0.zip

Then unzip googletest-release-1.7.0.zip, and rename it to gtest-1.7.0

3. Make the following changes in thpp/thpp/detail:
line 191:
return THTensor_(max)(values, indices, t, dim); 
to
return THTensor_(max)(values, indices, t, dim, 1); 

line 195:
return THTensor_(min)(values, indices, t, dim)
to
return THTensor_(min)(values, indices, t, dim, 1); 

line 198:
return THTensor_(sum)(values, indices, t, dim); 
to
return THTensor_(sum)(values, indices, t, dim, 1); 

line 201:
return THTensor_(prod)(values, indices, t, dim); 
to
return THTensor_(prod)(values, indices, t, dim, 1); 

Now we can install thpp by ./build.sh

4. Since fblualib is not installed due to the error with thpp, we will also install it manually
git clone https://github.com/soumith/fblualib;
cd fblualib/fblualib
./build.sh