tyokota.lab

適当に綴ります

PC setting ubuntu 16.04 ROS kinetic

PCのセッティング備忘録

環境:ubuntu 16.04, ROS kinetic, cuda 8.0, GPU TITAN X(Pascal)

ubuntuを入れたところから始めます

■ cuda 8.0のインストール
CUDA Toolkit | NVIDIA Developer

自分の環境に合うものをダウンロードしてインストールします

sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
vim ~/.bashrc

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

sudo reboot

※cudaを入れる場合はsecure bootはオフにしておきます.BIOSの設定にあると思います

■ ROS kineticのインストール
ROSwiki参照
kinetic/Installation/Ubuntu - ROS Wiki

■ catkin_makeのalias
.bashrcをvimで開いて

function cmk(){
    currentpath=$(pwd)
    cd ~/ros_catkin_ws
    catkin_make
    cd $currentpath
}

■ Deep Learning関連(chainer, caffe, tensolflow)のインストール
・cuDNN(v5.0)
NVIDIA cuDNN | NVIDIA Developer

tar -zxf cudnn-8.0-linux-x64-v5.0-ga.tgz
cd cuda
sudo cp lib64/libcudnn* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
sudo apt-get update

・chainer
Chainer: A flexible framework for neural networks

sudo apt-get install -y python-pip
sudo pip install --upgrade pip
sudo pip install chainer

・caffe
GitHub - BVLC/caffe: Caffe: a fast open framework for deep learning.

sudo apt-get install -y build-essential cmake git pkg-config
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install -y libatlas-base-dev 
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
cp Makefile.config.example Makefile.config

OPENCV_VERSION := 3
PYTHON_INCLUDE := /usr/include/python2.7 /usr/lib/python2.7/dist-packages/numpy/core/include
WITH_PYTHON_LAYER := 1
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.(version) libhdf5.so
sudo ln -s libhdf5_serial_hl.so.(version) libhdf5_hl.so
cd python
for req in $(cat requirements.txt); do sudo pip install $req; done
vim ~/.bashrc

export PYTHONPATH=(caffe内のpythonがあるディレクトリ):$PYTHONPATH

cd .. (caffe master dir)
make all -j8
make test
make runtest
make pycaffe
make distribute

・tensorflow
Download and Setup  |  TensorFlow

export TF_BINARY_URL=(select the correct binary to install)
sudo pip install --upgrade $TF_BINARY_URL

■ PCL-1.8
GitHub - PointCloudLibrary/pcl: Point Cloud Library (PCL)

sudo apt-get install cmake-curses-gui
cd pcl
mkdir release
cd release
ccmake ..

with_cuda=ON

cmake .
make -j8
make
make install

■ OpenCV3.2
GitHub - opencv/opencv: Open Source Computer Vision Library

sudo apt-get install cmake-curses-gui
cd opencv
mkdir release
cd release
ccmake ..

with_cuda=ON

cmake .
make -j8
make
make install