Skip to content

Instantly share code, notes, and snippets.

@zealinux
Last active September 18, 2017 13:32
Show Gist options
  • Select an option

  • Save zealinux/408af5f312ee894bfd6cb503e92d2558 to your computer and use it in GitHub Desktop.

Select an option

Save zealinux/408af5f312ee894bfd6cb503e92d2558 to your computer and use it in GitHub Desktop.
在ucloud上安装caffe环境
* install caffe in Ubuntu 14.04
** install cuda & cudnn
- [[https://docs.ucloud.cn/ai/gpu/operation/ubuntu_cuda][ai_gpu_驱动安装指南_Ubuntu 14.04 环境配置-UCloud文档中心]]
** install opencv 3.2
- [[https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04][OpenCV 3.2 Installation Guide on Ubuntu 16.04 · BVLC/caffe Wiki]]
#+BEGIN_SRC bash
#ffmpg => libav-tools
sudo apt-get install --assume-yes build-essential cmake git pkg-config unzip libav-tools qtbase5-dev python-dev python3-dev python-numpy python3-numpy libopencv-dev libgtk-3-dev libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev v4l-utils python-vtk liblapacke-dev libopenblas-dev checkinstall libgdal-dev
#undefined reference to `dpotrf_'
# -D WITH_LAPACK=OFF
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D FORCE_VTK=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES" -D WITH_GDAL=ON -D WITH_XINE=ON -D BUILD_EXAMPLES=ON -D WITH_LAPACK=OFF ..
#+END_SRC
** instal caffe 1.0
- [[https://github.com/BVLC/caffe/blob/master/docker/gpu/Dockerfile][caffe/Dockerfile at master · BVLC/caffe]]
#+BEGIN_SRC bash
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
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 -DBLAS=open ..
export CAFFE_ROOT=/opt/caffe
export PYCAFFE_ROOT=$CAFFE_ROOT/python
export PATH=$CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$PATH
sudo vim /etc/ld.so.conf.d/caffe.conf
/opt/caffe/build/lib/
sudo ldconfig
make runtest
#+END_SRC
*** support python2
#+BEGIN_SRC bash
make pycaffe
echo $PYTHONPATH
/opt/caffe/python/caffe
export PYTHONPATH=/opt/caffe/python
(sudo vim /etc/profile)
# ImportError: No module named scipy
sudo apt-get install python-scipy
pip install scipy
import caffe
# (.:25040): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
sudo pip uninstall matplotlib
sudo apt-get install python-matplotlib
#+END_SRC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment