加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install_caffe_if_cuda8.sh 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
Gines Hidalgo 提交于 2019-01-04 19:12 . Simplified sh scripts
#!/bin/bash
echo "------------------------- Installing Caffe -------------------------"
echo "NOTE: This script assumes that CUDA and cuDNN are already installed on your machine. Otherwise, it might fail."
function exitIfError {
if [[ $? -ne 0 ]] ; then
echo ""
echo "------------------------- -------------------------"
echo "Errors detected. Exiting script. The software might have not been successfully installed."
echo "------------------------- -------------------------"
exit 1
fi
}
echo "------------------------- Checking Ubuntu Version -------------------------"
ubuntu_version="$(lsb_release -r)"
echo "Ubuntu $ubuntu_version"
if [[ $ubuntu_version == *"14."* ]]; then
ubuntu_le_14=true
elif [[ $ubuntu_version == *"16."* || $ubuntu_version == *"15."* || $ubuntu_version == *"17."* || $ubuntu_version == *"18."* ]]; then
ubuntu_le_14=false
else
echo "Ubuntu release older than version 14. This installation script might fail."
ubuntu_le_14=true
fi
exitIfError
echo "------------------------- Ubuntu Version Checked -------------------------"
echo ""
echo "------------------------- Installing some Caffe Dependencies -------------------------"
# Basic
sudo apt-get --assume-yes update
sudo apt-get --assume-yes install build-essential
# General dependencies
sudo apt-get --assume-yes install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev
# Remaining dependencies, 14.04
# if [[ $ubuntu_le_14 == true ]]; then
sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
# fi
# Python libs
sudo apt-get --assume-yes install python-setuptools python-pip python-dev build-essential
sudo apt-get install python-numpy
sudo easy_install pip
sudo -H pip install numpy protobuf
# sudo -H pip install --upgrade numpy protobuf
sudo ldconfig
# OpenCV 2.4
# sudo apt-get --assume-yes install libopencv-dev
exitIfError
echo "------------------------- Some Caffe Dependencies Installed -------------------------"
echo ""
echo "------------------------- Compiling Caffe -------------------------"
if [[ $ubuntu_le_14 == true ]]; then
cp Makefile.config.Ubuntu14_cuda8.example Makefile.config
else
cp Makefile.config.Ubuntu16_cuda8.example Makefile.config
fi
# make all -j`nproc`
make all -j`nproc` && make distribute -j`nproc`
# make test -j`nproc`
# make runtest -j`nproc`
exitIfError
echo "------------------------- Caffe Compiled -------------------------"
echo ""
echo "------------------------- Caffe Installed -------------------------"
echo ""
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化