]> git.donarmstrong.com Git - neurodebian.git/blob - sphinx/blog/2012/2012-03-09_parallelize_fsl_with_condor.rst
a1550f6a808c176428bad37575b264d0e8f20964
[neurodebian.git] / sphinx / blog / 2012 / 2012-03-09_parallelize_fsl_with_condor.rst
1 :date: 2012-03-09 18:00:00
2 :tags: neuroscience, software, imaging, fsl, condor, distributed computing
3
4 .. _chap_parallelize_fsl_with_condor:
5
6 Parallelizing FSL -- without the pain
7 =====================================
8
9 FSL_ is a very popular analysis suite for neuroimaging data. Unfortunately,
10 right out of the box FSL's routines do not make good use of today's multi-core
11 machines.  Consequently, researchers using FSL on individual workstations have
12 difficulties harnessing the computing power of their equipment.
13
14 .. _FSL: http://www.fmrib.ox.ac.uk/fsl/
15
16 However, it is not the case that FSL doesn't support modern computing
17 environments. It is actually one of very few packages that come with built-in
18 support for running computations on a cluster back-end. Unfortunately, it relies
19 on the GridEngine_ software (formerly Sun, now from Oracle) to be installed
20 locally, and configured properly. This is a task that is known to be
21 non-trivial and can cause serious headache in a neuroscientist. While FSL has
22 been ported to use other batch systems, such as Torque_, none of them is much
23 easier to deploy.
24
25 .. _GridEngine: http://www.oracle.com/us/products/tools/oracle-grid-engine-075549.html
26 .. _Torque: http://www.adaptivecomputing.com/products/torque.php
27
28 What would be helpful is a batch system that can be easily installed without
29 complicated configuration procedures. Preferably, such a system is powerful
30 enough to scale across multiple machines, whenever the demand for computing
31 power increases. At NeuroDebian_ we looked at a number of projects and found
32 Condor_ to be the most versatile tools, yet still straightforward to use in a
33 single-machine scenario.
34
35 .. _NeuroDebian: http://neuro.debian.net
36 .. _Condor: http://research.cs.wisc.edu/condor/
37
38 Over the past two years we have been working on getting Condor packaged for
39 Debian. We are now very proud to announce that, a few days ago, Condor has been
40 accepted as an `official Debian package`_ (in Debian experimental for the time
41 being). NeuroDebian, as usual, `provides backports`_ of Condor for numerous
42 Debian and Ubuntu releases.
43
44 .. _official Debian package: http://packages.debian.org/condor
45 .. _provides backports: http://neuro.debian.net/pkgs/condor.html
46
47 With the availability of Condor packages, parallelizing FSL on a local
48 workstation is now possible by following a simple four-step procedure.
49
50
51 1. Configure your machine to use the NeuroDebian repository
52 -----------------------------------------------------------
53
54 [ if you are already a NeuroDebian user you can skip this step ]
55
56 Go to http://neuro.debian.net and follow the setup instructions given on the
57 front-page. This means selecting your Debian or Ubuntu release, select a package
58 repository mirror close to you, and run the little shell script snippet that is
59 presented to you. After having updated you package lists you are ready to go.
60
61 If you are not running Debian or Ubuntu on your machine, you can also install
62 the `NeuroDebian virtual machine`_ which is able to utilize multiple CPU-core.
63 The remaining setup steps apply to VM users as well.
64
65 .. _NeuroDebian virtual machine: http://neuro.debian.net/vm.html
66
67
68 2. Install FSL
69 --------------
70
71 [ if you already have the latest FSL package version, you can skip this too ]
72
73 Open a terminal and install FSL being running the command::
74
75   % sudo apt-get install fsl
76
77 Of course you can also use any graphical package manager front-end (e.g.
78 software center). The terminal commands are simply used for clarity and
79 simplicity.
80
81 Check what version of FSL got installed. Any version from 4.1.9-2 onwards is
82 fine. If you got an older version, you either haven't succeeded doing step 1,
83 or you are running a version of Debian or Ubuntu that is too old, and you would
84 need to upgrade it first.
85
86
87 3. Install Condor
88 -----------------
89
90 Install Condor with::
91
92   % sudo apt-get install condor
93
94 Any Condor package version from 7.7.4-1 onwards comes with all necessary
95 features. During installation a few question will be asked. You should enable
96 the Debconf-based configuration and ask for a "Personal Condor" installation
97 (see screenshots).
98
99 .. image:: pics/blog/condor_install1.png
100
101 .. image:: pics/blog/condor_install2.png
102
103
104 Now you have a fully functional Condor installation that advertises one compute
105 slot per detected CPU-core on your machine. You can display the current status
106 with the ``condor_status`` command. On a dual-core machine this could look like
107 this::
108
109   % condor_status
110
111   Name               OpSys      Arch   State     Activity LoadAv Mem   ActvtyTime
112
113   slot1@meiner       LINUX      INTEL  Owner     Idle     0.320  1972  0+00:00:04
114   slot2@meiner       LINUX      INTEL  Owner     Idle     0.000  1972  0+00:00:05
115                        Total Owner Claimed Unclaimed Matched Preempting Backfill
116
117            INTEL/LINUX     2     2       0         0       0          0        0
118
119                  Total     2     2       0         0       0          0        0
120
121 By default, Condor will only run jobs when the machine is idle. If you want to
122 run jobs immediately when they are submitted you need to change the
123 configuration slightly. To do this run::
124
125   % sudo dpkg-reconfigure condor
126
127 This will again ask a number of questions. Leave everything on the respective
128 defaults, but enable running jobs regardless of other machine activity (see
129 screen shot below).
130
131 .. image:: pics/blog/condor_install3.png
132
133
134 4. Enjoy parallelized FSL
135 -------------------------
136
137 Now you are ready to make use of Condor with FSL. Source the configuration
138 from ``/etc/fsl/fsl.sh`` as usual::
139
140   % . /etc/fsl/fsl.sh
141
142 Whenever you want FSL to parallelize jobs through Condor, simply set the
143 :envvar:`FSLPARALLEL` environment variable to ``condor`` and run FSL as usual::
144
145   % export FSLPARALLEL=condor
146
147 You can check whether the setup is working by running ``condor_q`` to see the
148 list of submitted/running jobs. Running the FEAT part of the FSL-FEEDS test
149 suite could look like this::
150
151   % condor_q
152
153   -- Submitter: meiner : <127.0.0.1:52379> : meiner
154    ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD
155      1.0   michael         3/9  14:47   0+00:00:07 R  0   0.7  zsh -c /usr/share/
156      2.0   michael         3/9  14:47   0+00:00:00 H  0   0.7  zsh -c /usr/share/
157      3.0   michael         3/9  14:47   0+00:00:01 R  0   0.0  cluster2_sentinel.
158      4.0   michael         3/9  14:47   0+00:00:00 H  0   0.7  zsh -c /usr/share/
159      5.0   michael         3/9  14:47   0+00:00:01 R  0   0.0  cluster4_sentinel.
160      6.0   michael         3/9  14:47   0+00:00:00 H  0   0.7  zsh -c /usr/share/
161      7.0   michael         3/9  14:47   0+00:00:01 R  0   0.0  cluster6_sentinel.
162      8.0   michael         3/9  14:47   0+00:00:00 H  0   0.7  zsh -c /usr/share/
163      9.0   michael         3/9  14:47   0+00:00:01 R  0   0.0  cluster8_sentinel.
164     10.0   michael         3/9  14:47   0+00:00:00 H  0   0.7  zsh -c /usr/share/
165     11.0   michael         3/9  14:47   0+00:00:01 R  0   0.0  cluster10_sentinel
166
167   11 jobs; 0 completed, 0 removed, 0 idle, 6 running, 5 held, 0 suspended
168
169
170 Done
171 ----
172
173 There is obviously much more that could be said about other exciting features
174 of Condor, but we will leave this for another blog post in the future. As a
175 little teaser we could mention that the Debian Condor package comes with an
176 emulator of SGE's ``qsub``. Through this adaptor many software that can make use
177 of SGE can also be used with Condor, for example NiPyPE_...
178
179 .. _NiPyPE: http://nipy.sourceforge.net/nipype/
180
181 If you are now keen on exploring the possibilities of Condor, take a look at the
182 manual that comes in the ``condor-doc`` package.