CSBDeep / CSBDeep_fiji

BSD 2-Clause "Simplified" License
11 stars 4 forks source link

Catch if TF for GPU is not installed -> use maven CPU version #7

Closed frauzufall closed 7 years ago

frauzufall commented 7 years ago

The current usage of

System.loadLibrary( "tensorflow_jni" );

seems to prevent the command to run if the TF GPU version is not installed on the system, is that correct? At least I get this error:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no tensorflow_jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at mpicbg.csbd.commands.AnyNetwork.<init>(AnyNetwork.java:115)

In this case, the command should use the CPU version from maven and maybe give a warning. I tried to put it in a try catch block but that does not seem to work.

What do you think?

frauzufall commented 7 years ago

Hey @HedgehogCode, does the warning occur only once if you run the program without the lib? It's in the constructor so it should, but for me it appears multiple times during command startup and multiple times after I click "Ok" on the command. Any idea?

frauzufall commented 7 years ago

I made a forum post because this seems to be a general problem with command constructors. http://forum.imagej.net/t/org-scijava-command-command-constructor-calls/7431