Make Fiji use a specific version of CUDA

Hi,

I’m using Fiji to run ZOLA (https://github.com/imodpasteur/ZOLA-3D), a GPU-accelerated plugin for SIngle Molecule Localization Microscopy. On my current Windows 10 machine (with an NVDIA GTX 1080 GPU), the CUDA drivers reported by the NVIDIA panel are version 11.1.114 (the card driver is 457.30 “studio” variant).

However, the ZOLA repository provides libraries for different versions of CUDA, but the most recent one is CUDA 10.1.1. So after placing these libraries the “win64” folder of the Fiji lib and jars folders, when trying to run a GPU-accelerated process in ZOLA, I get the following exception:

(Fiji Is Just) ImageJ 2.1.0/1.52v; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 430MB of 24237MB (1%)
 
java.lang.UnsatisfiedLinkError: Error while loading native library "JCublas2-10.1.1-windows-x86_64"
Operating system name: Windows 10
Architecture         : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: C:\Users\chris\christo\Processing\Fiji\Fiji.app\lib\win64\JCublas2-10.1.1-windows-x86_64.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.jcublas.JCublas2.initialize(JCublas2.java:81)
at jcuda.jcublas.JCublas2.<clinit>(JCublas2.java:66)
at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:69)
at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2926)
at org.pasteur.imagej.ZOLA.run(ZOLA.java:449)
at ij.IJ.runUserPlugIn(IJ.java:233)
at ij.IJ.runPlugIn(IJ.java:196)
at ij.Executer.runCommand(Executer.java:150)
at ij.Executer.run(Executer.java:65)
at java.lang.Thread.run(Thread.java:748)
Stack trace from the attempt to load the library as a resource:
java.io.IOException: No resource found with name '/lib/JCublas2-10.1.1-windows-x86_64.dll'
at jcuda.LibUtils.writeResourceToFile(LibUtils.java:323)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:255)
at jcuda.LibUtils.loadLibrary(LibUtils.java:158)
at jcuda.jcublas.JCublas2.initialize(JCublas2.java:81)
at jcuda.jcublas.JCublas2.<clinit>(JCublas2.java:66)
at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:69)
at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2926)
at org.pasteur.imagej.ZOLA.run(ZOLA.java:449)
at ij.IJ.runUserPlugIn(IJ.java:233)
at ij.IJ.runPlugIn(IJ.java:196)
at ij.Executer.runCommand(Executer.java:150)
at ij.Executer.run(Executer.java:65)
at java.lang.Thread.run(Thread.java:748)
---(end of nested stack traces)---

at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
at jcuda.jcublas.JCublas2.initialize(JCublas2.java:81)
at jcuda.jcublas.JCublas2.<clinit>(JCublas2.java:66)
at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:69)
at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2926)
at org.pasteur.imagej.ZOLA.run(ZOLA.java:449)
at ij.IJ.runUserPlugIn(IJ.java:233)
at ij.IJ.runPlugIn(IJ.java:196)
at ij.Executer.runCommand(Executer.java:150)
at ij.Executer.run(Executer.java:65)
at java.lang.Thread.run(Thread.java:748)

Is this exception due to version conflict of the CUDA libraries (I hope I didn’t make a trivial error in placing them at the right place)?

Is there a simple/foolproof way to downgrade CUDA drivers or make sure Fiji use a specific version of them under Windows 10?

Will messing with CUDA drivers at this level (either general or Fiji-specific if possible) risk destroying my deep-learning workflow that is set up in a dedicated Anaconda environment (and is currently running well after some headaches), or does the use of an environment somehow protect it from my missteps?

Thank you for your help!

I’ve never used ZOLA before, but for other FIJI plugins that use CUDA, you can select the tensorflow version under Edit, Options, Tensorflow. Does that work for you?

Hi @christlet

When trying to trouble shoot these types of issues I use a tool called dependency walker. I loaded the JCublas .dll into dependency walker and it flagged cublas64_10.dll as missing. Not sure if this is your problem, however if it is you can:

a) put cublas64_10.dll and it’s dependencies into the win64 directory along side the other libraries shipped with ZOLA.

b) alternatively add ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin’ to your windows system path. This approach could be riskier if you have a newer version of cuda installed or other versions of cuda somewhere on the path.

Not that I am aware of. Not all plugins that use cuda are built against the same version of cuda. There are all kinds of potential problems with having plugins require different versions of cuda, but I am not sure what could be done about it.

Changing Fiji shouldn’t hurt Anaconda, even if you were not using a dedicated environment. Changing your system path potentially could.