vectr-ucla / direct_lidar_inertial_odometry

[IEEE ICRA'23] A new lightweight LiDAR-inertial odometry algorithm with a novel coarse-to-fine approach in constructing continuous-time trajectories for precise motion correction.
MIT License
521 stars 101 forks source link

CPU load #18

Open aronasefaw opened 11 months ago

aronasefaw commented 11 months ago

Hello,

First of all thanks for a great paper and code, very easy to use and produced great results! I just wondered where I can set it to use a constant number of cpu cores? When downsampling the pointcloud I of course got lower computation time but the number of cpu cores used and cpu load also decreased, to further decrease computation time I would like to increase the number of cpu cores used. I tried changing the num_threads variable but that didn't change anything in the debug output, any idea of where I could change this or if this even is an option?

kennyjchen commented 11 months ago

Hi @aronasefaw -- the debug output just shows your CPU specs (total number of cores), and not the number of cores being used by DLIO. Changing the num_threads variable should do the trick, and you can verify this by checking htop.

aronasefaw commented 11 months ago

Hey @kennyjchen -- with debug output i meant this screen, the value "Cores Utilized". There you can see the number of cores being used by DLIO right? And thats the value thats not increasing when increasing the num_threads variable, as well as the computation time not decreasing.

Screen Shot 2023-08-04 at 15 35 14
kennyjchen commented 11 months ago

Ah gotcha -- do you have OpenMP installed? If the system can't find it, it will default to one core. If not, try sudo apt install libomp-dev.

aronasefaw commented 11 months ago

Yes OpenMP is installed so it doesn't default to one core, at minimum computation time without a big loss in accuracy (~25ms with a AGX Xavier) we got 0.8 cores utilised at 10% CPU Load which is what I would like to increase to at least 3 cores utilised to further decrease computation time

aronasefaw commented 9 months ago

Ping on this issue again @kennyjchen, would really need this to make the package feasible for us in real time applications

kennyjchen commented 9 months ago

I'll have to look a little more in depth for this, but the way DLIO currently calculates Cores Utilized is by multiplying CPU usages by the number of cores allotted. So it may be that all cores are engaged but the resources required per core is low, so the number is smaller than the total number of cores. There's probably a better (more intuitive) way to provide this information. From my understanding, if you properly set the number of threads for OpenMP, then it should be engaging all of them regardless of what it says in the terminal output.