Making compiled OpenCV (with CUDA) to run on different Jetsons and/or different JetPacks

Hi,

I am trying to find a solution on how I can make a compiled OpenCV (with CUDA) on one platform, for example, Jetson Nano (running JP4.4) to run on different JP version or on different Jetson platform, for example Xavier NX.

In order to explain this scenario, lets say I am compiling OpenCV 4.4 with CUDA support on Jetson Nano which has JP 4.4 installed. Now I want to take this compile OpenCV and run on another Nano which has JP 4.3. Is it possible? I am having difficulty doing it, I managed to compile my project/software using a virtual environment but when I tried to run the program it is saying, “CUDA driver version is insufficient for CUDA runtime version in function …”. This probably means the graphics driver version is older than what it expects.

I am looking into this issue from production, deployment and maintenance perspective. If a Jetson is delivered to a customer with JP 4.4 and in future JP 4.5 is released, the existing installations running JP 4.4 cannot be upgraded with to the newest release of the software built on JP 4.5 unless JP is upgraded at the client end. In order to solve this issue the solutions that I see is:

  1. Compile OpenCV and any other components that have dependencies with driver version, CUDA version, DNN version etc on every JP releases and use the particular one that the customer has to build a release of the software for upgrade.
    The issue with this concept is you have to keep too many releases of the software.

  2. Compile OpenCV and any other components that have dependencies with driver version, CUDA version, DNN version etc on a particular JP release and use it to build the software with virtual environment (the software release will have all the dependencies within). Benefit of this concept is you will have only one release of the software which could be installed and run on atleast few older/newer releases of JP.

I am trying the second option.
Would appreciate any inputs from experts on this matter.

Thanks in advance.

hi caruofc:

1:Jetson Nano (running JP4.4) to run on different JP version
just run on same JP verison, different JP version no guarantee from NV

2:on different Jetson platform
same JP version ,different platform, OK

3:compile opencv on jetson directly ,DONOT compile in a virtual env, it depend on CUDA related SDK ,if you want compile with CUDA

4:Compile OpenCV and any other components that have dependencies with driver version, CUDA version, DNN version etc on every JP releases and use the particular one that the customer has to build a release of the software for upgrade.
YES, because CUDA sdk maybe changed some API each time

5:Compile OpenCV and any other components that have dependencies with driver version, CUDA version, DNN version etc on a particular JP release and use it to build the software with virtual environment (the software release will have all the dependencies within).
if you run opencv in virtual env, you COULD NOT utilize the GPU , because virtual just a CPU env I think

Thank you for your reply. So, you are actually recommending Option#1 that I described in my original post. I understand that is the best solution but it increases maintenance/test cost significantly. I wish I could avoid that.

What about if we have the particular version of CUDA and DNN, that was used to compile OpenCV, packaged along with the software and make the software use the version packaged with it instead of the one installed in the system? It should work if the driver version is newer or the same. So, what I am trying to say is, this probably would work if we compile OpenCV on, for example, JP4.3 and try to run it on JP4.4, opposite might not work as driver might be an older release. What do you think?

Ok, I have some update on this issue.

I compiled OpenCV 4.4 with CUDA and DNN on JP4.3. The version of CUDA is 10.0 and the version of DNN is 7.5 on JP4.3. Then I made the compiled OpenCV, CUDA and DNN part of my software source code. I reimaged Nano with JP4.4. I got CUDA 10.2 and DNN 8.0 came along with it. But since I have CUDA 10.0 and DNN 7.5 with my software source code I compiled and linked my source code on JP4.4 with CUDA 10.0 and DNN7.5 instead of the system installed CUDA 10.2 and DNN8.0.

This made the compiled software run on JP4.4. Moreover, The program is also able to run on JP4.3 even though it is compiled on JP4.4.

I am interested to know what risk is involved with this approach.

hi caruofc:
risk I thinks is unpredictable, in your test is OK NOT means always OK. so if compiled in one JP version and run in another version, you should run unit tested carefully to make sure it run correctly.

Yes, I think I would go with standardizing a JP for production for a period in order to minimize the risk. When it would be time to upgrade JP, have to go for updating all boards in the field. The good thing now is from JP4.4 it allows updating using apt. Hope it would work flawlessly.