Skip to content

CSBDeep in Fiji – Installation

Deborah Schmidt edited this page Jun 25, 2020 · 10 revisions

Fiji / ImageJ

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

CSBDeep Plugin

  1. Go to Help > Update...

  1. Open the update manager by clicking Manage update sites
  2. Scroll to CSBDeep, mark the checkbox and close the 'Manage update sites' window again

  1. Click Apply changes to install the plugin

  1. Restart Fiji

GPU support

Install Requirements

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

This includes the recent CUDA® Toolkit and cuDNN.

Which specific CUDA and cuDNN versions to install?

By default, CSBDeep for Fiji ships with TensorFlow 1.15.0 which is compatible to CUDA 10.1 and cuDNN >= 7.5.1.

If you trained your model on a different TensorFlow version, running the model with with the default installation might fail. In this case, install CUDA and cuDNN matching your training scenario and choose a specific TensorFlow version via Edit > Options > TensorFlow....

Set the library path (Linux only)

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 native libraries

  1. Open Edit > Options > TensorFlow...
  2. Choose the TensorFlow version matching your system
  3. Wait until the library is downloaded and installed (a popup will tell you when it's done)
  4. Restart Fiji

You can for example switch from CPU to GPU by finding the option which is already selected (in the screenshot, TF 1.12.0 CPU) and choose the same TensorFlow version but with GPU support (e.g. TF 1.12.0 GPU).

The CUDA and CuDNN versions displayed are there to help you setup the right environment.

You can also use the filters on the top of the display to filter for a specific TensorFlow or CUDA version or to only list libraries with GPU support.

Is something not working? Please contact us and we will help you figure it out!

Multiple GPUs (Linux only)

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