Update installation.md
[platform/upstream/caffeonacl.git] / acl_openailab / installation.md
1 # 1. User Quick Guide
2 [![License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)
3
4 This Installation will help you get started to setup CaffeOnACL on RK3399 quickly.
5
6 # 2. Preparation
7 ## 2.1 General dependencies installation
8         sudo apt-get -y update
9         sodo apt-get -y upgrade
10         sudo apt-get install -y build-essential pkg-config automake autoconf protobuf-compiler cmake cmake-gui
11         sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev
12         sudo apt-get install -y libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev libopenblas-dev
13         sudo apt-get install -y libopencv-dev python-dev
14         sudo apt-get install -y python-numpy python-scipy python-yaml python-six python-pip
15         sudo apt-get install -y scons git
16         sudo apt-get install -y --no-install-recommends libboost-all-dev
17         pip install --upgrade pip
18
19 ## 2.2 Download source code
20
21         cd ~
22
23 #### Download "ACL" (arm_compute :[v17.09](https://github.com/ARM-software/ComputeLibrary/tree/8938bd3f40ea62ff56d6ed4e2db0a8aee34dd64a)):
24         git clone https://github.com/ARM-software/ComputeLibrary.git
25 #### Download "CaffeOnACL" :
26         git clone https://github.com/OAID/CaffeOnACL.git
27 #### Download "Googletest" :
28         git clone https://github.com/google/googletest.git
29
30 # 3. Build CaffeOnACL
31 ## 3.1 Build ACL :
32         cd ~/ComputeLibrary
33     aarch64-linux-gnu-gcc opencl-1.2-stubs/opencl_stubs.c -Iinclude -shared -o build/libOpenCL.so
34         scons Werror=1 -j8 debug=0 asserts=1 neon=1 opencl=1 embed_kernels=1 os=linux arch=arm64-v8a
35
36 ## 3.2 Build Caffe :
37         export ACL_ROOT=~/ComputeLibrary
38         cd ~/CaffeOnACL
39         cp Makefile.config.acl Makefile.config
40         make all distribute
41
42 ## 3.3 Build Unit tests
43 ##### Build the gtest libraries
44         cd ~/googletest
45         cmake CMakeLists.txt
46         make
47         sudo make install
48
49 ##### Build Caffe Unit tests
50         export CAFFE_ROOT=~/CaffeOnACL
51         cd ~/CaffeOnACL/unit_tests
52         make clean
53         make
54
55 ## 3.4 To Configure The Libraries
56
57         sudo cp ~/ComputeLibrary/build/libarm_compute.so /usr/lib 
58         sudo cp ~/CaffeOnACL/distribute/lib/libcaffe.so  /usr/lib
59
60 # 4. Run tests
61
62 #### 4.1 Run Caffenet
63         cd  ~/CaffeOnACL/data/ilsvrc12
64         sudo chmod +x get_ilsvrc_aux.sh
65         ./get_ilsvrc_aux.sh
66         cd ../..
67         ./scripts/download_model_binary.py ./models/bvlc_reference_caffenet
68         ./distribute/bin/classification.bin models/bvlc_reference_caffenet/deploy.prototxt models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel data/ilsvrc12/imagenet_mean.binaryproto data/ilsvrc12/synset_words.txt examples/images/cat.jpg
69         output message --
70           ---------- Prediction for examples/images/cat.jpg ----------
71           0.3094 - "n02124075 Egyptian cat"
72           0.1761 - "n02123159 tiger cat"
73           0.1221 - "n02123045 tabby, tabby cat"
74           0.1132 - "n02119022 red fox, Vulpes vulpes"
75           0.0421 - "n02085620 Chihuahua"
76
77 #### 4.2 Run Unit test
78           cd ~/CaffeOnACL/unit_tests
79           ./test_caffe_main
80           output message:
81             [==========] 29 tests from 6 test cases ran. (1236 ms total) [ PASSED ] 29 tests.