Skip to content

CSBDeep in Fiji – Installation

Deborah Schmidt edited this page Dec 21, 2017 · 10 revisions

Fiji / ImageJ

Download Fiji from the Fiji Download page and install it by simply unpacking it.

The plugins should run on macOS and Linux systems. We are working on Windows support.

CSBDeep Plugin

  1. Go to Help > Update...

  1. Open the update manager by clicking Manage update sites
  2. Add an update site with the URL http://sites.imagej.net/CSBDeep/ and the Name CSBDeep and close the 'Manage update sites' window again

  1. Click Apply changes to install the plugin

  1. Restart Fiji

GPU support

Note: TensorFlow GPU in Java is currently only available on Linux.

Install Requirements

Install the NVIDIA requirements to run TensorFlow with GPU support as described in the TensorFlow Documentation.

NOTE:

  • Make sure to use CUDA® Toolkit 8.0. (Helpful link)
  • Make sure to use cuDNN v6.0

Set the library path

There are two options to make CUDA visible to Fiji and TensorFlow:

Option 1 (easy but annoying in the long-term):

  • Add the path of CUDA and cuDNN to your LD_LIBRARY_PATH environment variable. (This is also part of the installation instructions above)

  • Always start Fiji from the command line:

    $ /path/to/Fiji.app/ImageJ-linux64
    

    This makes sure the LD_LIBRARY_PATH environment variable is set in Fiji.

Option 2 (root necessary)

NOTE:

  • This will add CUDA and cuDNN to the system-wide library path
  • CUDA and cuDNN will be available to all system users
  • You need to have root access on the system (or ask your system admin)
  • There may be differences for different Linux distributions (Tested on Linux Mint 18.1 Cinnamon 64-bit).

Add a file to /etc/ld.so.conf.d/ called cuda.conf with the content: (Replace the paths with the paths where CUDA and cuDNN are installed)

$ cat /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64
/usr/local/cudnn/lib64

Run ldconfig to make the new libraries available:

$ sudo ldconfig

Install tensorflow-gpu jni

  1. Make sure your GPU fulfills the requirements for TensorFlow and install CUDA and cudNN as described in Installing TensorFlow
  2. Download and extract the Java Native Interface (JNI) file by executing the following shell commands:
$ export FIJI_HOME=/path/to/Fiji.app  # Replace with the path to your Fiji installation
$ mkdir -p ${FIJI_HOME}/lib/linux64/
$ curl -L \
   "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-gpu-linux-x86_64-1.3.0.tar.gz" |
   tar -xz -C ${FIJI_HOME}/lib/linux64
$ chmod +w ${FIJI_HOME}/lib/linux64/*

See Installing TensorFlow for Java for additional information.

Multiple GPUs

If you have multiple CUDA enabled GPUs you may want to set the environment variable CUDA_VISIBLE_DEVICES to specify the GPU which should be used.

As CUDA will try to enumerate the GPUs by speed

$ export CUDA_VISIBLE_DEVICES=0

should give you only the fastest GPU. Execute this line before you start Fiji or put it into your ~/.bashrc or set the environment variable somewhere else like in ~/.pam_environment. See the documentation of your distribution for options on how to set environment variables.

Optional:

If this is not sufficient for your setup. You can find out the ID (in PCI bus order) of your GPU with:

$ nvidia-smi
Thu Sep 14 17:39:33 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.66                 Driver Version: 375.66                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  NVS 310             Off  | 0000:A1:00.0     N/A |                  N/A |
| 30%   56C    P0    N/A /  N/A |    294MiB /   961MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
|   1  TITAN Xp            Off  | 0000:03:00.0     Off |                  N/A |
| 23%   28C    P8     9W / 250W |      1MiB / 12189MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

and also set the environment variable CUDA_​DEVICE_​ORDER:

$ export CUDA_​DEVICE_​ORDER="PCI_BUS_ID"
$ export CUDA_VISIBLE_DEVICES=1

See the CUDA Programming Guide for more information.

Clone this wiki locally