CUDA Memory error during RGB_depth frame alignment on Jetson Orin Nano #14322
Replies: 8 comments 3 replies
-
Hi @Metazet255 As you are using R36 revision 4.4, the JetPack version for that release should be JP 6.2.1. Is that what you have on your Orin Nano, please? There was a past case in the year 2020 at #7415 where a RealSense user experienced the 700 CUDA error when changing resolution. It occurred intermittently for them too. In their particular situation, they reported at #7415 (comment) that the error never occurred if they disabled the camera's IR emitter. Ultimately, they resorted to using CPU processing (CUDA = false). |
Beta Was this translation helpful? Give feedback.
-
If BUILD_WITH_CUDA is set to false then the librealsense SDK will not have CUDA support enabled and will use the CPU for processing of depth-color alignment and pointclouds instead. So if the error occurs even with CUDA support set to false then it suggests that the error when aligning is not caused by the CUDA support. If you disable the IR emitter and use the Infrared image (which is like a monochrome RGB image) instead of RGB then the IR image will be perfectly aligned by default with the depth image without having to use alignment, because both depth and Infrared originate from the same sensor. |
Beta Was this translation helpful? Give feedback.
-
The only way to be certain that the CPU is being used to generate a pointcloud is by setting DBUILD_WITH_CUDA to false. As you have installed the graphical examples by setting the BUILD_GRAPHICAL_EXAMPLES flag to On, you could try running the rs-pointcloud example pointcloud program (which maps depth and RGB together into a combined image) to see whether the error occurs if you have not tried this program already. |
Beta Was this translation helpful? Give feedback.
-
When you are switching cameras, do you mean that you are unplugging one camera and plugging another camera in whilst the program is running, or do you have all the cameras attached to the computer at the same time and have a method of switching between which camera is currently active, please? Once a camera is unplugged, the librealsense SDK only allows a 5 second period to reconnect a camera before the pipeline will time-out. If you are unplugging and inserting different cameras, it may be a good idea to use multiple camera code like that of the rs-multicam SDK example program if you are not using multicam code already, so that the program can automatically add and remove cameras from its list of active cameras as they are inserted and unplugged. If I have misunderstood how your camera switching mechanism works then I apologize and ask that you please provide further information about how the switch takes place. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello @MartyG-RealSense By switching cameras, I mean UDP requests from a different camera, & not physically disconnecting & reconnecting cameras. I run 4 camera pipleines in parallel & process images from whichever cam ID is requested in teh UDP request. This goes on in an infinite loop with a new random UDP request being generated every 5 seconds until I exit the program with Ctrl + Z. |
Beta Was this translation helpful? Give feedback.
-
I am slightly familiar with UDP requests but my knowledge of them is limited, unfortunately. Running in an infinite loop sounds as though it could possibly lead to a memory leak, causing the program to become more unstable as the computer's available memory is consumed over time. You could check for a memory leak in htop by observing the available memory and see if it is falling whilst the program runs. |
Beta Was this translation helpful? Give feedback.
-
The inifnite loop simulates real world conditions where the robot is expected to detect tuberails in a greenhouse autonomously & perform row shifts continuously. Analysis with teh help of chatGPT tells me to use teh CPU for depth-color alignment & the GPU for running teh inference. I am able to avoid teh CUDA errors when I use teh CPU for both alignment & inference (this takes longer time), but I do not know how to hide CUDA from teh realsense functions (including align.process(frames)) only. Do you know how it is possible to do so ? As to your response about the memory leak, if this was the case, then the program would always fail after a certain number of image requests. But this is not the case, as the program sometimes runs succesfully for a long time, but abruptly ends sometimes as well. |
Beta Was this translation helpful? Give feedback.
-
If librealsense is built from source code on Jetson with CMake without the flag DBUILD_WITH_CUDA then RealSense should completely ignore the presence of CUDA and use the CPU for alignment and point clouds. If you would prefer to have GPU assistance for faster processing then if you program in the C++ language there would be the option of using GLSL to GPU-accelerate point clouds and alignment instead of CUDA. #7611 (comment) has more information about this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I have a computer vision segmentation setup with 3 Realsense cameras connected to a Jetson Orin Nano, which acts as a device to a Windows Host laptop (through SSH). I have simultaneously initilaised 3 Realsense camera streams which fetch the RGB & Depth images & send them to the ORT inferencer when a UDP request is sent, say for a certain camera (like cam ID 1).
I am getting a CUDA 700 illegal memory access error intermittently when switching between cameras & I noticed that the depth image was always black just before the failure. I also observed that when I removed the line which aligns the Depth resolution to fit the RGB resolution (aligned = self.aligns[cam_id].process(frames) ), the CUDA error vanishes. However my predicted calculations regarding distance & angle are wrong because of the misalignment between the RGB & Depth image. I have tried increasing the frame queue size of the Realsense cameras (currently it is 1) as well as reducing the frame rate to 6 fps & adding delays within teh pipeline but the error still occurs. I have updated the CUDA driver & well as the Jetpack & teh Realsense firmware to the most recent version, so I know the problem is not there.
Has anyone else faced this issue & if so, how did you deal with it ?
Camera Specs: 2 Intel RealSense D435I cameras
L4T: Linux4Tegra: GNU/Linux 5.15.148-tegra aarch64
Ubuntu Version: Ubuntu 22.04.5 LTS
Jetpack version: R36 (release), REVISION: 4.4
Beta Was this translation helpful? Give feedback.
All reactions