Opendronemap/nodeodm:gpu - nvidia-smi detected - cannot initialize CUDA

Hi Guys,

I have downloaded the latest version of wedODM (2.5.4) from git, and have this version running on a new Ubuntu 24.04 install with the latest docker, nvidia-container-toolkit, cuda-toolkit, etc installed.

I can successfully run webODM 2.5.4 with GPU on this install (with a bit of fiddling), and can run NodeODM remotely through through port 3000 with cpu only. But, have had no luck running nodeodm remotely through port 3000 with gpu.

I get the following log…
[INFO] nvidia-smi detected
[INFO] Using CPU for feature extraction: Cannot initialize CUDA

The nodeodm container was set up as follows…
“docker run -p 3000:3000 --gpus all opendronemap/nodeodm:gpu -q 1 --token secret”

Any ideas on how to resolve this conundrum are very welcome.

Cheers

J

1 Like

Are you positive you have the latest Docker images?

We just pushed a fix to ODM/NodeODM for GPU:

Hi Saijin, thanks for your response,

I think so. I ran a fresh install of docker, nvidia-container-toolkit, cuda-toolkit yesterday and downloaded a fresh version of WebODM a couple of hours ago.

When I run apt install libtbb2 inside the web-odm-node-1 container I get…

root@#############:/var/www# apt install libtbb2
Reading package lists… Done
Building dependency tree
Reading state information… Done
libtbb2 is already the newest version (2020.1-2).

However, when I run nvidia-smi I get…

root@##########:/var/www# nvidia-smi
Fri Jul 19 05:26:08 2024
±----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.06 Driver Version: 555.42.06 CUDA Version: 12.5 |
|-----------------------------------------±-----------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA T400 4GB Off | 00000000:03:00.0 Off | N/A |
| 38% 31C P8 N/A / 31W | 191MiB / 4096MiB | 0% Default |
| | | N/A |
±----------------------------------------±-----------------------±---------------------+

±----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
±----------------------------------------------------------------------------------------+
root@########:/var/www#

It seems the GPU is found but is running with the wrong CUDA version.

J

1 Like

Hmm, we might have to have other folks weigh in for what is working for them or not.

Thanks Saijin,

And, thanks to the rest of the team for an awesome imagery processing platform.

I can confirm that running ODM directly with GPU enabled (e.g. docker run -ti --rm -v /home/xxxxxx/datasets:/datasets --gpus all opendronemap/odm:gpu --project-path /datasets project) works perfectly on both my Ubuntu 24.04 machines (machine 1: CPU = Tripper 5995wx and GPU = GeForce RTX 3060. machine 2:CPU = Xeon E5/Core i7 and GPU = T400 4GB) with the latest docker, cuda-toolkit, and nvidia-ctk installed on both.

docker version
Client: Docker Engine - Community
Version: 27.0.3
API version: 1.46
Go version: go1.21.11
Git commit: 7d4bcd8
Built: Sat Jun 29 00:02:23 2024
OS/Arch: linux/amd64
Context: default

cuda-toolkit-12-5 version (12.5.1-1)

NVIDIA Container Toolkit CLI version 1.16.0

When I run the latest opendronemap/nodeodm:gpu image, it runs on cpu only and I get
[INFO] nvidia-smi detected
[INFO] Using CPU for feature extraction: Cannot initialize CUDA

Cheers

j

2 Likes

Hi,
I’m experiencing similar issue. If host is running cuda v12.2, nodeodm docker container prints cuda version 11.2 in nvidia-smi and refuses to use GPU with:

Blockquote
[INFO] nvidia-smi detected
[INFO] Using CPU for feature extraction: Cannot initialize CUDA

dpkg in container shows that only 11.2 libraries are installed. Just to check if it is possible to use GPU with CUDA I started nanominer-linux-3.7.4-cuda11 and it works without an issue.
As a very temporary (and brutal) workaround I removed all cuda 11.2 related packages from running container and installed cuda 12.2. With this simple trick nvidia-smi reports correct version and nodeODM no longer complains about CUDA.
Now I’m observing that bin/OpenMVS/DensifyPointCloud is executed on GPU.

I’m going to check if there is some minimalistic set of packages that would allow me to unblock CUDA as reinstalling everything is bit of pain

TIP: To manage packages on nodeODM you need to be a root, so you need to execute following command:

docker exec -it --user root nodeODMhashORname /bin/bash
2 Likes

Hello,

Similar issue here. But 12.6 on the host and 12.6 in the container. Everything is up-to-date on a Fedora system. Maybe, the code doesn’t manage 12.6 CUDA?

Are you sure that container has only 12.6? To check it (if you’re using official build) run

docker exec -it nodeODMhashORname /bin/bash -c '/usr/bin/dpkg -l | grep cuda'

I have check directly with the command ‘nvidia-smi’ with docker container exec on the node.

Any solution? I see some people have the same issue.

I add some information:

odm@9c55e3d9b36f:/var/www$ nvidia-smi
Mon Sep 2 19:12:32 2024
±----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03 Driver Version: 560.35.03 CUDA Version: 12.6 |
|-----------------------------------------±-----------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3080 Off | 00000000:01:00.0 On | N/A |
| 0% 40C P8 28W / 320W | 553MiB / 10240MiB | 0% Default |
| | | N/A |
±----------------------------------------±-----------------------±---------------------+
±----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
±----------------------------------------------------------------------------------------+

odm@9c55e3d9b36f:/var/www$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0

For information the system is a Fedora up-to-date. I used proprietary driver of Fedora comming from nvidia-container-tookit and cuda-fedora39 (the second is for the host). WebODM is the only container where I have problem with Cuda and it works ok otherwise on the system.

EDIT: the error is different now. Before I had:

[INFO] nvidia-smi detected
[INFO] Using CPU for feature extraction: Cannot initialize CUDA

Now I have only nvidia-smi detected and the node just don’t use GPU (according to nvidia-smi and regarding the extraction methods (Extracting ROOT_DSPSIFT features for image DJI_0510.JPG)

Pushing on fri.K’s work a bit more, we were able to get a docker image that mitigated this problem and got CUDA working.

Add the following to Dockerfile.gpu after the chown commands and rebuild the image. Even with these packages removed, CUDA works fine. This allows us to use the same fixed image with ClusterODM, as well.

Installing CUDA 12 into the container is not required.

RUN dpkg -r cuda-libraries-11-2
RUN dpkg -r cuda-cudart-11-2
RUN dpkg -r cuda-compat-11-2
RUN dpkg -r cuda-nvrtc-11-2
RUN dpkg -r cuda-nvtx-11-2
3 Likes

Excellent work, and welcome!

Do you think you have the time to polish this up as a PR for the image so others can benefit as well?

1 Like

Do you have a sense, is there any way to do this at a higher level with apt?

1 Like

Yes. I tested the below and it seems to work equally as well.

RUN apt-get remove -y cuda-libraries-11-2 cuda-cudart-11-2 cuda-compat-11-2 cuda-nvrtc-11-2 cuda-nvtx-11-2

2 Likes

Still not working for me unfortunately or maybe did I miss a step?
I change the Dockerfile and shoot “webodm.sh --gpu start”

EDIT: I access directly to the running container to uninstall. It works and removes the “Cannot initialize CUDA”. Unfortunately still no GPU for features extraction.

1 Like

If the image dimensions do not fit into a CUDA-accerable texture map, it will fall back to CPU.

There will be a log entry for this. Can you check your log?

Nothing in console about that

INFO]    ==============
[INFO]    Running dataset stage
[INFO]    Loading dataset from: /var/www/data/56893a75-f6bf-4eaa-ace5-7202c406eac6/images
[INFO]    Loading 1471 images
[INFO]    Found 1471 usable images
[WARNING] GPS position not available for DJI_0918.JPG.102.JPG
[WARNING] GPS position not available for DJI_0919.JPG.102.JPG
[WARNING] GPS position not available for DJI_0917.JPG.102.JPG
[WARNING] GPS position not available for DJI_0916.JPG.102.JPG
[WARNING] GPS position not available for DJI_0915.JPG.102.JPG
[WARNING] GPS position not available for DJI_0914.JPG.102.JPG
[WARNING] GPS position not available for DJI_0913.JPG.102.JPG
[WARNING] GPS position not available for DJI_0912.JPG.102.JPG
[WARNING] GPS position not available for DJI_0911.JPG.102.JPG
[WARNING] GPS position not available for DJI_0910.JPG.102.JPG
[INFO]    Finished dataset stage
[INFO]    Running split stage
[INFO]    Normal dataset, will process all at once.
[INFO]    Finished split stage
[INFO]    Running merge stage
[INFO]    Normal dataset, nothing to merge.
[INFO]    Finished merge stage
[INFO]    Running opensfm stage
[INFO]    Found 26 image masks
[INFO]    Maximum photo dimensions: 2048px
[INFO]    Photo dimensions for feature extraction: 1024px
[INFO]    nvidia-smi detected
[INFO]    ['use_exif_size: no', 'flann_algorithm: KDTREE', 'feature_process_size: 1024', 'feature_min_frames: 10000', 'processes: 8', 'matching_gps_neighbors: 0', 'matching_gps_distance: 0', 'matching_graph_rounds: 50', 'optimize_camera_parameters: yes', 'reconstruction_algorithm: incremental', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'sift_peak_threshold: 0.066', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'retriangulation_ratio: 2', 'matcher_type: FLANN', 'feature_type: DSPSIFT', 'align_method: orientation_prior', 'local_bundle_radius: 0']
[INFO]    Wrote reference_lla.json
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" detect_features "/var/www/data/56893a75-f6bf-4eaa-ace5-7202c406eac6/opensfm"
2024-10-07 16:44:44,905 INFO: Planning to use 70009.611328125 MB of RAM for both processing queue and parallel processing.
2024-10-07 16:44:44,905 INFO: Scale-space expected size of a single image : 23.8125 MB
2024-10-07 16:44:44,905 INFO: Expecting to queue at most 200 images while parallel processing of 8 images.
2024-10-07 16:44:44,907 INFO: Reading data for image DJI_0003.JPG (queue-size=0)
2024-10-07 16:44:44,907 INFO: Reading data for image DJI_0197.JPG (queue-size=0)

(Extract)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.