This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Caffe-jacinto install error

Guru 10235 points
Part Number: AM5728


Hello, TI Experts,
 
I have a question about installing caffe-jacinto based on below guide.
github.com/.../INSTALL.md

Then I found the below error during "make runtest".  

usr@usr-VirtualBox:~/caffe-jacinto$ make runtest
.build_release/tools/caffe
F0912 16:23:17.957453 14747 common.cpp:255] Check failed: error == cudaSuccess (30 vs. 0) unknown error
*** Check failure stack trace: ***
@ 0x2ba5a7e62daa (unknown)
@ 0x2ba5a7e62ce4 (unknown)
@ 0x2ba5a7e626e6 (unknown)
@ 0x2ba5a7e65687 (unknown)
@ 0x2ba5a6863f5d caffe::Caffe::SetDevice()
@ 0x40bd63 main
@ 0x2ba5a94aef45 (unknown)
@ 0x40cd3f (unknown)
@ (nil) (unknown)
make: *** [runtest] Aborted (core dumped)


Question:
Is there same experience?
 
<Detail procedure is as belows>

1:Install ubuntu 14.04.05 LTS on VirtualBox.

2:Install Anaconda2(Python 2.7)
> sudo apt-get update
> sudo apt-get upgrade -y
download Anaconda2-5.2.0-Linux-x86_64.sh from www.anaconda.com/.../
>chmod a+x Anaconda2-5.2.0-Linux-x86_64.sh
>./Anaconda2-5.2.0-Linux-x86_64.sh
>source ~/.bashrc

3: git clone github.com/.../caffe-jacinto
> sudo apt-get install git
> git clone github.com/.../caffe-jacinto
> cd caffe-jacinto/
> git checkout caffe-0.17

4: edit Makefile.config
> cp Makefile.config.example Makefile.config
- Uncomment the line that says WITH_PYTHON_LAYER
- Uncomment the line that says USE_CUDNN

<Here is files diff>

usr@usr-VirtualBox:~/caffe-jacinto$ diff Makefile.config.example Makefile.config
6c6
< # USE_CUDNN := 1
---
> USE_CUDNN := 1
83c83
< # WITH_PYTHON_LAYER := 1
---
> WITH_PYTHON_LAYER := 1

5: Install all the pre-requisites
> 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
> sudo apt-get install libturbojpeg

6:Install CUDA8
download ***.deb from developer.nvidia.com/cuda-80-ga2-download-archive
> sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
> sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-cublas-performance-update_8.0.61-1_amd64.deb
> sudo apt-get update
> sudo apt install cuda-8-0
> echo -e "\n## CUDA and cuDNN paths" >> ~/.bashrc
> echo 'export PATH=/usr/local/cuda-8.0/bin:${PATH}' >> ~/.bashrc
> echo 'export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}' >> ~/.bashrc
> source ~/.bashrc

7:Install CUDNN
download ***.deb from developer.nvidia.com/.../cudnn-archive
> sudo dpkg -i libcudnn6_6.0.21-1+cuda8.0_amd64.deb
> sudo dpkg -i libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb
> sudo dpkg -i libcudnn6-doc_6.0.21-1+cuda8.0_amd64.deb

8: Make caffe-jacinto
> for req in $(cat ~/caffe-jacinto/python/requirements.txt); do pip install $req; done
> pip install --upgrade pip
> sudo apt-get install libatlas-base-dev
> sudo apt-get install libopenblas-dev
> ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0.0.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so

> make all

     RESULT-> Success (No error)

   > make test

     RESULT-> Success (No error)

   > make runtest

     RESULT-> Aborted (core dumped)

If there is some clue to solve the problem, please tell us.
 
Best regards,

  • matusan,

    Our expert in this area is unavailable for a couple of days. We will get back to you as soon as we can. The response may not be until early next week.

    Sorry for any inconvenience.
  • Hello,

    Thank you for your prompt reply.
    I really appreciate your help.

    I understand the situation.
    I'm waiting for the answer.

    Best regards,
  • Hi Matusan,

    Sorry for the delayed response. I am attaching document on installing Caffe on your PC. Please see if this helps.

    0825.Caffe Install Directions.docx

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/7853.install_2D00_OpenCV.sh

    Regards,

    Manisha

  • Hi, Manisha

    Thank you very much for your detail explanation.
    I really appreciate your help.
    I would like to try this procedure in your document.

    Best regards,
  • Hi, Manisha

     

    Thank you very much for your detail explanation.

    I really appreciate your help.

     

    I tried to install caffe-jacinto based on your guide.

    Unfortunately, I found ERROR like below in "make test".

     

    usr@usr-ThinkPad-T520:~/caffe/caffe-jacinto$ make test

    CXX src/caffe/test/test_net.cpp

    CXX src/caffe/test/test_maxpool_dropout_layers.cpp

    CXX src/caffe/test/test_infogain_loss_layer.cpp

    CXX src/caffe/test/test_image_data_layer.cpp

    CXX src/caffe/test/test_reduction_layer.cpp

    CXX src/caffe/test/test_convolution_layer.cpp

    CXX src/caffe/test/test_solver.cpp

    CXX src/caffe/test/test_filter_layer.cpp

    CXX src/caffe/test/test_neuron_layer.cpp

    CXX src/caffe/test/test_multinomial_logistic_loss_layer.cpp

    CXX src/caffe/test/test_power_layer.cpp

    CXX src/caffe/test/test_random_number_generator.cpp

    CXX src/caffe/test/test_memory_data_layer.cpp

    CXX src/caffe/test/test_detectnet_transform.cpp

    CXX src/caffe/test/test_tile_layer.cpp

    CXX src/caffe/test/test_pooling_layer.cpp

    CXX src/caffe/test/test_inner_product_layer.cpp

    CXX src/caffe/test/test_db.cpp

    In file included from src/caffe/test/test_db.cpp:5:0:
    src/caffe/test/test_db.cpp: In member function ‘virtual void caffe::DBTest_TestSeekToFirst_Test<gtest_TypeParam_>::TestBody()’:
    src/caffe/test/test_db.cpp:89:35: error: no matching function for call to ‘caffe::db::Cursor::parse(caffe::Datum*)’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    ./src/gtest/gtest.h:7859:34: note: in definition of macro ‘GTEST_TEST_BOOLEAN_’
    ::testing::AssertionResult(expression)) \
    ^~~~~~~~~~
    src/caffe/test/test_db.cpp:89:3: note: in expansion of macro ‘EXPECT_TRUE’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    In file included from src/caffe/test/test_db.cpp:9:0:
    ./include/caffe/util/db.hpp:23:16: note: candidate: virtual bool caffe::db::Cursor::parse(void*, caffe::DatumTypeInfo) const
    virtual bool parse(void* datum, DatumTypeInfo datum_type_info) const = 0;
    ^~~~~
    ./include/caffe/util/db.hpp:23:16: note: candidate expects 2 arguments, 1 provided
    In file included from src/caffe/test/test_db.cpp:5:0:
    src/caffe/test/test_db.cpp: In member function ‘virtual void caffe::DBTest_TestKeyValue_Test<gtest_TypeParam_>::TestBody()’:
    src/caffe/test/test_db.cpp:103:35: error: no matching function for call to ‘caffe::db::Cursor::parse(caffe::Datum*)’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    ./src/gtest/gtest.h:7859:34: note: in definition of macro ‘GTEST_TEST_BOOLEAN_’
    ::testing::AssertionResult(expression)) \
    ^~~~~~~~~~
    src/caffe/test/test_db.cpp:103:3: note: in expansion of macro ‘EXPECT_TRUE’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    In file included from src/caffe/test/test_db.cpp:9:0:
    ./include/caffe/util/db.hpp:23:16: note: candidate: virtual bool caffe::db::Cursor::parse(void*, caffe::DatumTypeInfo) const
    virtual bool parse(void* datum, DatumTypeInfo datum_type_info) const = 0;
    ^~~~~
    ./include/caffe/util/db.hpp:23:16: note: candidate expects 2 arguments, 1 provided
    In file included from src/caffe/test/test_db.cpp:5:0:
    src/caffe/test/test_db.cpp:111:35: error: no matching function for call to ‘caffe::db::Cursor::parse(caffe::Datum*)’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    ./src/gtest/gtest.h:7859:34: note: in definition of macro ‘GTEST_TEST_BOOLEAN_’
    ::testing::AssertionResult(expression)) \
    ^~~~~~~~~~
    src/caffe/test/test_db.cpp:111:3: note: in expansion of macro ‘EXPECT_TRUE’
    EXPECT_TRUE(cursor->parse(&datum));
    ^
    In file included from src/caffe/test/test_db.cpp:9:0:
    ./include/caffe/util/db.hpp:23:16: note: candidate: virtual bool caffe::db::Cursor::parse(void*, caffe::DatumTypeInfo) const
    virtual bool parse(void* datum, DatumTypeInfo datum_type_info) const = 0;
    ^~~~~
    ./include/caffe/util/db.hpp:23:16: note: candidate expects 2 arguments, 1 provided
    Makefile:611: recipe for target '.build_release/src/caffe/test/test_db.o' failed
    make: *** [.build_release/src/caffe/test/test_db.o] Error 1

     

    Question:

    Do you have same experience?

     

    Detail procedure is as follows;

    1:Prepare clean install of Ubuntu 18.04 Linux-PC.

       - I use ubuntu-18.04.1-desktop-amd64.iso

     

    2:Install opencv by using ./installOpenCV.sh from you. (no edit!)

       $ ./installOpenCV.sh

         (stay line:OPENCV_VERSION='3.3.1')

     

    3:I found OpenCV built correctly with below commands.

       $ python

       $ import cv2

     

    4:Install Miscellaneous Dependencies

    $ sudo apt-get install -y --no-install-recommends libboost-all-dev

    $ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

    $ sudo apt-get install libopenblas-dev liblapack-dev gfortran

     

    5:Clone caffe-jacinto repository

    $ mkdir ~/caffe

    $ cd ~/caffe

    $ git clone https://github.com/tidsp/caffe-jacinto.git

    $ cd caffe-jacinto

    $ git checkout caffe-0.16

     

    6:Modify caffe’s Makefile.config

    $cp Makefile.config.example Makefile.config

    Uncomment

    CPU_ONLY := 1

    OPENCV_VERSION := 3

    WITH_PYTHON_LAYER := 1

     

    7:Fix line 214 in Makefile:

    LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_videoio

     

    8:Install Necessary Python packages

    $pip install --user scikit-image protobuf

    $ cd python

    $ for req in $(cat requirements.txt); do pip install --user $req; done

     

    9: build

    $ cd ../

    $ make all -j4

    $ make test

     

    I found ERROR like below;

    >src/caffe/test/test_db.cpp:89:35: error: no matching function for call to ‘caffe::db::Cursor::parse(caffe::Datum*)’

    >   EXPECT_TRUE(cursor->parse(&datum));

     

    10:After that I try to install caffe (git clone https://github.com/BVLC/caffe.git)

    -> The result is SUCCESS. (make all & make test & make runtest & make pycaffe)

    And I can run imagenet sample (such as ./caffe/python/classify.py)

     

    So your guide procedure seems to be correct.

    Do you have any idea about some caffe-jacinto(caffe-0.16) specific matter?

     

    We would appreciate if you consider to check the "make test" again.

    If you find any clue for the problem, please tell us.

     

    Best regards,

  • Hi Matusan,

    I didn't face this issue at my end. You must be missing some dependencies.

    Same issue was posted here and looks like the dependency was with OpenCV module
    github.com/.../6413
  • Hi, Manisha

     

    Thank you very much for your kindness.

    I really appreciate your help.

     

    We also investigate the procedure on each line like below detail for long time.

    But those error still exist.

     

    We would like to share the detail procedure from clean install of Ubuntu 18.04 for the community.

    If you find difference on your clean install procedure, please tell us.

     

    We would also appreciate if you answer/comment our questions written below detail.

    <Detail> 

    Caffe-jacinto build tested on clean install of Ubuntu 18.04 and python 2.7

    - Create Linux-PC by using "ubuntu-18.04.1-desktop-amd64.iso"

    - check python 2.7

     

    Q1: Do you use "ubuntu-18.04.1-desktop-amd64.iso" for create clean install of Linux-PC(Ubuntu 18.04)?

     

    $>sudo apt-get update

    $>sudo apt-get install python

    $>python --version

       Python 2.7.15rc1

     

    Q2:We install python 2.7 by "sudo apt-get install python" only.

         Do you use same command? Is it enough?

     

    Assumptions:

    git is installed and functioning

    Python 2.7 is installed

     

    $>sudo apt-get install git

     

    Execute command each line in ./installOpenCV.sh

    $>OPENCV_VERSION='3.3.1'

     

    # 1. KEEP UBUNTU OR DEBIAN UP TO DATE

    $>sudo apt-get -y update

    $>sudo apt-get -y upgrade

    $>sudo apt-get -y dist-upgrade

    $>sudo apt-get -y autoremove

     

    # 2. INSTALL THE DEPENDENCIES

    $>sudo apt-get install -y build-essential cmake

    $>sudo apt-get install -y qt5-default libvtk6-dev

     

    $>sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev

    E: Unable to locate package libjasper-dev

     

    Q3: We found Error like above.

           Do you see the same Error?

     

    Then we changed this command like below for fixing this problem.

    sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev

    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" ;

    sudo apt update ;

    sudo apt install libjasper-dev

    (refer: https://stackoverflow.com/questions/43484357/opencv-in-ubuntu-17-04/44488374#44488374)

     

    $>sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev

    $>sudo apt-get install -y libtbb-dev libeigen3-dev

    $>sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy

    $>sudo apt-get install -y ant default-jdk

    $>sudo apt-get install -y doxygen

     

    # 3. INSTALL THE LIBRARY

    sudo apt-get install -y unzip wget

    wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip

    unzip ${OPENCV_VERSION}.zip

    rm ${OPENCV_VERSION}.zip

    mv opencv-${OPENCV_VERSION} OpenCV

    cd OpenCV

    mkdir build

    cd build

    cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..

    make -j4

     

    $>python

    Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)

    [GCC 7.3.0] on linux2

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import cv2

    >>> cv2.__version__

    '3.3.1'

    >>>

     

    Install Miscellaneous Dependencies

    >$ sudo apt-get install -y --no-install-recommends libboost-all-dev

    >$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

    >$ sudo apt-get install libopenblas-dev liblapack-dev gfortran

     

    Clone caffe-jacinto repository

    >$mkdir ~/caffe

    >$cd ~/caffe

    >$git clone https://github.com/tidsp/caffe-jacinto.git

    >$cd caffe-jacinto

    >$ git checkout caffe-0.16

     

    Modify caffe’s Makefile.config

    >$cp Makefile.config.example Makefile.config

    Uncomment

      CPU_ONLY := 1

      OPENCV_VERSION := 3

      WITH_PYTHON_LAYER := 1

     

    Fix line 214 in Makefile:

    LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_videoio

     

    >$sudo apt install python-pip

    >$ pip install --user scikit-image protobuf

    >$ cd python

    >$ for req in $(cat requirements.txt); do pip install --user $req; done

     

    >$cd ../

    >$make all -j4

     

    Q4: We found Error like below.

           Do you see the same Error?

     

    ./include/caffe/type.hpp:5:10: fatal error: caffe/proto/caffe.pb.h: No such file or directory

    #include "caffe/proto/caffe.pb.h"

             ^~~~~~~~~~~~~~~~~~~~~~~~

    compilation terminated.

    Makefile:611: recipe for target '.build_release/src/caffe/type.o' failed

    make: *** [.build_release/src/caffe/type.o] Error 1

    make: *** Waiting for unfinished jobs....

     

    We add below procedure for fixing this problem.

    (refer: https://github.com/muupan/dqn-in-the-caffe/issues/3 )

     

    >$ protoc src/caffe/proto/caffe.proto --cpp_out=.

    >$ mkdir include/caffe/proto

    >$ mv src/caffe/proto/caffe.pb.h include/caffe/proto

    >$ make all -j4

     

    >$make test

    ...

    In file included from src/caffe/test/test_db.cpp:5:0:

    src/caffe/test/test_db.cpp: In member function ‘virtual void caffe::DBTest_TestSeekToFirst_Test<gtest_TypeParam_>::TestBody()’:

    src/caffe/test/test_db.cpp:89:35: error: no matching function for call to ‘caffe::db::Cursor::parse(caffe::Datum*)’

       EXPECT_TRUE(cursor->parse(&datum));

     

    Q5: We STILL found Error like above.

         We decided to edit the test_db.cpp file to proceed the make test.

         ( refer from https://github.com/BVLC/caffe/blob/master/src/caffe/test/test_db.cpp )

         Are there any problem?

    --

    >$ gedit ./caffe-jacinto/src/caffe/test/test_db.cpp

    replace text like below

      EXPECT_TRUE(cursor->parse(&datum));

      -> datum.ParseFromString(cursor->value());

     

    >$make test

    We found success without Error in "make test".

    >$make runtest

     

    Q6: We found Error like below in "make runtest".

         Are there any problem?

     

    [==========] 1112 tests from 162 test cases ran. (50793 ms total)

    [ PASSED ] 1110 tests.

    [ FAILED ] 2 tests, listed below:

    [ FAILED ] LayerFactoryTest/0.TestCreateLayer, where TypeParam = caffe::CPUDevice<float>

    [ FAILED ] LayerFactoryTest/1.TestCreateLayer, where TypeParam = caffe::CPUDevice<double>

     

    2 FAILED TESTS

    Makefile:561: recipe for target 'runtest' failed

    make: *** [runtest] Error 1

     

    We ignored those two Errors at that time.

    >make pycaffe

     

    >$ gedit ~/.bashrc

       export CAFFE_ROOT = <path-to-caffe-root>

       export PYTHONPATH = $CAFFE_ROOT/python:$PYTHONPATH

    >$ source ~/.bashrc

    > $ python

    >> import caffe

     

    We finally found the "import caffe" without Error.

    Then we success to run "mnist" sample like below command.

    ./data/mnist/get_mnist.sh

    ./examples/mnist/create_mnist.sh

    ./examples/mnist/train_lenet.sh

     

    Best regards,

    --