imodpasteur / ZOLA-3D

Zernike Optimized Localization Algorithm for 3D single molecule localizations
GNU General Public License v3.0
14 stars 3 forks source link

Cuda 10.1 libraries working in linux; not windows for GPU drift correction #9

Open zach-hensel opened 4 years ago

zach-hensel commented 4 years ago

Using the 10.1 lib/jars in Linux worked great; in Windows 10 x64 GPU drift correction is not working. The Cuda 10.1 .jars and .dlls (and only these versions) come from the .zip file distributed with Zola and are present in the correct folders.

Zola exception --

(Fiji Is Just) ImageJ 2.0.0-rc-69/1.52p; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 150MB of 24403MB (<1%)

java.lang.UnsatisfiedLinkError: Error while loading native library "JCusparse-10.1.0-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:\Fiji.app\lib\JCusparse-10.1.0-windows-x86_64.dll: The specified procedure could not be found
    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.jcusparse.JCusparse.initialize(JCusparse.java:77)
    at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
    at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:77)
    at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2773)
    at org.pasteur.imagej.ZOLA.run(ZOLA.java:439)
    at ij.IJ.runUserPlugIn(IJ.java:230)
    at ij.IJ.runPlugIn(IJ.java:193)
    at ij.Executer.runCommand(Executer.java:137)
    at ij.Executer.run(Executer.java:66)
    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/JCusparse-10.1.0-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.jcusparse.JCusparse.initialize(JCusparse.java:77)
    at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
    at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:77)
    at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2773)
    at org.pasteur.imagej.ZOLA.run(ZOLA.java:439)
    at ij.IJ.runUserPlugIn(IJ.java:230)
    at ij.IJ.runPlugIn(IJ.java:193)
    at ij.Executer.runCommand(Executer.java:137)
    at ij.Executer.run(Executer.java:66)
    at java.lang.Thread.run(Thread.java:748)
---(end of nested stack traces)---

    at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
    at jcuda.jcusparse.JCusparse.initialize(JCusparse.java:77)
    at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
    at org.pasteur.imagej.cuda.MyCudaStream.init(MyCudaStream.java:77)
    at org.pasteur.imagej.ZOLA.driftCorrection(ZOLA.java:2773)
    at org.pasteur.imagej.ZOLA.run(ZOLA.java:439)
    at ij.IJ.runUserPlugIn(IJ.java:230)
    at ij.IJ.runPlugIn(IJ.java:193)
    at ij.Executer.runCommand(Executer.java:137)
    at ij.Executer.run(Executer.java:66)
    at java.lang.Thread.run(Thread.java:748)

Cuda version --

C:\Users\zach>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:12:52_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.1, V10.1.243
benoitbenoit commented 4 years ago

Hello, This is strange. Did you check that the following file exists: C:\Fiji.app\lib\JCusparse-10.1.0-windows-x86_64.dll ? If not, you should copy in Fiji the lib folder that is available here for your cuda version: https://github.com/imodpasteur/ZOLA-3D/releases/download/0.2.6/JCuda.libraries.zip Thank you Benoit

zach-hensel commented 4 years ago

Hi Benoit -- thanks for the response. The lib folder and also the jars folder and both filled with the latest 10.1 x64 files from your distribution and that's the only copy of Fiji installed on this computer.

image

benoitbenoit commented 4 years ago

Hello, I was providing libraries for cuda-10.1.0. Maybe using version 10.1.1 will solve the problem.

Version 10.1.1 is now available here: https://github.com/imodpasteur/ZOLA-3D/releases/download/0.2.6/JCuda.libraries.zip

I suggest you to use another Fiji installation to test ZOLA with the new library. If you want to keep your current installation you have to remove all the following files located in Fiji/jars folder: jcublas-10.1.0.jar, jcuda-10.1.0.jar, jcudnn-10.1.0.jar, jcufft-10.1.0.jar, jcurand-10.1.0.jar, jcusolver-10.1.0.jar, jcusparse-10.1.0.jar. and jnvgraph-10.1.0.jar.

Then unzip the downloaded file, go to folder ./JCuda libraries/JCuda_10.1.1/Windows Select the 2 folders (jars + lib), copy them, and paste them into your Fiji folder.

Normally, it should work. Sorry, I can not test it since all the computers I have in my lab have Cuda_10.0.

zach-hensel commented 4 years ago

Partial success! I downgraded Cuda to 10.0 - windows 10 x64 version 10.0.130 available here - https://developer.nvidia.com/cuda-10.0-download-archive - and now it works with your 10.0 lib/jars. Drift correction, calibration, and detection/fitting are all working.

Before that I tried the 10.1.1 lib/jars both with my earlier installation (10.1.243) and also with 10.1.168; neither worked.