1. 程式人生 > >深度 | 從硬體配置到軟體安裝,一臺深度學習機器的配備指南

深度 | 從硬體配置到軟體安裝,一臺深度學習機器的配備指南

#!/usr/bin/env bash
# Installation script for Deep Learning Libraries on Ubuntu 14.04, by Roelof Pieters (@graphific)
# BSD License

orig_executor="$(whoami)"
if [ "$(whoami)" == "root" ]; then
 echo "running as root, please run as user you want to have stuff installed as"
 exit 1
fi
###################################
#   Ubuntu 14.04 Install script for:
# - Nvidia graphic drivers for Titan X: 352
# - Cuda 7.0 (7.5 gives "out of memory" issues)
# - CuDNN3
# - Theano (bleeding edge)
# - Torch7
# - ipython notebook (running as service with circus auto(re)boot on port 8888)
# - itorch notebook (running as service with circus auto(re)boot on port 8889)
# - Caffe
# - OpenCV 3.0 gold release (vs. 2015-06-04)
# - Digits
# - Lasagne
# - Nolearn
# - Keras
###################################

export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y libncurses-dev

# next part copied from (check there for newest version):
# https://github.com/deeplearningparis/dl-machine/blob/master/scripts/install-deeplearning-libraries.sh

####################################
# Dependencies
####################################

# Build latest stable release of OpenBLAS without OPENMP to make it possible
# to use Python multiprocessing and forks without crash
# The torch install script will install OpenBLAS with OPENMP enabled in
# /opt/OpenBLAS so we need to install the OpenBLAS used by Python in a
# distinct folder.
# Note: the master branch only has the release tags in it
sudo apt-get install -y gfortran
export OPENBLAS_ROOT=/opt/OpenBLAS-no-openmp
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENBLAS_ROOT/lib
if [ ! -d "OpenBLAS" ]; then
   git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git
   (cd OpenBLAS \
     && make FC=gfortran USE_OPENMP=0 NO_AFFINITY=1 NUM_THREADS=$(nproc) \
     && sudo make install PREFIX=$OPENBLAS_ROOT)
   echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> ~/.bashrc
fi
sudo ldconfig

# Python basics: update pip and setup a virtualenv to avoid mixing packages
# installed from source with system packages
sudo apt-get update -y
sudo apt-get install -y python-dev python-pip htop
sudo pip install -U pip virtualenv
if [ ! -d "venv" ]; then
   virtualenv venv
   echo "source ~/venv/bin/activate" >> ~/.bashrc
fi
source venv/bin/activate
pip install -U pip
pip install -U circus circus-web Cython Pillow

# Checkout this project to access installation script and additional resources
if [ ! -d "dl-machine" ]; then
   git clone
[email protected]
:deeplearningparis/dl-machine.git
   (cd dl-machine && git remote add http https://github.com/deeplearningparis/dl-machine.git)
else
   if  [ "$1" == "reset" ]; then
       (cd dl-machine && git reset --hard && git checkout master && git pull --rebase $REMOTE master)
   fi
fi

# Build numpy from source against OpenBLAS
# You might need to install liblapack-dev package as well
# sudo apt-get install -y liblapack-dev
rm -f ~/.numpy-site.cfg
ln -s dl-machine/numpy-site.cfg ~/.numpy-site.cfg
pip install -U numpy

# Build scipy from source against OpenBLAS
rm -f ~/.scipy-site.cfg
ln -s dl-machine/scipy-site.cfg ~/.scipy-site.cfg
pip install -U scipy

# Install common tools from the scipy stack
sudo apt-get install -y libfreetype6-dev libpng12-dev
pip install -U matplotlib ipython[all] pandas scikit-image

# Scikit-learn (generic machine learning utilities)
pip install -e git+git://github.com/scikit-learn/scikit-learn.git#egg=scikit-learn

####################################
# OPENCV 3
####################################
# from http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/
# for 2.9 see http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/
cd ~/
sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev \
  pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev \
  libpng12-dev libtiff4-dev libjasper-dev libavcodec-dev libavformat-dev \
  libswscale-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev \
  libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev \
  libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip

wget https://github.com/Itseez/opencv/archive/3.0.0.tar.gz -O opencv-3.0.0.tar.gz
tar -zxvf  opencv-3.0.0.tar.gz

cd opencv-3.0.0
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j $(nproc)
sudo make install

sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
ln -s /usr/lib/python2.7/dist-packages/cv2.so /home/$orig_executor/venv/lib/python2.7/site-packages/cv2.so

echo "opencv 3.0 installed"

####################################
# Theano
####################################
# installing theano
# By default, Theano will detect if it can use cuDNN. If so, it will use it.
# To get an error if Theano can not use cuDNN, use this Theano flag: optimizer_including=cudnn.

pip install -e git+git://github.com/Theano/Theano.git#egg=Theano
if [ ! -f ".theanorc" ]; then
   ln -s ~/dl-machine/theanorc ~/.theanorc
fi

echo "Installed Theano"

# Tutorial files
if [ ! -d "DL4H" ]; then
   git clone
[email protected]
:SnippyHolloW/DL4H.git
   (cd DL4H && git remote add http https://github.com/SnippyHolloW/DL4H.git)
else
   if  [ "$1" == "reset" ]; then
       (cd DL4H && git reset --hard && git checkout master && git pull --rebase $REMOTE master)
   fi
fi

####################################
# Torch
####################################

if [ ! -d "torch" ]; then
   curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
   git clone https://github.com/torch/distro.git ~/torch --recursive
   (cd ~/torch && yes | ./install.sh)
fi
. ~/torch/install/bin/torch-activate

if [ ! -d "iTorch" ]; then
   git clone
[email protected]
:facebook/iTorch.git
   (cd iTorch && git remote add http https://github.com/facebook/iTorch.git)
else
   if  [ "$1" == "reset" ]; then
       (cd iTorch && git reset --hard && git checkout master && git pull --rebase $REMOTE master)
   fi
fi
(cd iTorch && luarocks make)

cd ~/
git clone https://github.com/torch/demos.git torch-demos

#qt dependency
sudo apt-get install -y qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

#main luarocks libs:
luarocks install image    # an image library for Torch7
luarocks install nnx      # lots of extra neural-net modules
luarocks install unup

echo "Installed Torch (demos in $HOME/torch-demos)"

# Register the circus daemon with Upstart
if [ ! -f "/etc/init/circus.conf" ]; then
   sudo ln -s $HOME/dl-machine/circus.conf /etc/init/circus.conf
   sudo initctl reload-configuration
fi
sudo service circus restart

cd ~/

## Next part ...
####################################
# Caffe
####################################

sudo apt-get install -y libprotobuf-dev libleveldb-dev \
 libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev \
 libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler \
 libatlas-base-dev libyaml-dev
 
git clone https://github.com/BVLC/caffe.git
cd caffe
for req in $(cat python/requirements.txt); do pip install $req -U; done

make all
make pycaffe

cd python
pip install networkx -U
pip install pillow -U
pip install -r requirements.txt

ln -s ~/caffe/python/caffe ~/venv/lib/python2.7/site-packages/caffe
echo -e "\nexport CAFFE_HOME=/home/$orig_executor/caffe" >> ~/.bashrc

echo "Installed Caffe"

####################################
# Digits
####################################

# Nvidia Digits needs a specific version of caffe
# so you can install the venv version by Nvidia uif you register
# with cudnn, cuda, and caffe already packaged
# instead we will install from scratch
cd ~/

git clone https://github.com/NVIDIA/DIGITS.git digits

cd digits
pip install -r requirements.txt

sudo apt-get install graphviz

echo "digits installed, run with ./digits-devserver or     ./digits-server"

####################################
# Lasagne
# https://github.com/Lasagne/Lasagne
####################################
git clone https://github.com/Lasagne/Lasagne.git
cd Lasagne
python setup.py install

echo "Lasagne installed"

####################################
# Nolearn
# asbtractions, mainly around Lasagne
# https://github.com/dnouri/nolearn
####################################
git clone https://github.com/dnouri/nolearn
cd nolearn
pip install -r requirements.txt
python setup.py install

echo "nolearn wrapper installed"

####################################
# Keras
# https://github.com/fchollet/keras
# http://keras.io/
####################################
git clone https://github.com/fchollet/keras.git
cd keras
python setup.py install

echo "Keras installed"

echo "all done, please restart your machine..."

#   possible issues & fixes:
# - skimage: issue with "not finding jpeg decoder?"
# "PIL: IOError: decoder zip not available"
# (https://github.com/python-pillow/Pillow/issues/174)
# sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev \
#     libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
# next try:
# pip uninstall pillow
# git clone https://github.com/python-pillow/Pillow.git
# cd Pillow
# python setup.py install

相關推薦

深度 | 硬體配置軟體安裝深度學習機器配備指南

#!/usr/bin/env bash# Installation script for Deep Learning Libraries on Ubuntu 14.04, by Roelof Pieters (@graphific)# BSD Licenseorig_executor="$(whoami)"i

mongodb叢集安裝主二replica_set

下載mongodb-linux-x86_64-rhel62-3.2.0.tar.gz,將該壓縮檔案上傳到三臺伺服器上, 將該檔案可以放入到如下地址: /Data/mongodb-linux-x86_64-rhel62-3.2.0進入到bin目錄下   touch mo

硬體軟體蘋果一直堅持的造車夢....

智造觀點這是一個關於蘋果造車夢的故事。2015年浮出水面,計劃打造完整的汽車;20

用虛擬機安裝Linux系統突然想克隆服務器克隆後發現無法上網如何解決?

network nbsp 修改 發現 sysconfig etc ebo 無法上網 work 用虛擬機安裝了一臺Linux系統,突然想克隆一臺服務器,克隆後發現無法上網,如何解決? 答: a、編輯網卡配置文件/etc/sysconfig/network-scri

Docker Win 10 系統下配置安裝並解決安裝遇到的問題!

目前支援Windows安裝的Docker軟體主要分為兩類: 一是基於win10 系統的Docker for Windows,這個只能裝在win 10 系統可以用;還有一個就是Docker Toolbox,可以安裝在win7,8,10等系統中。 本文主要是在Win10下安裝

用不到1000美元攢深度學習用的電腦深度學習和便宜硬體的探奇

從上世紀80年代後我就再沒攢過電腦。我也相當擔心花好幾百塊,最終搞一堆我自己裝不出來的零件(或是攢出來了,但可能沒法正常工作)。不過我要告訴你,攢機是可以的!另外,整個過程也很好玩。最後你能擁有一臺通用的電腦,並能做預測,同時比筆記本快20多倍。下面是購買清單和一些細節建議:主機板主機板有不同的尺寸規格。因為

Centos6.6 yum源更新方法及R軟體安裝R模組安裝

新到的叢集(centos 6.6)準備安裝些常用軟體yum install softwarename安裝第一個軟體yum install R發現找不到源路徑,解決辦法,更新yum源(來源https://blog.csdn.net/owangf_dl/article/detai

概念到底層技術文看懂區塊鏈架構設計

原文地址 前言 區塊鏈作為一種架構設計的實現,與基礎語言或平臺等差別較大。區塊鏈是加密貨幣背後的技術,是當下與VR虛擬現實等比肩的熱門技術之一,本身不是新技術,類似Ajax,可以說它是一種技術架構,所以我們從架構設計的角度談談區塊鏈的技術實現。 無論你擅長

客戶端到後臺文通吃

前記 最近一段時間,因為公司需求,需要轉向Java Web方向發展,Android得放下一段時間(不過還是會利用空餘時間堅持寫文章~)。 推送功能是app很常用的一個功能,目前能夠實現推送的第三方平臺也有不少,比如友盟、極光、信鴿等等,總之只要百度一下android推送關鍵字,就能看到很多的廠家。 這

Linux(CentOS)中常用軟體安裝使用及異常——MySQL, VmTools

本文主要是為了記錄在工作中遇到的常用軟體的安裝過程,方便以後遇到相同情形時可以快速的查閱。主要講述了MySQL, VMTools的安裝。 本文的作業系統採用的是CentOS,可以採用shell命令查閱:lsb_release -a. Mysql的

nginx的編譯安裝了解編譯安裝原理(轉)

title com 配置文件 fig 通過 cnblogs uninstall lock perl nginx編譯安裝過程 https://www.cnblogs.com/liujuncm5/p/6713784.html 1、configure 這一步一般

字串到常量池文看懂String類設計

# 從一道面試題開始 看到這個標題,你肯定以為我又要講這道面試題了 ```java // 這行程式碼建立了幾個物件? String s3 = new String("1"); ``` 是的,沒錯,我確實要從這裡開始 ![image-20200615221408500](https://imgconv

Aways on故障系列之二:數據庫中有無法同步

系列 意思 ip地址 pin 啟動服務 阿裏雲服務 無法連接 聯通 狀態 服務器用的阿裏雲服務器,自己做的非域Aways On主從同步。 故障描述:某臺從數據庫無法同步主數據庫的數據,查看Aways On的服務器狀態,該服務器已離線。 故障排查:     1.檢查同步面板,

logstash不同伺服器收集日誌到總服務

1,wget https://artifacts.elastic.co/downloads/logstash/logstash-6.4.2.tar.gz 2,tar -zxvf logstash-6.4.2.tar.gz 3,cd /opt/tmp/logstash-6.4.2 4,在終端中

【java的漣漪】杯咖啡電腦品我java

專欄達人 授予成功建立個人部落格專欄

Linux:01---VMware與Ubuntu的選擇安裝啟動第一個虛擬機器、BIOS中開啟VT-X

一、VMware的下載與安裝 概念:虛擬機器環境,可以執行Linux作業系統 下載 網址搜尋www.vmware.com的官網 進入下載欄===>選擇Workstation Pro 根據自己所在的作業系統下載最新版本 安裝 下載之後找到

Linux部署WEB專案伺服器部署兩個Tomcat和兩個專案

      首先安裝JDK+Tomcat和配置好環境變數,部署第一個專案是比較簡單,本文主要是針對部署第二個專案的時候出現的一些問題和解決辦法進行敘述。可能解決辦法有很多種,目的都是為了解決遇到的問題。我們公司一直以來採用的是Nginx+Tomcat進行專案部署。  第一個專

DP軟體中新增Windows客戶端

1.遠端新增客戶端 2. 本地安裝 本地安裝完成後再匯入     DP cell manager安裝在Linux伺服器上,打算用DP備份Windows Server 2012上檔案。就需要把Windows Server新增到DP中,用遠端安裝最方便。只

搭建深度學習工作站

一、先安裝 Windows10 系統,然後安裝 Ubuntu16.04 在用 USB 啟動安裝 Ubuntu 過程中,因為主機板安裝了兩塊顯示卡,所以 nouvau 驅動會報告 PCIe SCHED Error 8,進入不了安裝介面。 解決辦法:在GRUB啟動介面中按 e

vscode將電腦上的配置同步到另外電腦上

最近換了一臺新電腦,需要重新配置很多軟體,尤其是這個vscode,實在是不想再一點點的安裝那些外掛,所以就在網上搜一下解決方案,具體的是使用sync這個外掛,具體使用教程可以參考:參考教程,這是官方給的