
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2024-03-15 17:39:30
CUDA has been installed. For the CUDA installation guide, see Install CUDA.
cuDNN and NCCL have been installed. For the cuDNN and NCCL installation guide, see Install cuDNN and NCCL.
Install the dependency libraries by executing the following commands:
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev libatlas-base-dev git –y
sudo apt-get install --no-install-recommends libboost-all-dev -yDownload the proper Caffe version from GitHub by accessing https://github.com/NVIDIA/caffe/releases. Select Source code (tar.gz) or using the following command:
wget https://github.com/NVIDIA/caffe/archive/v0.16.6.tar.gzDownload and install OpenBLAS.
wget https://github.com/xianyi/OpenBLAS/archive/v0.2.20.tar.gz
tar -xvf v0.2.20.tar.gz
cd OpenBLAS-0.2.20
make PRFIX=/opt/OpenBLAS
make installSet the lib paths and make the libraries take effect.
echo “/opt/OpenBLAS/lib/
/usr/local/cuda/lib64“ >> /etc/ld.so.conf.d/cuda.conf
ldconfig
ldconfig –vDecompress the Caffe installation package and save the files to the /home directory.
tar -xvf v0.16.6.tar.gz
cd caffe-0.16.6
cp Makefile.config.example Makefile.configEdit the Makefile.config file as follows:
vi Makefile.configDelete the comment sign (#) before USE_NCCL := 1 , USE_CUDNN := 1 to make the settings take effect.
Note:
The USE_CUDNN := 1 setting enables cuDNN acceleration.
The USE_NCCL := 1 setting enables NCCL so Caffe can run on multiple GPUs.
Save and close the file.
Compile Caffe.
make -all –j4 After the editor is opened, add the bin path as follows:
vi /etc/profile
export PATH=$PATH:/home/ caffe-0.16.6/build/toolsSave and close the profile. Execute the following command to make the profile take effect:
source /etc/profileInstall the previously mentioned dependency libraries based on the manifest defined in the requirements.txt file, which resides in the python folder in the Caffe root directory. To view the content of the requirements.txt file, execute the following commands:
cd caffe-0.16.6/python
cat requirements.txtThe following information is displayed:
cython>=0.19.2
numpy>=1.7.1,<=1.11.0
scipy>=0.13.2
scikit-image>=0.9.3
matplotlib>=1.3.1
ipython>=3.0.0,<=5.4.1
h5py>=2.2.0
leveldb>=0.191
networkx>=1.8.1
nose>=1.3.0
pandas>=0.12.0
protobuf>=2.5.0
pydot2
python-dateutil>=1.4,<2
python-gflags>=2.0
pyyaml>=3.10
Pillow>=2.3.0
six>=1.1.0Execute the installation code:
for seq in $(cat requirements.txt )
do
pip install $seq
doneAfter the installation is completed, execute the following commands:
cd .. ---- Return from the python directory to the Caffe root directory
sudo pip install -r python/requirements.txtFor items that have been successfully installed, the Requirement already satisfied message is displayed. The items that have not been successfully installed will be reinstalled.
Compile the python interface.
make pycaffeOpen /etc/profile and add a path as follows:
vi /etc/profile
export PYTHONPATH=/home/ caffe-0.16.6/python:$PYTHONPATHSave and close the profile. Execute the following command to make the profile take effect:
source /etc/profileUse Python code to test pycaffe. If the configuration is completed, the following command lines can be executed successfully:
import caffe
from caffe import layers as L
from caffe import params as PPure Mode