Differences between revisions 8 and 11 (spanning 3 versions)
Revision 8 as of 2019-01-17 15:38:34
Size: 1952
Editor: AndrewHoopes
Comment:
Revision 11 as of 2019-06-24 12:30:27
Size: 1696
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
}}}  }}}
Line 27: Line 27:
=== Tensorflow GPU === === Tensorflow ===
Line 29: Line 29:
By default, the cpu-tensorflow package is installed, but if you're on a machine that allows it, you can use the gpu-enabled tensorflow by adding to the following search paths: By default, the GPU version of tensorflow is installed. You can still make tensorflow use the CPU with this version, but if your machine does not have cuda installed (like `oribi`), then you unfortunately won't be able to import tensorflow at all. In this case, you must activate the `tensorflow-cpu` conda environment by running:
Line 32: Line 32:
export PYTHONPATH=/space/freesurfer/python/linux/tensorflow-gpu:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/pubsw/packages/CUDA/lib64:$LD_LIBRARY_PATH
source activate tensorflow-cpu
Line 35: Line 34:

Keep in mind that '''/usr/pubsw/packages/CUDA/lib64''' contains the shared libraries for many cuda versions, so you should refrain from including it in LD_LIBRARY_PATH until you're actually using cuda, since it will slow down program launches by searching that whole network directory.

FreeSurfer Python Development

To facilitate straightforward and reproducible python development in the lab, a custom python3 (anaconda) distribution for internal developers is installed at /space/freesurfer/python/linux. To use this version, make sure all calls to python or python3 point to this install by adding the following to your PATH.

export PATH=/space/freesurfer/python/linux/bin:$PATH

Keep in mind there's also a python3 link in /usr/pubsw/bin, so it's important that /space/freesurfer/python/linux/bin comes before that in your PATH.

Developing and Using the FreeSurfer Python Library

The freesurfer python library, which contains general utilities and various submodules like deepsurfer, gems, and samseg, is developed in the repository under repo/python/freesurfer. In order to utilize this library during development, you must point your PYTHONPATH at it:

export PYTHONPATH=/path/to/your/freesurfer-repository/python:$PYTHONPATH

This allows you to import your working version of the freesurfer library in any script or python interpreter. You can test it by opening a python interpreter and running:

import freesurfer as fs
status = fs.run('echo hello!')

Tensorflow

By default, the GPU version of tensorflow is installed. You can still make tensorflow use the CPU with this version, but if your machine does not have cuda installed (like oribi), then you unfortunately won't be able to import tensorflow at all. In this case, you must activate the tensorflow-cpu conda environment by running:

source activate tensorflow-cpu

Python (last edited 2023-07-14 12:14:32 by AvnishKumar)