1.Intalling Cuda and Caffe

%%check in terminal
watch nvidia-smi  % check  if cuda has installed already

cuda install: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
cuda and tensorflow: https://github.com/mind/wheels#mkl

# Install CUDA 8
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda-8-0

# Install CUDA 9
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda

Make sure that CUDA-related environment variables are set properly:
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
echo 'export PATH=$PATH:$CUDA_HOME/bin' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' >> ~/.bashrc
. ~/.bashrc
download  and  install cuDNN:
https://gist.github.com/mjdietzx/0ff77af5ae60622ce6ed8c4d9b419f45

sudo apt-get install python-pip  %install python package

sudo pip install numpy
sudo pip install scipy


%caffe install commands:(ubantu installation)

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev


%download cuDNN
runtime  (version)
develper (version)


%install Github in Ubantu

git clone https://github.com/BVLC/caffe.git

--remind 'git ' not exist, need install?

sudo apt install git

git clone https://github.com/BVLC/caffe.git  % download caffe package


cd caffe/      %enter caffe director
ls             %check all files list under 'caffe' directory

cd python     %enter 'python' directory( under 'caffe' directory)
ls            %check all files list under 'python' directory


gedit requirement.txt   %check what content is of  file 'requirement.txt'


%preparation before install caffe:http://caffe.berkeleyvision.org/installation.html#prerequisites

for req in $(cat requirements.txt); do sudo pip install $req; done  %dependency libs before installing python

pip install --upgrade pip   %upgrade dependencies




%%  install cuDNN

sudo dpkg -i "runtime(version)'s path name"
sudo dpkg -i "developer(version)'s path name"


二.caffe compliation
enter  'home/caffe/' directory
 copy 'Makefile.config.example'  and rename as 'Makefile.config'
due to using cuDNN, remove “#”

USE_CUDNN :=1
WITH_PYTHON_LAYER :=1


In terminal:
make all -j7   %(with 7 core ,leave 1 just in case)

%install dependencies such as 'glog' etc,.
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

%install libopenblas
sudo apt-get install libopenblas-dev


%fix hdf5 problem
%change 'Makefile.config' as:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial


Makefile
remove--- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
add+++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial


%problem cannot find -lcblas
       cannot find -latlas
solution:
  sudo apt-get install libatlas-base-dev




三.Test

make test -j7

make runtest -j7  %PASSED




make pycaffe -j7

error:fatal error: numpy/arrayobject.h:  No such file or directory
solution:sudo apt-get install python-numpy



make matcaffe -j7  % need to install mtalab first



四.using python in caffe (# Make sure that caffe is on the python path:)
caffe_root = '/home/uni/caffe/'
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe


Install Matlab:
 Firstly, use 'cd' commod enter into Matlab Directory.

 sudo chmod +777 install      %Change 'install' file into an executable one by running
 sudo ./install                         %Now run the installer

Add shortcut

1. Get an icon:
sudo wget http://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -O /usr/share/icons/matlab.png
2. Get the launcher file:

sudo wget 'https://help.ubuntu.com/community/MATLAB?action=AttachFile&do=get&target=matlab-r2012a.desktop' -O /usr/share/applications/matlab.desktop
3.rename the icon
sudo gedit /usr/share/applications/matlab.desktop


cd caffe
%change 'MATLAB_DIR' in 'Makefile.config'  := /usr/local/MATLAB/R2017a
make matcaffe -j7  % need to install mtalab.


Comments

Popular posts from this blog

github accumulation

7. compile faster-r-cnn