Community
cancel
Showing results for 
Search instead for 
Did you mean: 
akiotakahashi
Beginner
635 Views

NCS2 causes too many system interrupts on Raspberry Pi 4b

Jump to solution

With our device, Raspberry Pi 4b, NCS2 used by OpenVINO 2020.4 causes too many system interrupts.

The below is the output from `vmstat 1` on RPI4b.

  1. Initially the system is idle
  2. The estimation model (face-detection-adas-0001) is loaded onto NCS2 but executed.
  3. 'in' (interrupts) and 'cs' (context switch) increase regardless of no execution of inference.
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 3262100 88576 368564 0 0 0 36 137 130 0 0 100 0 0
0 0 0 3262100 88576 368564 0 0 0 0 207 177 0 0 100 0 0
0 0 0 3262100 88576 368564 0 0 0 0 331 269 0 0 100 0 0
0 0 0 3262100 88576 368564 0 0 0 0 206 169 0 0 100 0 0
2 0 0 3261848 88576 368564 0 0 0 0 196 184 0 0 100 0 0
2 0 0 3246912 88576 370180 0 0 0 88 1988 2510 17 10 73 0 0
0 0 0 3246392 88576 370820 0 0 0 0 981 1284 3 4 93 0 0
1 0 0 3239588 88576 370820 0 0 0 0 54451 103290 25 8 67 0 0
2 0 0 3239580 88576 370820 0 0 0 0 72749 145055 32 10 58 0 0
1 0 0 3229692 88576 370820 0 0 0 0 72598 144757 32 9 58 0 0
2 0 0 3229340 88576 371064 0 0 0 60 72824 145054 13 26 59 1 0
2 0 0 3228924 88576 371224 0 0 0 0 72402 144376 11 33 57 0 0
2 0 0 3228868 88576 371320 0 0 0 0 72583 144748 8 35 57 0 0
2 0 0 3229240 88576 371184 0 0 0 0 72535 144742 8 34 58 0 0

 

What I don't understand is that this behavior is observed on idle state after LoadNetwork. In other words, NCS2 has no work but causes too many interruprs. 

Our questions are

1) Why NCS2 causes such too many interrupts? and

2) How to fix this behavior to improve performance?

 

This behavior is observed on any devices we have (RPI4s or NCS2s) so that it's not a breakdown. And both C++ and Python can reproduce this.

Thanks

0 Kudos
1 Solution
IntelSupport
Community Manager
518 Views

Hi Akio,

 

Raspbian runtime package should now be available in 01.org. Please check at the following link:

https://download.01.org/opencv/2021/openvinotoolkit/2021.1/

 

Thank you.

 

Regards,

Adli


View solution in original post

9 Replies
IntelSupport
Community Manager
611 Views

Hi,

 

Thanks for reaching out.

I had set up a test with the same settings as stated.

 

Equipment: Raspberry Pi 4b, NCS2 and OpenVINO 2020.4

Model       : face-detection-adas-0001.xml

 

Then, I ran an Object Detection SSD sample which executes face-detection-adas-0001 model. Please refer the following link (point 4):

https://docs.openvinotoolkit.org/2020.4/openvino_docs_install_guides_installing_openvino_raspbian.ht...

 

This is the following result:

vmstat_raspberryPI_NCS2_test.png

The test do not encounter the same issue as you mentioned. If possible, could you run the same sample at the given link. Please share and post your result here.

 

Regards,

Adli

 

akiotakahashi
Beginner
606 Views

Thanks for your investigation.

I confirmed the same result you but I wonder why NCS2 interrupts after LoadNetwork.

-----

Please modify main.cpp to halt after LoadNetwork before inference.

/openvino/inference_engine/samples/cpp/object_detection_sample_ssd/main.cpp
--- /opt/intel/openvino_orig/inference_engine/samples/cpp/object_detection_sample_ssd/main.cpp  2020-06-30 20:32:50.000000000 +0900
+++ /opt/intel/openvino/inference_engine/samples/cpp/object_detection_sample_ssd/main.cpp       2020-10-08 22:44:25.414457448 +0900
@@ -23,6 +23,8 @@

 #include "object_detection_sample_ssd.h"

+#include <unistd.h>
+
 using namespace InferenceEngine;

 bool ParseAndCheckCommandLine(int argc, char *argv[]) {
@@ -210,6 +212,8 @@
         ExecutableNetwork executable_network = ie.LoadNetwork(network, FLAGS_d, configure(FLAGS_config));
         // -----------------------------------------------------------------------------------------------------

+        for(;;) { sleep(1); }
+
         // --------------------------- 8. Create infer request -------------------------------------------------
         slog::info << "Create infer request" << slog::endl;
         InferRequest infer_request = executable_network.CreateInferRequest();

 

Then re-compile it and run again. object_detection_sample_ssd halts in the middle of procedure. 

pi@raspberrypi:~/build $ ./armv7l/Release/object_detection_sample_ssd -m face-detection-adas-0001.xml -d MYRIAD -i ~/march.jpg
[ INFO ] InferenceEngine:
        API version ............ 2.1
        Build .................. 2020.4.0-359-21e092122f4-releases/2020/4
        Description ....... API
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ]     /home/pi/march.jpg
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
        MYRIAD
        myriadPlugin version ......... 2.1
        Build ........... 2020.4.0-359-21e092122f4-releases/2020/4
[ INFO ] Loading network files:
        face-detection-adas-0001.xml
        face-detection-adas-0001.bin
[ INFO ] Preparing input blobs
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the device
(HALT HERE)

 

The following is vmstat output from the start:

pi@raspberrypi:~ $ vmstat 1 20
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 3257472  31476 484012    0    0    55    34  201  316  2  1 97  0  0
 0  0      0 3257472  31476 484012    0    0     0     0  130   61  0  0 100  0  0
 0  0      0 3257464  31476 484012    0    0     0     0  179  117  0  0 100  0  0
 0  0      0 3257464  31476 484012    0    0     0     0  120   60  0  0 100  0  0
 0  0      0 3257464  31476 484012    0    0     0     0  263  192  0  0 100  0  0
 0  0      0 3257464  31476 484012    0    0     0     0  156   92  0  0 100  0  0
 0  0      0 3257464  31476 484012    0    0     0     0  112   50  0  0 100  0  0
 1  0      0 3249952  31476 484012    0    0     0     0  303  269  9  5 87  0  0
 1  0      0 3250100  31476 484016    0    0     0     0  327  368  4  4 92  0  0
 2  0      0 3244044  31476 484016    0    0     0     0 51445 90481 20  9 70  0  0
 1  0      0 3244044  31476 484016    0    0     0     4 72593 144443 32 11 56  0  0
 2  0      0 3244044  31476 484016    0    0     0     0 72622 144315 32 11 57  0  0
 2  0      0 3233720  31476 484016    0    0     0     0 73069 145548 13 11 75  0  0
 1  0      0 3233972  31484 483860    0    0     0    20 73340 146180  4 11 85  0  0
 1  0      0 3233972  31484 484016    0    0     0     0 72762 145221  3 11 86  0  0
 1  0      0 3233972  31484 484016    0    0     0    28 72885 145479  3 10 87  0  0
 1  0      0 3233972  31484 484016    0    0     0     0 72909 145538  3 10 87  0  0
 1  0      0 3233972  31484 484016    0    0     0     0 72911 145520  3 14 83  0  0
 1  0      0 3233972  31484 484016    0    0     0     0 72990 145686  4 11 85  0  0
 1  0      0 3233972  31492 484016    0    0     0    24 72991 145712  4  9 87  0  0

 

At the point object_detection_sample_ssd does nothing. In contrast, 'in' and 'cs' increase.

 

In my opinion, some interruption is reasonable for communication between NCS2 and RPI4 but such the number of interrupts can't be understood for me.

IntelSupport
Community Manager
597 Views

Hi Akio,

 

We do not recommend modifying main.cpp file.

If you modify the main.cpp code, the sample might not execute properly.

If possible, could you please explain the purpose of the changes you have made in the code.

 

Regards,

Adli


akiotakahashi
Beginner
592 Views

Hi Adli

 

The purpose of the changes for the sample is to sleep the program after LoadNetwork() before CreateInferRequest(). It's useful to clarify whether NCS2 interrupts are occurred for any inference or unintended events.

 

When the program reaches the inserted line,

for(;;) { sleep(1); }

sleep(1) stops the program 1 second and it is repeated infinitely. So we expect that system load at the moment is very low.

 

However, vmstat reports that too many interrupts occurr while the program may sleep. And system load is high (almost 50% of 1 core).

Therefore we doubt that NCS2 occurred unintended interrupts whenever it does nothing.

 

Thanks

IntelSupport
Community Manager
548 Views

Hi Akio,

 

We appreciate your interest and feedback regarding NCS2. Did you face any errors during the process of sample/demo execution or any other standard process (without modifying OpenVINO code)? We do not recommend modifying the LoadNetwork code in order to avoid unexpected behaviour.

 

Having said that, we take note of your concerns and will communicate your feedback to the relevant support team.

At the meantime, please install the latest version of OpenVINO toolkit, which is 2021.1 version. You can download the file at the following link: https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html

 

Although CPU usage is expected even when running inference on MYRIAD, there were some optimizations made in OpenVINO 2021.1 to reduce this value (approx. in 50%).

 

Regards,

Adli


akiotakahashi
Beginner
539 Views

Hi Adli

Thank you for your feedback to the relevant teams.

>Did you face any errors during the process of sample/demo execution or any other standard process (without modifying OpenVINO code)?

Our device executes a short inference every seconds for a very long time so the most part of power consumption is made for the unexpected behavior. Because we make much effort to reduce heat by the device, we consider it's a significant problem.

>You can download the file at the following link

The link you supposed has no option for Raspberry Pi 4b.

Where are there a distribution for RPI4?

 

Thanks

IntelSupport
Community Manager
519 Views

Hi Akio,

 

Raspbian runtime package should now be available in 01.org. Please check at the following link:

https://download.01.org/opencv/2021/openvinotoolkit/2021.1/

 

Thank you.

 

Regards,

Adli


View solution in original post

akiotakahashi
Beginner
511 Views

Great! It's solved on 2021.1 perfectly!

 

This log is captured while running the 'sleeping' object_detection_sample_ssd;

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 2 2977 53 546 0 0 0 0 158 157 0 0 100 0 0
0 0 2 2977 53 546 0 0 0 0 145 139 0 0 100 0 0
0 0 2 2977 53 546 0 0 0 0 153 151 0 0 100 0 0
0 0 2 2977 53 546 0 0 0 0 158 159 0 0 100 0 0

 

And I can't believe that the inference overhead is decreased amagingly.

The sample program running inference infinitely:

for(;;) { infer_request.Infer(); }

yields the log

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0      2   2976     53    546    0    0     0     0  733 1181  0  2 98  0  0
 1  0      2   2976     53    546    0    0     0     0  777 1242  0  1 98  0  0
 0  0      2   2976     53    546    0    0     0     4  740 1187  0  1 99  0  0
 0  0      2   2976     53    546    0    0     0     0  724 1162  1  1 98  0  0
 1  0      2   2976     53    546    0    0     0     0  723 1154  1  1 98  0  0
 1  0      2   2976     53    546    0    0     0     0  722 1155  0  1 99  0  0
 0  0      2   2976     53    546    0    0     0     0  740 1178  0  1 99  0  0
 0  0      2   2976     53    546    0    0     0    32  778 1234  1  1 98  0  0
 0  0      2   2976     53    546    0    0     0     4  756 1223  0  1 98  0  0
 0  0      2   2976     53    546    0    0     0     0  724 1159  0  1 99  0  0
 0  0      2   2976     53    546    0    0     0     0  727 1167  0  1 99  0  0
 0  0      2   2976     53    546    0    0     0     0  867 1327  1  1 98  0  0

indicating the running overheads is decreased very much.

 

Our problem is solved. Thank you for your kindly cooperation.

IntelSupport
Community Manager
503 Views

Hi Akio,


This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.


Regards,

Adli


Reply