*********
此处使用的基础镜像为 nvcr.io/nvidia/digits:18.06,镜像大小为6.04GB,可从nvidia官方pull此镜像;
容器配置:
CUDA:9.0
CUDNN:7.0
注:此文档建立在已会使用python2.7版本的DIGITS基础之上
使用CUDA9是因为要使用tensorflow_hub,版本需要兼容
tensorflow-gpu==1.12.0
tensorflow-hub==0.5.0
镜像中含有python3.5与python2.7两个版本,直接使用python3.5
修改系统python默认值,使用python3为默认启动:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
*********
一、编译安装caffe
从github下载caffe源码,准备编译,下载地址:https://github.com/BVLC/caffe.git
【CUDA与CUDNN请查找对应的安装教程,此处忽略】
进入caffe目录
1、安装依赖:
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 libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
2、修改Makefile.config文件:
sudo cp Makefile.config.example Makefile.config
根据需求修改Makefile.config中的内容,我修改之后的内容如下:
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV := 1
# USE_LEVELDB := 0
# USE_LMDB := 0
# T