daily pastebin goal
75%
SHARE
TWEET

Torch CentOs 6

a guest Aug 31st, 2015 349 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sudo yum install -y epel-release # a lot of things live in EPEL
  2. sudo yum install -y cmake curl readline-devel ncurses-devel \
  3.                                 gcc-c++ gcc-gfortran git gnuplot unzip \
  4.                                 nodejs npm libjpeg-turbo-devel libpng-devel \
  5.                                 ImageMagick GraphicsMagick-devel fftw-devel \
  6.                                 sox-devel sox zeromq3-devel \
  7.                                 qt-devel qtwebkit-devel sox-plugins-freeworld
  8. sudo yum install -y python-ipython
  9.  
  10. # Get and build OpenBlas (Torch is much better with a decent Blas)
  11. cd /tmp/
  12. git clone https://github.com/xianyi/OpenBLAS.git -b master
  13. cd OpenBLAS
  14. if [ $(getconf _NPROCESSORS_ONLN) = 1 ]; then
  15.     make NO_AFFINITY=1 USE_OPENMP=0 USE_THREAD=0
  16. else
  17.     make NO_AFFINITY=1 USE_OPENMP=1
  18. fi
  19. RET=$?;
  20. if [ $RET -ne 0 ]; then
  21.     echo "Error. OpenBLAS could not be compiled";
  22.     exit $RET;
  23. fi
  24. sudo make install
  25. RET=$?;
  26. if [ $RET -ne 0 ]; then
  27.     echo "Error. OpenBLAS could not be installed";
  28.     exit $RET;
  29. fi
  30.  
  31. # Prefix:
  32. PREFIX=${PREFIX-/usr/local}
  33. echo "Installing Torch into: $PREFIX"
  34.  
  35. if [[ `uname` == 'Linux' ]]; then
  36.     export CMAKE_LIBRARY_PATH=/opt/OpenBLAS/include:/opt/OpenBLAS/lib:$CMAKE_LIBRARY_PATH
  37. fi
  38.  
  39. # Build and install Torch7
  40. cd /tmp
  41. git clone https://github.com/torch/luajit-rocks.git
  42. cd luajit-rocks
  43. mkdir build; cd build
  44. git checkout master; git pull
  45. rm -f CMakeCache.txt
  46. cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release
  47. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  48. make
  49. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  50. make install || sudo -E make install
  51. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  52. # check if we are on mac and fix RPATH for local install
  53. path_to_install_name_tool=$(which install_name_tool)
  54. if [ -x "$path_to_install_name_tool" ]
  55. then
  56.    install_name_tool -id ${PREFIX}/lib/libluajit.dylib ${PREFIX}/lib/libluajit.dylib
  57. fi
  58.  
  59. # Statuses:
  60. sundown=ok
  61. cwrap=ok
  62. paths=ok
  63. torch=ok
  64. nn=ok
  65. dok=ok
  66. gnuplot=ok
  67. qtlua=ok
  68. qttorch=ok
  69. lfs=ok
  70. penlight=ok
  71. sys=ok
  72. xlua=ok
  73. image=ok
  74. optim=ok
  75. cjson=ok
  76. trepl=ok
  77.  
  78. path_to_nvcc=$(which nvcc)
  79. if [ -x "$path_to_nvcc" ]
  80. then  
  81.     cutorch=ok
  82.     cunn=ok
  83. fi
  84.  
  85. # Install base packages:
  86. $PREFIX/bin/luarocks install sundown       ||  sudo -E $PREFIX/bin/luarocks install sundown
  87. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  88. $PREFIX/bin/luarocks install cwrap         ||  sudo -E $PREFIX/bin/luarocks install cwrap  
  89. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  90. $PREFIX/bin/luarocks install paths         ||  sudo -E $PREFIX/bin/luarocks install paths  
  91. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  92. $PREFIX/bin/luarocks install torch         ||  sudo -E $PREFIX/bin/luarocks install torch  
  93. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  94. $PREFIX/bin/luarocks install nn            ||  sudo -E $PREFIX/bin/luarocks install nn    
  95. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  96. $PREFIX/bin/luarocks install dok           ||  sudo -E $PREFIX/bin/luarocks install dok    
  97. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  98. $PREFIX/bin/luarocks install gnuplot       ||  sudo -E $PREFIX/bin/luarocks install gnuplot
  99. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  100. [ -n "$cutorch" ] && \
  101. ($PREFIX/bin/luarocks install cutorch      ||  sudo -E $PREFIX/bin/luarocks install cutorch        ||   cutorch=failed )
  102. [ -n "$cunn" ] && \
  103. ($PREFIX/bin/luarocks install cunn         ||  sudo -E $PREFIX/bin/luarocks install cunn           ||   cunn=failed )
  104.  
  105. $PREFIX/bin/luarocks install qtlua         ||  sudo -E $PREFIX/bin/luarocks install qtlua  
  106. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  107. $PREFIX/bin/luarocks install qttorch       ||  sudo -E $PREFIX/bin/luarocks install qttorch
  108. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  109. $PREFIX/bin/luarocks install luafilesystem ||  sudo -E $PREFIX/bin/luarocks install luafilesystem
  110. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  111. $PREFIX/bin/luarocks install penlight      ||  sudo -E $PREFIX/bin/luarocks install penlight
  112. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  113. $PREFIX/bin/luarocks install sys           ||  sudo -E $PREFIX/bin/luarocks install sys      
  114. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  115. $PREFIX/bin/luarocks install xlua          ||  sudo -E $PREFIX/bin/luarocks install xlua    
  116. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  117. $PREFIX/bin/luarocks install image         ||  sudo -E $PREFIX/bin/luarocks install image    
  118. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  119. $PREFIX/bin/luarocks install optim         ||  sudo -E $PREFIX/bin/luarocks install optim    
  120. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  121. $PREFIX/bin/luarocks install lua-cjson     ||  sudo -E $PREFIX/bin/luarocks install lua-cjson
  122. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  123. $PREFIX/bin/luarocks install trepl         ||  sudo -E $PREFIX/bin/luarocks install trepl    
  124. RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
  125.  
  126. # Done.
  127. echo ""
  128. echo "=> Torch7 has been installed successfully"
  129. echo ""
  130. echo "  + Extra packages have been installed as well:"
  131. echo "     $ luarocks list"
  132. echo ""
  133. echo "  + To install more packages, do:"
  134. echo "     $ luarocks search --all"
  135. echo "     $ luarocks install PKG_NAME"
  136. echo ""
  137. echo "  + Note: on MacOS, it's a good idea to install GCC 5 to enable OpenMP."
  138. echo "     You can do this by with brew"
  139. echo "      $ brew install gcc --without-multilib"
  140. echo "     type the following lines before running the installation script"
  141. echo "      export CC=gcc-5"
  142. echo "      export CXX=g++-5"
  143. echo "     For installing cunn, you will need instead the default AppleClang compiler,"
  144. echo "     which means you should open a new terminal (with unexported CC and CXX) and"
  145. echo "      luarocks install cunn"
  146. echo ""
  147. echo "  + packages installed:"
  148. echo "    - sundown   : " $sundown
  149. echo "    - cwrap     : " $cwrap
  150. echo "    - paths     : " $paths
  151. echo "    - torch     : " $torch
  152. echo "    - nn        : " $nn
  153. echo "    - dok       : " $dok
  154. echo "    - gnuplot   : " $gnuplot
  155. [ -n "$cutorch" ] && echo "    - cutorch   : " $cutorch
  156. [ -n "$cunn" ]    && echo "    - cunn      : " $cunn
  157. echo "    - qtlua     : " $qtlua
  158. echo "    - qttorch   : " $qttorch
  159. echo "    - lfs       : " $lfs
  160. echo "    - penlight  : " $penlight
  161. echo "    - sys       : " $sys
  162. echo "    - xlua      : " $xlua
  163. echo "    - image     : " $image
  164. echo "    - optim     : " $optim
  165. echo "    - cjson     : " $cjson
  166. echo "    - trepl     : " $trepl
  167. echo ""
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top