1
==================================
2
IPython/Vision Beam Pattern Demo
3
==================================
6
Installing and testing IPython at OSC systems
7
=============================================
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,
15
tar xzf (or xjf if it's bz2) filename.tar.{gz,bz2}
17
and then installed them (including IPython itself) with::
19
cd dirname/ # path to unpacked tarball
20
python setup.py install --prefix=~/usr/local/
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.
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
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
37
- pyopenssl, security layer used by foolscap. Note: version 0.7 *must* be
39
http://sourceforge.net/projects/pyopenssl/
40
http://downloads.sourceforge.net/pyopenssl/pyOpenSSL-0.6.tar.gz?modtime=1212595285&big_mirror=0
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
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
53
http://ipython.scipy.org/
54
http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz
57
I then ran the ipython test suite via::
61
and it passed with only::
63
======================================================================
64
ERROR: testGetResult_2
65
----------------------------------------------------------------------
66
DirtyReactorAggregateError: Reactor was unclean.
68
<Negotiation #0 on 10105>
70
----------------------------------------------------------------------
71
Ran 419 tests in 33.971s
73
FAILED (SKIP=4, errors=1)
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).
81
Next, I started an 8-engine cluster via::
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-*
89
Your cluster is up and running.
93
and in a separate ipython session checked that the cluster is running and I can
94
access all the engines::
96
In [1]: from IPython.kernel import client
98
In [2]: mec = client.MultiEngineClient()
100
In [3]: mec.get_ids()
101
Out[3]: [0, 1, 2, 3, 4, 5, 6, 7]
103
and run trivial code in them (after importing the ``random`` module in all
106
In [11]: mec.execute("x=random.randint(0,10)")
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)
118
In [12]: mec.pull('x')
119
Out[12]: [10, 0, 8, 10, 2, 9, 10, 7]
122
We'll continue conducting more complex tests later, including instaling Vision
123
locally and running the beam demo.
126
Michel's original instructions
127
==============================
129
I got a Vision network that reproduces the beam pattern demo working:
131
.. image:: vision_beam_pattern.png
133
:target: vision_beam_pattern.png
137
I created a package called beamPattern that provides the function run() in its
140
A subpackage beamPattern/VisionInterface provides Vision nodes for:
142
- computing Elevation and Azimuth from a 3D vector
146
- taking the results gathered from the engines and creating the output that a
147
single engine would have had produced
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.
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)
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.
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
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)
175
- inflate beamPattern into the site-packages directory for the MGL tools.
177
- place the appended IPythonNodes.py and StandardNodes.py into the Vision
178
package of the MGL tools.
180
- place the appended items.py in the NetworkEditor package of the MGL tools
182
- run vision for the network beamPat5_net.py::
184
vision beamPat5_net.py
186
Once the network is running, you can:
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
192
- click on the yellow lighting bold to run the network.
194
- Try modifying the MAT file or change the Vector used top compute elevation
201
- I had to install IPython and all its dependencies for the python used by the
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::
207
python setup.py install --prefix=~/usr/opt/mgl
213
The following PBS script can be used to start the engines::
215
#PBS -N bgranger-ipython
217
#PBS -l walltime=00:10:00
218
#PBS -l nodes=4:ppn=4
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
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::
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.
236
You might need to set up an SSH tunnel, however; if this doesn't work as
239
ssh -L 10115:localhost:10105 bic
242
Links to other resources
243
========================
245
- http://www.osc.edu/~unpingco/glenn_NewLynx2_Demo.avi