Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D435 High CPU Usage #1130

Closed
cynosure4sure opened this issue Feb 6, 2018 · 11 comments
Closed

D435 High CPU Usage #1130

cynosure4sure opened this issue Feb 6, 2018 · 11 comments

Comments

@cynosure4sure
Copy link

cynosure4sure commented Feb 6, 2018

Required Info
Camera Model D435
Firmware Version 05.08.15.00
Operating System & Version Linux (Ubuntu 14.04
Kernel Version (Linux Only) 4.4.0.111
Platform PC
SDK Version LibRealSense v2.9.1

Issue Description

I am using D435 camera in Ubuntu 14.04 with ROS.
For only Color Camera and Depth Camera enabled I get a high CPU usage on my i7-6700HQ laptop consistently 50% across all threads. Please see the image below for only Color and Depth Camera running with pointcloud disabled.
It seems very unusual as compared to using ZR300 module.

screenshot from 2018-02-05 18 34 16

@fgzhu
Copy link

fgzhu commented Feb 7, 2018

turn of OpenMP default will solve this problem

@cynosure4sure
Copy link
Author

Can you share your CPU usage after turning off OpenMP?

@fgzhu
Copy link

fgzhu commented Feb 7, 2018

less than 5% if just grab frame without showing

@cynosure4sure
Copy link
Author

@fgzhu Thank you for sharing your CPU usage.
After compiling with OpenMP=OFF and only grabbing color and depth frames without visualization, I am still seeing CPU usage of 50-60% on one thread as shown below. Are there any other options that you turned off and can you please let me know the specs of your system. Thank you.
without_openmp

@zivsha
Copy link
Contributor

zivsha commented Feb 8, 2018

@cynosure4sure do you use a pre-compiled version of librealsense? or are you building both the wrapper and the library?

@cynosure4sure
Copy link
Author

cynosure4sure commented Feb 9, 2018

@zivsha I am building both librealsense and ros wrapper from source.
Now my CPU usage is below 10% on single thread.
I compiled librealsense with the following flags:
cmake ../ -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF -DBUILD_WITH_OPENMP=OFF -DBUILD_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DENABLE_ZERO_COPY=ON -DFORCE_LIBUVC=OFF

and the ROS wrapper -DBUILD_WITH_OPENMP=OFF

I also have turned off the depth/color alignment. So now I am happy with the reasonable CPU usage. If you have any other advice for further improvement that would be helpful.

One more thing, if I turn on depth/color image alignment my CPU usage still jumps to 50% single thread.

@mfe7
Copy link

mfe7 commented Mar 8, 2018

I also followed this suggestion to disable OpenMP, and I see the CPU usage is very low when just grabbing frames without visualizing (<5% of a core). When I also enable pointcloud computation, the CPU usage hardly changes. As soon as I start visualizing the pointcloud, the CPU usage rises to >100%. That is not surprising, because I assume visualization is intensive.

The strange thing is that when I do rostopic hz <pointcloud_topic>, the CPU usage reaches >100% as well. So, it seems like the realsense node doesn't do much until something subscribes to one of its topics, and then uses a lot of CPU.

Is that expected behavior? Or is there something I am doing incorrectly?

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
hi @mfe7,

we have some new implementation for better CPU utilization, can you please help to confirm if latest v2.14.0 release still have this issue?
thanks.

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
hi @mfe7,

is it works for you?

@mfe7
Copy link

mfe7 commented Apr 18, 2019

@RealSense-Customer-Engineering no, my issue is not resolved.

I just installed the latest firmware on the D435 (5.11.1), got the latest Debian librealsense pkgs, and compiled the latest realsense_ros version.

Here's my htop when running roslaunch realsense2_camera rs_camera.launch filters:=pointcloud, and nothing is subscribing to the topics (10% of a CPU):
image

When I do rostopic echo on the /camera/color/image_raw and /camera/depth/color/points topics (41% of a CPU):
image

When I view those two topics in RViz (113% of a CPU):
image

@mfe7
Copy link

mfe7 commented Apr 18, 2019

I just tested the same camera on a different computer (the above comment refers to a laptop Gigabyte Aero 15", this comment uses a desktop), with the same installation setup (debian librealsense, built latest realsense ros pkg).

The CPU usage is much more reasonable on the desktop, with the ROS nodelet manager capping out at <50%CPU when viewing the pointcloud in RViz. When I use a 424x240 depth and color stream, it is consistently <30%CPU.

It might be an issue specific to the laptop I have been using, but it is a reasonably powerful gaming laptop so that is surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants