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

My build using excess RAM? #68

Closed
hasankiyani007 opened this issue Feb 4, 2025 · 18 comments
Closed

My build using excess RAM? #68

hasankiyani007 opened this issue Feb 4, 2025 · 18 comments

Comments

@hasankiyani007
Copy link

hasankiyani007 commented Feb 4, 2025

I have 64 GB RAM installed. On the HIT Graffiti Wall Sequence, which is of 8 minutes, out of 64 gb, around 40-45 GB RAM is consumed during this mapping process. Is there any way to optimize RAM Usage, or to offload the currently built map onto the storage drive, so that we can free up RAM and continue mapping for an extended amount of time, if we were to be providing data in real time to the framework, instead of just recording a rosbag?
I see you guys used an onboard pc on the drone in one of your videos, what model was it? How did you manage the mapping there with limited RAM and GPU power?

Image

Furthermore, another issue, which may be slightly irrelevant in regards to FAST-LIVO2, is that on a pc with integrated graphics graphics but enough RAM, the Rviz Visualization window complete freezes up. To my knowledge, the Rviz panels are GPU-intensive tasks, which display and load the map in the viewer. Is there any generic way to optimize this or to make this viewer more efficient?

Finally, is there any guide if available for knowing what all the settings in the config file, the avia.yaml file? Some parameters are given in FASTLIVO1, but what about the others? Some help here would be appreciated as well.
Thanks in advance for your help in all these issues, and great work by the way! Thank you for making this open source.

@xuankuzcr
Copy link
Member

xuankuzcr commented Feb 4, 2025

I used the default parameters and all the raw points, and it only consumed 3.7GB of memory. I hope the "40-45 GB RAM" you mentioned is not a deliberate exaggeration. Thanks for your interest and attention.
Image

@hasankiyani007
Copy link
Author

Image

Not at all a deliberate exaggeration sir. This is the RAM Usage as you can see in the picture above at this point, at around 250 seconds into the grafitti wall sequence. At this point, its consumed 25 gb of ram, but stopped there due to a random segmentation fault and the process died. My last run which completed the entire bag file of 487 seconds, consumed around 40 GBs of RAM. I haven't changed any settings at all.

@hasankiyani007
Copy link
Author

hasankiyani007 commented Feb 4, 2025

Image

Here is another screenshot with the complete sequence being mapped. The mapping process consumed 40.1 GBs, and Rviz consumed 7 GBs. The sequence is the 20 Gb HIT_Graffiti_Wall_01.bag sequence.

@xuankuzcr
Copy link
Member

Sorry, sir, I’d love to help you, but this is beyond my understanding.
I have tested it on various platforms, and there were neither segmentation faults nor memory issues.
On ROC-RK3588S-PC, "HIT_Graffiti_Wall_01" sequence even uses less memory, requiring only 1.2GB.

@haoming-Yu
Copy link

how's the result of running fast lio? Are u sure the memory usage of 40g is possible...
store all the points and image by 10Hz will not need such large memory...

@hasankiyani007
Copy link
Author

I have a Livox Avia Sensor, I tested FAST-LIO on that for real-time mapping. It consumed very less memory, for around a minute of mapping an indoor hall, it consumed only 300-400 Mb. I'll test it on the bagfiles and also an extensive area for FAST-LIO and will update when done.
Still, the memory usage is extremely high for FAST-LIVO2.

@xuankuzcr
Copy link
Member

Everything you said sounds so unbelievable. I'm sorry that I couldn't help you.

@hasankiyani007
Copy link
Author

No worries! Thank you for trying.
Can you help with the rest of the questions in the original post comment, about the config file, and the pcd folder location or where it is saved?

@xuankuzcr xuankuzcr changed the title Excess RAM Usage Issue Contains Misleading Statements Feb 4, 2025
@hasankiyani007 hasankiyani007 changed the title Issue Contains Misleading Statements Excess Ram usage, and config file settings info Feb 4, 2025
@hku-mars hku-mars locked as spam and limited conversation to collaborators Feb 4, 2025
@xuankuzcr xuankuzcr changed the title Excess Ram usage, and config file settings info Issue Contains Misleading Statements Feb 4, 2025
@hku-mars hku-mars deleted a comment from hasankiyani007 Feb 4, 2025
@xuankuzcr
Copy link
Member

xuankuzcr commented Feb 5, 2025

@hasankiyani007, please continue in this issue. Pay attention to your attitude and avoid spamming. Your previous topic contained misleading information—I am absolutely sure the issue is due to your own configuration. Instead of being persistent in blaming others, take the time to check your own setup first. Also, please respect the work of others.

Your other questions have already been discussed in previous issues. You might find the answers you need in #63 and #65 if you take a moment to look.

We appreciate your cooperation and efforts in maintaining a healthy community. If there's anything I could have handled better, I apologize.

@xuankuzcr xuankuzcr reopened this Feb 5, 2025
@hku-mars hku-mars unlocked this conversation Feb 5, 2025
@hasankiyani007
Copy link
Author

Hello kind sir. I do apologize. I genuinely did not blame you or your work. My only intent when posting was to try to find a fix for my problem. Actually, I was assuming the RAM Usage was similar to previous frameworks, and more importantly, I did think the error may be on my side when you first replied. I have much to learn, I am sorry for my mistakes and will try to be better, which is the most I can do. I will check those issues as well, I may have missed them. I once again apologize, and thank you for your patience.

@hasankiyani007
Copy link
Author

To provide a bit of context for everyone else, I have 2 devices that I have set up for this. The first is my personal pc, with a Ryzen 5 5600 processor, 16 GB RAM, and a dedicated Nvidia GTX 1660S graphic card. The second is an Asus NUC 13 pro kit, with an intel i9 1340p processor, with 64 GB RAM, and integrated graphics.
The software environments on both are Ubuntu 20.04, Ros Noetic, PCL 1.10, Eigen version 3.3.7, OpenCV version 4.2.0. I am testing FAST-LIVO2 on these devices. I followed the exact git read me process to build fast-livo2, with some slight changes as needed, which I'll quickly describe on both:
I installed Ros Noetic, PCL, Eigen, and opencv on my devices. Then, I added Sophus, made a small change as mentioned here and installed it. I also added the rpg_vikit to my caktin workspace. I used catkin build instead of catkin_make to build my workspace. However, on both devices I'm facing similar issues. I've tested fast-livo1 and r3live on my personal pc as well, and it also consumed extensive amounts of RAM for large sequences, to the point where my pc would freeze. Similar issues were reported by other users for R3LIVE and FAST-LIVO1 as well, and the general consensus there was the map was being saved in the memory and held there, leading to such high utilization.
However, since everyone else is getting no usage issues, what may I have done wrong, or can anyone help me get some debugging information so I can test my systems? Maybe I'm using the wrong versions of any software, or any other issue? Thank you all in advance.

@hasankiyani007 hasankiyani007 changed the title Issue Contains Misleading Statements My build using excess RAM? Feb 5, 2025
@pcl5
Copy link

pcl5 commented Feb 5, 2025

To provide a bit of context for everyone else, I have 2 devices that I have set up for this. The first is my personal pc, with a Ryzen 5 5600 processor, 16 GB RAM, and a dedicated Nvidia GTX 1660S graphic card. The second is an Asus NUC 13 pro kit, with an intel i9 1340p processor, with 64 GB RAM, and integrated graphics. The software environments on both are Ubuntu 20.04, Ros Noetic, PCL 1.10, Eigen version 3.3.7, OpenCV version 4.2.0. I am testing FAST-LIVO2 on these devices. I followed the exact git read me process to build fast-livo2, with some slight changes as needed, which I'll quickly describe on both: I installed Ros Noetic, PCL, Eigen, and opencv on my devices. Then, I added Sophus, made a small change as mentioned here and installed it. I also added the rpg_vikit to my caktin workspace. I used catkin build instead of catkin_make to build my workspace. However, on both devices I'm facing similar issues. I've tested fast-livo1 and r3live on my personal pc as well, and it also consumed extensive amounts of RAM for large sequences, to the point where my pc would freeze. Similar issues were reported by other users for R3LIVE and FAST-LIVO1 as well, and the general consensus there was the map was being saved in the memory and held there, leading to such high utilization. However, since everyone else is getting no usage issues, what may I have done wrong, or can anyone help me get some debugging information so I can test my systems? Maybe I'm using the wrong versions of any software, or any other issue? Thank you all in advance.

Hello, during my Docker tests, the memory usage of fastlivo_mapping was around 7GB. When my friend ran the code natively on their machine, it consumed less than 5GB. Please note that I did not opt to build Mimalloc, and the point_filter_num was set to 1.This clearly indicates an issue with your code build or environment configuration. I’ve uploaded my Docker image for you to test the code and monitor memory usage, which should help rule out problems on your end.
docker pull pcl5pcl5/fast_livo2
Hope this helps you identify and resolve your own issues, so we can all contribute to maintaining a better open-source environment.

Image

@dongjq23
Copy link

dongjq23 commented Feb 5, 2025

为了为其他所有人提供一些上下文,我为此设置了2个设备。第一个是我的个人PC,配备Ryzen 5 5600处理器,16 GB RAM和专用的NVIDIA GTX 1660S图形卡。第二个是Asus nuc 13 Pro套件,带有Intel I9 1340p处理器,具有64 GB RAM,并集成图形. 两者上的软件环境都是Ubuntu 20.04,Ros Noetic,PCL 1.10,Eigen版本3.3.7,OpenCV版本4.2.0。我正在这些设备上测试Fast-Livo2。我遵循了确切的git读我的过程来构建快速livo2,并根据需要进行一些微小的更改,我会在这两个方面迅速描述: 我在设备上安装了Ros Noetic,PCL,Eigen和OpenCV。然后,我添加了Sophus,如前所述进行了少量更改 这里 并安装了它。我还将RPG_VIKIT添加到我的Caktin工作区。我使用Catkin Build而不是Catkin_make来构建工作空间。但是,在这两个设备上,我都面临类似的问题。我也在个人PC上也测试了Fast-Livo1和R3Live,并且还消耗了大量的大型RAM,以至于我的PC会冻结。其他用户也向R3Live和Fast-Livo1报告了类似的问题,并且总体共识保存在内存中并保留在那里,导致了如此高的利用率. 但是,由于其他所有人都没有遇到使用问题,我可能会做错什么,或者有人可以帮助我获得一些调试信息,以便我可以测试我的系统?也许我正在使用任何软件的错误版本或其他任何问题?提前谢谢大家.

您好,我的电脑配置(显卡是RTX4050)和软件库版本可以在下面图片中看到,设置point_filter_num = 3时,程序运行占用内存为3.8G,结果供您参考。

Image
Image
Image

@hasankiyani007
Copy link
Author

Just a quick update so that the thread does not get spammed:
@pcl5 Thank you for your help. Since you mentioned you built without mimalloc, I went ahead and manually removed the mimalloc installation, and rebuilt my catkin workspace, and now the RAM usage is normal, that is, the complete sequence used 4-5 GB. I have yet to test further. I will continue testing this on other devices with the same solution, and will update and close the issue with this solution within the next 2 days if the excess usage is not reproduced. Thank you for the information @dongjq23 as well, much appreciated everyone who is helping!

@eung-ark
Copy link

eung-ark commented Feb 5, 2025

I had the same symptoms to be honest. But as you mentioned above, I removed all the mimalloc and rebuilt it too, and then RAM level came back to normal. Maybe I built mimalloc wrong..
Thanks to the help of the community.

@G4419
Copy link

G4419 commented Feb 5, 2025

On my 127-second dataset, fastlivo_mapping consumed about 20GB of RAM. After uninstalling mimalloc, the RAM usage returned to normal. Therefore, this issue appears to be related to mimalloc.

@xuankuzcr
Copy link
Member

xuankuzcr commented Feb 5, 2025

FAST-LIVO2, unlike R3LIVE and its predecessor FAST-LIVO, represents a qualitative leap in memory efficiency, computation time, and robustness, thanks to its sparse map structure and system architecture, as detailed in the paper. It stands apart and should not be lumped together with others (as you have seen its performance).

The high performance of mimalloc comes at the cost of additional memory caching, which is likely causing the issue. However, the impact of memory consumption is not obvious on my computer, and the reason for this is still unclear. For now, it is recommended not to install this library.

Additionally, if the current memory usage is still unsatisfactory, you can set map_sliding_en = true (default settings use a global map). This will keep memory usage fluctuating within a narrow range instead of continuously increasing.

Thank you all for your support and validation! 🙌🎉

@hasankiyani007
Copy link
Author

Final Update:
I tested FAST-LIVO2 on another system, with and without mimalloc. With mimalloc, I had the same 40 GB Ram Usage on the 8 minute sequence, and after removing mimalloc and testing FAST-LIVO2 without it, the same 8 minute sequence had around 7 GB of usage. Please note, this usage is excluding the RAM Usage by RViz of course, which may tend to also add up as well. I will consider this issue solved. Thank you everyone for the help!

RAM USAGE WITHOUT MIMALLOC:

Image

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

No branches or pull requests

7 participants