~ellisonbg/ipython/trunk-dev

« back to all changes in this revision

Viewing changes to docs/source/parallel/visionhpc.txt

  • Committer: Brian Granger
  • Date: 2010-01-31 23:57:46 UTC
  • mfrom: (1109.1.113 ipython)
  • Revision ID: ellisonbg@gmail.com-20100131235746-rj81qa8klooepq2m
Merging from upstream trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
==================================
2
 
 IPython/Vision Beam Pattern Demo
3
 
==================================
4
 
 
5
 
 
6
 
Installing and testing IPython at OSC systems
7
 
=============================================
8
 
 
9
 
All components were installed from source and I have my environment set up to
10
 
include ~/usr/local in my various necessary paths ($PATH, $PYTHONPATH, etc).
11
 
Other than a slow filesystem for unpacking tarballs, the install went without a
12
 
hitch.  For each needed component, I just downloaded the source tarball,
13
 
unpacked it via::
14
 
 
15
 
  tar xzf (or xjf if it's bz2) filename.tar.{gz,bz2}
16
 
 
17
 
and then installed them (including IPython itself) with::
18
 
 
19
 
  cd dirname/  # path to unpacked tarball
20
 
  python setup.py install --prefix=~/usr/local/
21
 
 
22
 
The components I installed are listed below.  For each one I give the main
23
 
project link as well as a direct one to the file I actually dowloaded and used.
24
 
 
25
 
- nose, used for testing:
26
 
http://somethingaboutorange.com/mrl/projects/nose/
27
 
http://somethingaboutorange.com/mrl/projects/nose/nose-0.10.3.tar.gz
28
 
 
29
 
- Zope interface, used to declare interfaces in twisted and ipython.  Note:
30
 
you must get this from the page linked below and not fro the defaul
31
 
one(http://www.zope.org/Products/ZopeInterface) because the latter has an
32
 
older version, it hasn't been updated in a long time.  This pypi link has
33
 
the current release (3.4.1 as of this writing):
34
 
http://pypi.python.org/pypi/zope.interface
35
 
http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.4.1.tar.gz
36
 
 
37
 
- pyopenssl, security layer used by foolscap.  Note: version 0.7 *must* be
38
 
used: 
39
 
http://sourceforge.net/projects/pyopenssl/
40
 
http://downloads.sourceforge.net/pyopenssl/pyOpenSSL-0.6.tar.gz?modtime=1212595285&big_mirror=0
41
 
 
42
 
 
43
 
- Twisted, used for all networking:
44
 
http://twistedmatrix.com/trac/wiki/Downloads
45
 
http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2
46
 
 
47
 
- Foolscap, used for managing connections securely:
48
 
http://foolscap.lothar.com/trac
49
 
http://foolscap.lothar.com/releases/foolscap-0.3.1.tar.gz
50
 
 
51
 
 
52
 
- IPython itself:
53
 
http://ipython.scipy.org/
54
 
http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz
55
 
 
56
 
 
57
 
I then ran the ipython test suite via::
58
 
 
59
 
  iptest -vv
60
 
 
61
 
and it passed with only::
62
 
 
63
 
    ======================================================================
64
 
    ERROR: testGetResult_2
65
 
    ----------------------------------------------------------------------
66
 
    DirtyReactorAggregateError: Reactor was unclean.
67
 
    Selectables:
68
 
    <Negotiation #0 on 10105>
69
 
 
70
 
    ----------------------------------------------------------------------
71
 
    Ran 419 tests in 33.971s
72
 
 
73
 
    FAILED (SKIP=4, errors=1)
74
 
 
75
 
In three more runs of the test suite I was able to reproduce this error
76
 
sometimes but not always; for now I think we can move on but we need to
77
 
investigate further.  Especially if we start seeing problems in real use (the
78
 
test suite stresses the networking layer in particular ways that aren't
79
 
necessarily typical of normal use).
80
 
 
81
 
Next, I started an 8-engine cluster via::
82
 
 
83
 
    perez@opt-login01[~]> ipcluster -n 8
84
 
    Starting controller: Controller PID: 30845
85
 
    ^X      Starting engines:    Engines PIDs:   [30846, 30847, 30848, 30849,
86
 
    30850, 30851, 30852, 30853]
87
 
    Log files: /home/perez/.ipython/log/ipcluster-30845-*
88
 
 
89
 
    Your cluster is up and running.
90
 
 
91
 
    [... etc]
92
 
 
93
 
and in a separate ipython session checked that the cluster is running and I can
94
 
access all the engines::
95
 
 
96
 
    In [1]: from IPython.kernel import client
97
 
 
98
 
    In [2]: mec = client.MultiEngineClient()
99
 
 
100
 
    In [3]: mec.get_ids()
101
 
    Out[3]: [0, 1, 2, 3, 4, 5, 6, 7]
102
 
 
103
 
and run trivial code in them (after importing the ``random`` module in all
104
 
engines)::
105
 
 
106
 
    In [11]: mec.execute("x=random.randint(0,10)")
107
 
    Out[11]:
108
 
    <Results List>
109
 
    [0] In [3]: x=random.randint(0,10)
110
 
    [1] In [3]: x=random.randint(0,10)
111
 
    [2] In [3]: x=random.randint(0,10)
112
 
    [3] In [3]: x=random.randint(0,10)
113
 
    [4] In [3]: x=random.randint(0,10)
114
 
    [5] In [3]: x=random.randint(0,10)
115
 
    [6] In [3]: x=random.randint(0,10)
116
 
    [7] In [3]: x=random.randint(0,10)
117
 
 
118
 
    In [12]: mec.pull('x')
119
 
    Out[12]: [10, 0, 8, 10, 2, 9, 10, 7]
120
 
 
121
 
 
122
 
We'll continue conducting more complex tests later, including instaling Vision
123
 
locally and running the beam demo.
124
 
 
125
 
 
126
 
Michel's original instructions
127
 
==============================
128
 
 
129
 
I got a Vision network that reproduces the beam pattern demo working:
130
 
 
131
 
.. image:: vision_beam_pattern.png
132
 
   :width: 400
133
 
   :target: vision_beam_pattern.png
134
 
   :align: center
135
 
 
136
 
 
137
 
I created a package called beamPattern that provides the function run() in its
138
 
__init__.py file.
139
 
 
140
 
A subpackage beamPattern/VisionInterface provides Vision nodes for:
141
 
 
142
 
- computing Elevation and Azimuth from a 3D vector
143
 
 
144
 
- Reading .mat files
145
 
 
146
 
- taking the results gathered from the engines and creating the output that a
147
 
  single engine would have had produced
148
 
 
149
 
The Mec node connect to a controller. In my network it was local but an furl
150
 
can be specified to connect to a remote controller.
151
 
 
152
 
The PRun Func node is from the IPython library of nodes. the import statement
153
 
is used to get the run function from the beamPattern package and bu puting
154
 
"run" in the function entry of this node we push this function to the engines.
155
 
In addition to the node will create input ports for all arguments of the
156
 
function being pushed (i.e. the run function)
157
 
 
158
 
The second input port on PRun Fun take an integer specifying the rank of the
159
 
argument we want to scatter. All other arguments will be pushed to the engines.
160
 
 
161
 
The ElevAzim node has a 3D vector widget and computes the El And Az values
162
 
which are passed into the PRun Fun node through the ports created
163
 
automatically. The Mat node allows to select the .mat file, reads it and passed
164
 
the data to the locdata port created automatically on PRun Func
165
 
 
166
 
The calculation is executed in parallel, and the results are gathered and
167
 
output.  Instead of having a list of 3 vectors we nd up with a list of n*3
168
 
vectors where n is the number of engines. unpackDectorResults will turn it into
169
 
a list of 3. We then plot x, y, and 10*log10(z)
170
 
 
171
 
 
172
 
Installation
173
 
------------
174
 
 
175
 
- inflate beamPattern into the site-packages directory for the MGL tools.
176
 
 
177
 
- place the appended IPythonNodes.py and StandardNodes.py into the Vision
178
 
  package of the MGL tools.
179
 
 
180
 
- place the appended items.py in the NetworkEditor package of the MGL tools
181
 
 
182
 
- run vision for the network beamPat5_net.py::
183
 
 
184
 
    vision beamPat5_net.py
185
 
 
186
 
Once the network is running, you can:
187
 
 
188
 
- double click on the MEC node and either use an emptty string for the furl to
189
 
  connect to a local engine or cut and paste the furl to the engine you want to
190
 
  use
191
 
 
192
 
- click on the yellow lighting bold to run the network.
193
 
 
194
 
- Try modifying the MAT file or change the Vector used top compute elevation
195
 
  and Azimut.
196
 
  
197
 
 
198
 
Fernando's notes
199
 
================
200
 
 
201
 
- I had to install IPython and all its dependencies for the python used by the
202
 
  MGL tools.
203
 
 
204
 
- Then I had to install scipy 0.6.0 for it, since the nodes needed Scipy.  To
205
 
  do this I sourced the mglenv.sh script and then ran::
206
 
 
207
 
    python setup.py install --prefix=~/usr/opt/mgl
208
 
 
209
 
 
210
 
Using PBS
211
 
=========
212
 
 
213
 
The following PBS script can be used to start the engines::
214
 
 
215
 
    #PBS -N bgranger-ipython
216
 
    #PBS -j oe
217
 
    #PBS -l walltime=00:10:00
218
 
    #PBS -l nodes=4:ppn=4
219
 
 
220
 
    cd $PBS_O_WORKDIR
221
 
    export PATH=$HOME/usr/local/bin
222
 
    export PYTHONPATH=$HOME/usr/local/lib/python2.4/site-packages
223
 
    /usr/local/bin/mpiexec -n 16 ipengine
224
 
 
225
 
 
226
 
If this file is called ``ipython_pbs.sh``, then the in one login windows
227
 
(i.e. on the head-node -- ``opt-login01.osc.edu``), run ``ipcontroller``. In
228
 
another login window on the same node, run the above script::
229
 
 
230
 
    qsub ipython_pbs.sh
231
 
 
232
 
If you look at the first window, you will see some diagnostic output
233
 
from ipcontroller. You can then get the furl from your own
234
 
``~/.ipython/security`` directory and then connect to it remotely.
235
 
 
236
 
You might need to set up an SSH tunnel, however; if this doesn't work as
237
 
advertised::
238
 
 
239
 
    ssh -L 10115:localhost:10105 bic
240
 
 
241
 
 
242
 
Links to other resources
243
 
========================
244
 
 
245
 
- http://www.osc.edu/~unpingco/glenn_NewLynx2_Demo.avi
246