Forums - Compile snpe-sample for rb5

11 posts / 0 new
Last post
Compile snpe-sample for rb5
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-09-15 09:12

Hello,

 

I have successfully completed the tutorials here,

but when I try to run the snpe-sample application on the rb5 (it works on the host pc) I get the following Segmentation fault:



sh-4.4# export SNPE_TARGET_ARCH=aarch64-linux-gcc4.9
sh-4.4# cd /data/local/tmp/alexnet
xt --use_gpu-net-run --container bvlc_alexnet.dlc --input_list target_raw_list.tx
-------------------------------------------------------------------------------
Model String: N/A
SNPE v1.50.0.2622
-------------------------------------------------------------------------------
Processing DNN input(s):
cropped/notice_sign.raw
Processing DNN input(s):
cropped/trash_bin.raw
Processing DNN input(s):
cropped/plastic_cup.raw
Processing DNN input(s):
cropped/chairs.raw

snpepe-sample -b ITENSOR -d bvlc_alexnet.dlc -i target_raw_list.txt -o outpput_sample
Segmentation fault (core dumped)
 

It may have to do with how I compile the snpe-sample application for the rb5, which is as follows:

export SNPE_TARGET_ARCH=aarch64-linux-gcc4.9
export SNPE_TARGET_STL=libc++_shared.so
export SNPE_ROOT=snpe-1.50.0.2622
echo $SNPE_ROOT
export PATH=$PATH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH/
echo $PATH
export LD_LIBRARY_PATH=$SNPE_ROOT/lib/$SNPE_TARGET_ARCH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH
ls $SNPE_ROOT/lib/$SNPE_TARGET_ARCH
echo $LD_LIBRARY_PATH
cd $SNPE_ROOT/examples/NativeCpp/SampleCode
export CXX=aarch64-linux-gnu-g++ 
make -f Makefile.$SNPE_TARGET_ARCH

What makefile and compiler should I use for the rb5?

(currently using:

aarch64-linux-gnu-g++ 
  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-09-22 03:01

Actually, the sample application compilesadn snpe-sample -h runs correcty on the target, but fails with

Segmentation fault (core dumped)

when executing a model.

How would you execute the inceptio_V3 model for exampl with snpe-sample?

I tried:

snpe-sample -b USERBUFFER_FLOAT -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

Thanks in advance

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-09-22 03:28

I have tried the following combinations:
 

snpe-sample -r cpu -b USERBUFFER_FLOAT -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

snpe-sample -r cpu -b ITENSOR -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

snpe-sample -r dsp -b USERBUFFER_FLOAT -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

snpe-sample -r dsp -b ITENSOR -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

snpe-sample -r aip -b USERBUFFER_FLOAT -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

snpe-sample -r aip -b ITENSOR -d data/inception_v3/inception_v3.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/output

 

And I am getting the following errors saying that the dsp and aip runtimes are not present:

.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/outputtion_v3.
SNPE Version: 1.50.0.2622
Selected runtime not present. Falling back to CPU.
Segmentation fault (core dumped)
ata/inception_v3/target_raw_list.txt -o data/inception_v3/outputtion_v3.dlc -i da
SNPE Version: 1.50.0.2622
Selected runtime not present. Falling back to CPU.
Segmentation fault (core dumped)
.dlc -i data/inception_v3/target_raw_list.txt -o data/inception_v3/outputtion_v3.
SNPE Version: 1.50.0.2622
npu_get_property status: 0
npu_get_property status: 0
FW CAPS [0] = 0x2007
FW CAPS [1] = 0x80000005
FW CAPS [2] = 0x0
FW CAPS [3] = 0x0
FW CAPS [4] = 0x0
FW CAPS [5] = 0x0
FW CAPS [6] = 0x0
FW CAPS [7] = 0x0
npu_get_property status: 0
NPU User Driver: npu_read_info 0
Selected runtime not present. Falling back to CPU.
Segmentation fault (core dumped)
ata/inception_v3/target_raw_list.txt -o data/inception_v3/outputtion_v3.dlc -i da
SNPE Version: 1.50.0.2622
npu_get_property status: 0
npu_get_property status: 0
FW CAPS [0] = 0x2007
FW CAPS [1] = 0x80000005
FW CAPS [2] = 0x0
FW CAPS [3] = 0x0
FW CAPS [4] = 0x0
FW CAPS [5] = 0x0
FW CAPS [6] = 0x0
FW CAPS [7] = 0x0
npu_get_property status: 0
NPU User Driver: npu_read_info 0
Selected runtime not present. Falling back to CPU.
Segmentation fault (core dumped)

However, I used the benchmarking tool and it was able to execute models on the dsp, so what may be causing this?

 

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-09-22 06:41

Following from the above, I tried using the dlc models prepared for the dsp and aip runtimes via the

python $SNPE_ROOT/models/inception_v3/scripts/setup_inceptionv3.py -a ~/tmpdir -r dsp

and

python $SNPE_ROOT/models/inception_v3/scripts/setup_inceptionv3.py -a ~/tmpdir -r aip

commands.

And after pushing the model to the RB5 target; I ran:

snpe-net-run --use_dsp --container /dev/external/rb5/snpe/tutorials/data/inception_v3/inception_v3.dlc --input_list /dev/external/rb5/snpe/tutorials/data/inception_v3/target_raw_list.txt

and got:

The selected runtime is not available on this platform. Continue anyway to observe the failure at network creation time.
error_code=500; error_message=Target runtime is not available. error_code=500; error_message=Target runtime is not available. No viable runtimes available.; error_component=Host Runtime; line_no=392; thread_id=547987370352; error_component=Host Runtime; line_no=262; thread_id=548085469200

and ran:

snpe-net-run --use_aip --container /dev/external/rb5/snpe/tutorials/data/inception_v3/inception_v3.dlc --input_list /dev/external/rb5/snpe/tutorials/data/inception_v3/target_raw_list.txt

and got:

npu_get_property status: 0
npu_get_property status: 0
FW CAPS [0] = 0x2007
FW CAPS [1] = 0x80000005
FW CAPS [2] = 0x0
FW CAPS [3] = 0x0
FW CAPS [4] = 0x0
FW CAPS [5] = 0x0
FW CAPS [6] = 0x0
FW CAPS [7] = 0x0
npu_get_property status: 0
NPU User Driver: npu_read_info 0

The selected runtime is not available on this platform. Continue anyway to observe the failure at network creation time.

The selected runtime is not available on this platform. Continue anyway to observe the failure at network creation time.
-------------------------------------------------------------------------------
Model String: N/A
SNPE v1.50.0.2622
-------------------------------------------------------------------------------
Processing DNN input(s):
cropped/notice_sign.raw
Processing DNN input(s):
cropped/trash_bin.raw
Processing DNN input(s):
cropped/plastic_cup.raw
Processing DNN input(s):
cropped/chairs.raw
 

Why would the dsp not work on the RB5 and how could I ensure all realtimes are up and working?

Thanks,

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Thu, 2021-09-23 08:58

Hello,

I can confirm that the exact same snpe-sample approach is working for me on the

SNPE_TARGET_ARCH=x86_64-linux-clang

but not on the RB5

I get

Segmentation fault (core dumped)

with

SNPE_TARGET_ARCH=aarch64-linux-gcc4.9

for the RB5,

where I compile it as follows:

 

export SNPE_TARGET_ARCH=aarch64-linux-gcc4.9
export SNPE_TARGET_STL=libc++_shared.so
export SNPE_ROOT=/snpe-1.50.0.2622
echo $SNPE_ROOT
export PATH=$PATH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH
echo $PATH
export LD_LIBRARY_PATH=$SNPE_ROOT/lib/$SNPE_TARGET_ARCH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH:/usr/aarch64-linux-gnu/lib
ls $SNPE_ROOT/lib/$SNPE_TARGET_ARCH
echo $LD_LIBRARY_PATH
cd $SNPE_ROOT/examples/NativeCpp/SampleCode
export CXX=aarch64-linux-gnu-g++ 
make -f Makefile.$SNPE_TARGET_ARCH


PLEASE HELP ME UNDERSTAND WHY AND HOW I COULD RESOLVE THIS.

Thanks
 

 

 

  • Up0
  • Down0
mita.rathod
Join Date: 17 Sep 18
Posts: 59
Posted: Thu, 2021-09-23 13:22

hello customer,
I will check with our AI team

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Mon, 2021-10-04 03:29

Hello Mita,

That would be great. Do we have any updates from the AI team? How do they compile the app in https://developer.qualcomm.com/sites/default/files/docs/snpe/cplus_plus_... for the RB5?

Thanks in advance!

  • Up0
  • Down0
mita.rathod
Join Date: 17 Sep 18
Posts: 59
Posted: Mon, 2021-10-04 12:07

Hi Customer,

In the SNPE directory:snpe-1.51/examples/NativeCpp/SampleCode
There is a Makefile:Makefile.aarch64-ubuntu-gcc7.5
Please try this one.
even if there is issue please send us log file on [email protected]
Regards,
Mita

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Tue, 2021-10-05 07:39

Hello Mita,

Thank you very much for your answer.

If I compile snpe-sample with

export SNPE_TARGET_ARCH=aarch64-ubuntu-gcc7.5

and the following:

export SNPE_TARGET_ARCH=aarch64-ubuntu-gcc7.5
export SNPE_TARGET_STL=libc++_shared.so
export SNPE_ROOT=snpe-1.54.2.2899
echo $SNPE_ROOT
export PATH=$PATH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH
echo $PATH
export LD_LIBRARY_PATH=$SNPE_ROOT/lib/$SNPE_TARGET_ARCH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH:/usr/aarch64-linux-gnu/lib
ls $SNPE_ROOT/lib/$SNPE_TARGET_ARCH
echo $LD_LIBRARY_PATH
cd $SNPE_ROOT/examples/NativeCpp/SampleCode
export CXX=g++
make -f Makefile.$SNPE_TARGET_ARCH

I get this error:


g++ -c -std=c++11 -fPIC -march=armv8-a -I /home/inigo/dev/external/snpe-1.54.2.2899/include/zdl jni/LoadContainer.cpp -o obj/local/aarch64-ubuntu-gcc7.5/LoadContainer.o
cc1plus: error: bad value (armv8-a) for -march= switch
cc1plus: note: valid arguments to -march= switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native
make: *** [Makefile.aarch64-ubuntu-gcc7.5:39: obj/local/aarch64-ubuntu-gcc7.5/LoadContainer.o] Error 1
 

Which CXX should I export? (I currently export CXX=g++ to build for aarch64-ubuntu-gcc7.5)

Thanks for your continuous support, it is very much appreciated.

 

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-10-06 03:49

Hello,

The problem seems to be cross compiling:

If I compile with Makefile.aarch64-ubuntu-gcc7.5 on the Host computer, it fails with the error in the comment above.

If I compile with Makefile.aarch64-ubuntu-gcc7.5 on the RB5 directly, it builds as follows:

Build commands:

export SNPE_TARGET_ARCH=aarch64-ubuntu-gcc7.5
export SNPE_TARGET_STL=libc++_shared.so
export SNPE_ROOT=snpe-1.50.0.2622
echo $SNPE_ROOT
export PATH=$PATH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH
echo $PATH
export LD_LIBRARY_PATH=$SNPE_ROOT/lib/$SNPE_TARGET_ARCH:$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/$SNPE_TARGET_ARCH
echo $LD_LIBRARY_PATH
cd $SNPE_ROOT/examples/NativeCpp/SampleCode
export CXX=g++
make -f  Makefile.$SNPE_TARGET_ARCH
snpe-sample -h

Build Log:

snpe-1.50.0.2622
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:snpe-1.50.0.2622/examples/NativeCpp/SampleCode/obj/local/aarch64-ubuntu-gcc7.5
snpe-1.50.0.2622/lib/aarch64-ubuntu-gcc7.5:/home/inigo/dev/external/rb5/snpe-1.50.0.2622/examples/NativeCpp/SampleCode/obj/local/aarch64-ubuntu-gcc7.5
make: Warning: File 'Makefile.aarch64-ubuntu-gcc7.5' has modification time 5563173 s in the future
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/LoadContainer.cpp -o obj/local/aarch64-ubuntu-gcc7.5/LoadContainer.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/PreprocessInput.cpp -o obj/local/aarch64-ubuntu-gcc7.5/PreprocessInput.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/LoadInputTensor.cpp -o obj/local/aarch64-ubuntu-gcc7.5/LoadInputTensor.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/NV21Load.cpp -o obj/local/aarch64-ubuntu-gcc7.5/NV21Load.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/CheckRuntime.cpp -o obj/local/aarch64-ubuntu-gcc7.5/CheckRuntime.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/SaveOutputTensor.cpp -o obj/local/aarch64-ubuntu-gcc7.5/SaveOutputTensor.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/CreateUserBuffer.cpp -o obj/local/aarch64-ubuntu-gcc7.5/CreateUserBuffer.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/CreateGLBuffer.cpp -o obj/local/aarch64-ubuntu-gcc7.5/CreateGLBuffer.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/udlExample.cpp -o obj/local/aarch64-ubuntu-gcc7.5/udlExample.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/CreateGLContext.cpp -o obj/local/aarch64-ubuntu-gcc7.5/CreateGLContext.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/main.cpp -o obj/local/aarch64-ubuntu-gcc7.5/main.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/SetBuilderOptions.cpp -o obj/local/aarch64-ubuntu-gcc7.5/SetBuilderOptions.o
g++ -c -std=c++11 -fPIC -march=armv8-a -I snpe-1.50.0.2622/include/zdl jni/Util.cpp -o obj/local/aarch64-ubuntu-gcc7.5/Util.o
g++ -L snpe-1.50.0.2622/lib/aarch64-ubuntu-gcc7.5 obj/local/aarch64-ubuntu-gcc7.5/LoadContainer.o obj/local/aarch64-ubuntu-gcc7.5/PreprocessInput.o obj/local/aarch64-ubuntu-gcc7.5/LoadInputTensor.o obj/local/aarch64-ubuntu-gcc7.5/NV21Load.o obj/local/aarch64-ubuntu-gcc7.5/CheckRuntime.o obj/local/aarch64-ubuntu-gcc7.5/SaveOutputTensor.o obj/local/aarch64-ubuntu-gcc7.5/CreateUserBuffer.o obj/local/aarch64-ubuntu-gcc7.5/CreateGLBuffer.o obj/local/aarch64-ubuntu-gcc7.5/udlExample.o obj/local/aarch64-ubuntu-gcc7.5/CreateGLContext.o obj/local/aarch64-ubuntu-gcc7.5/main.o obj/local/aarch64-ubuntu-gcc7.5/SetBuilderOptions.o obj/local/aarch64-ubuntu-gcc7.5/Util.o -lSNPE  -o obj/local/aarch64-ubuntu-gcc7.5/snpe-sample
make: warning:  Clock skew detected.  Your build may be incomplete.

How can I cross compile and build the application on the Host PC and only transfer the binaries to the RB5?

Thank you in advance.

  • Up0
  • Down0
xuweii
Join Date: 13 Oct 21
Posts: 1
Posted: Thu, 2021-10-14 11:21
The qualcomm's documents are really useless!! I found no way to make the snpe-sample works!!!!!
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.