bytedeco / javacpp-presets

The missing Java distribution of native C++ libraries
Other
2.65k stars 738 forks source link

Each version of org.bytedeco.cuda requires same version cuda toolkit? #1527

Open Zain-Shamshad opened 1 month ago

Zain-Shamshad commented 1 month ago

Hi, @saudet,

Recently I switched to cuda support for opencv in java using org.bytedeco.cuda version 12.1-8.9-1.5.9. Javacpp version 1.5.9 and Opencv version 4.7.0-1.5.9.

The code compiled successfully But I kept encountering UnsatisfiedLinkError at runtime for different methods.

e.g.,

GpuMat gpuFrame1 = new GpuMat.....;

org. bytedeco. opencv. opencv_cudafilters.Filter f = org. bytedeco. opencv. global. opencv_cudafilters.createGaussianFilter(gpuFrame1.type(), -1, new Size(9, 9), 2);

Eventually I had to download and install Cuda Toolkit version 12.x to resolve this error. Now, my concern is that with this little change do I need to update/install same Cuda Toolkit version everywhere with code or is there any workaround for this as the jars are already packaged within code.

Kindly, is there anything we can do to get rid of this step maybe by packaging code with any .dlls and if yes then which ones please and if not then any help would be greatly appreciated. Thanks.

saudet commented 1 month ago

Please add a dependency on cuda-platform-redist like this: https://github.com/bytedeco/javacpp-presets/blob/master/opencv/samples/pom.xml