1 | ------------------------------------------------ |
---|
2 | PyPAR - Parallel Python, efficient and scalable |
---|
3 | parallelism using the message passing interface (MPI). |
---|
4 | |
---|
5 | Author: Ole Nielsen (2001, 2002, 2003) |
---|
6 | Email: Ole.Nielsen@anu.edu.au |
---|
7 | Version: See pypar.__version__ |
---|
8 | Date: See pypar.__date__ |
---|
9 | |
---|
10 | Major contributions by |
---|
11 | Gian Paolo Ciceri (gp.ciceri@acm.org) |
---|
12 | Prabhu Ramachandran (prabhu@aero.iitm.ernet.in) |
---|
13 | |
---|
14 | Minor but important contributions by |
---|
15 | Doug Orr (doug@arbor.net) |
---|
16 | Michal Kaukic (mike@frcatel.fri.utc.sk) |
---|
17 | |
---|
18 | ------------------------------------------------ |
---|
19 | |
---|
20 | The python module pypar.py and the C-extension mpi.c |
---|
21 | implements scalable parallelism on distributed and shared |
---|
22 | memory architectures using the essential subset of |
---|
23 | the Message Passing Interface (MPI) standard. |
---|
24 | |
---|
25 | FEATURES |
---|
26 | |
---|
27 | - Python interpreter is not modified: |
---|
28 | Parallel python programs need only import the pypar module. |
---|
29 | |
---|
30 | - Easy installation: This is essentially about compiling and linking |
---|
31 | the C-extension with the local MPI installation. A distutils setup file |
---|
32 | is included. |
---|
33 | |
---|
34 | - Flexibility: Pypar allows communication of general Python objects |
---|
35 | of any type. |
---|
36 | |
---|
37 | - Intuitive API: |
---|
38 | The user need only specify what to send and to which processor. |
---|
39 | Pypar takes care of details about |
---|
40 | data types and MPI specifics such as tags, communicators and buffers. |
---|
41 | Receiving is analogous. |
---|
42 | |
---|
43 | - Efficiency: |
---|
44 | Full bandwidth of C-MPI programs is achieved for consecutive Numerical |
---|
45 | arrays. Latency is less than twice that of pure C-MPI programs. |
---|
46 | Test programs to verify this are included (pytiming, ctiming.c) |
---|
47 | |
---|
48 | - Lightweight: |
---|
49 | Pypar consists of just two files: mpiext.c and pypar.py |
---|
50 | |
---|
51 | See the DOC file for instructions on how to program with pypar. |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | PRE-REQUISITES (on all nodes) |
---|
56 | |
---|
57 | Python 2.0 or later |
---|
58 | Numeric Python (incl RandomArray) matching the Python installation |
---|
59 | Native MPI C library |
---|
60 | Native C compiler |
---|
61 | |
---|
62 | Pypar has been tested on the following platforms |
---|
63 | MPI on DEC Alpha |
---|
64 | LAM/MPI (6.5.6, 7.0) on Linux (Debian Woody/Cid and Red Hat 7.1) |
---|
65 | MPICH and LAM 7.0 on Solaris (Sun Enterprise) |
---|
66 | MPICH on Linux |
---|
67 | MPICH on Windows (NT/2000). |
---|
68 | |
---|
69 | |
---|
70 | INSTALL |
---|
71 | |
---|
72 | UNIX PLATFORMS |
---|
73 | Type |
---|
74 | python setup.py install |
---|
75 | |
---|
76 | This should install pypar and its extension in the default |
---|
77 | site-packages directory on your system. |
---|
78 | |
---|
79 | If you wish to install it in your home directory use |
---|
80 | |
---|
81 | python setup.py install --prefix=~ |
---|
82 | |
---|
83 | WINDOWS (NT/2000, MPICH) |
---|
84 | To build, you need: |
---|
85 | 1) MPICH (http://www-unix.mcs.anl.gov/mpi/mpich/) |
---|
86 | 2) MinGW (http://www.mingw.org). Tested with GCC v 2.95-3.6. |
---|
87 | 3) Set MPICH_DIR to the appropriate directory |
---|
88 | 4) Build using 'python setup.py build --compiler=mingw32' |
---|
89 | 5) Install using 'python setup.py install'. |
---|
90 | |
---|
91 | --- |
---|
92 | If you encountered any installation problems, read on. |
---|
93 | Do not worry about messages about unresolved symbols. This is normal |
---|
94 | for shared libraries on some machines. |
---|
95 | |
---|
96 | To compile C-extension mpi.c requires either a mpi-aware c compiler |
---|
97 | such as mpicc or a standard c compiler with mpi libraries linked in. |
---|
98 | See local MPI installation for details, possibly edit Makefile and |
---|
99 | type make. |
---|
100 | See installation notes below about compiling under mpi. |
---|
101 | |
---|
102 | |
---|
103 | TESTING |
---|
104 | Pypar comes with a number of tests and demos available in the |
---|
105 | examples directory - please try these to verify the installation. |
---|
106 | |
---|
107 | |
---|
108 | RUNNING PYTHON MPI JOBS |
---|
109 | |
---|
110 | Pypar runs in exactly the same way as MPI programs written in |
---|
111 | C or Fortran. |
---|
112 | |
---|
113 | E.g. to run the enclosed demo script (demo.py) on 4 processors, |
---|
114 | enter a command similar to |
---|
115 | |
---|
116 | mpirun -np 4 python demo.py |
---|
117 | |
---|
118 | Consult your MPI distribution for exact syntax of mpirun. |
---|
119 | Sometimes it is called prun and often parallel jobs will be |
---|
120 | submitted in batch mode. |
---|
121 | |
---|
122 | You can also execute demo.py as a stand-alone executable python script |
---|
123 | |
---|
124 | mpirun -np 4 demo.py |
---|
125 | |
---|
126 | |
---|
127 | Enclosed is a script to estimate the communication speed of your system. |
---|
128 | Execute |
---|
129 | |
---|
130 | mpirun -np 4 pytiming |
---|
131 | |
---|
132 | Care has been taken in pypar to achieve the same bandwidth and almost as |
---|
133 | good communication latency as corresponding C/MPI programs. |
---|
134 | Please compile and run ctiming.c to see the reference values: |
---|
135 | |
---|
136 | make ctiming |
---|
137 | mpirun -np 4 ctiming |
---|
138 | |
---|
139 | Note that timings might fluctuate from run to run due to variable |
---|
140 | system load. |
---|
141 | |
---|
142 | An example of a master-slave program using pypar is available in demo2.py. |
---|
143 | |
---|
144 | |
---|
145 | INSTALLATION NOTES (If all else fails) |
---|
146 | |
---|
147 | Most MPI implementations provide a script or an executable called |
---|
148 | "mpicc" which compiles C programs using MPI and does |
---|
149 | not require any explicitly mentioned libraries. |
---|
150 | If such a script exists, but with a different name, change |
---|
151 | the name in the beginning of compile.py. If no such script exists, put |
---|
152 | the name of your C compiler in that place and add all required linking |
---|
153 | options yourself. |
---|
154 | |
---|
155 | For example, on an Alpha server it would look something like |
---|
156 | |
---|
157 | cc -c mpi.c -I/opt/Python-2.1/include/python2.1/ |
---|
158 | cc -shared mpi.o -o mpi.so -lmpi -lelan |
---|
159 | |
---|
160 | or using the wrapper |
---|
161 | |
---|
162 | mpicc -c mpi.c -I/opt/Python-2.1/include/python2.1/ |
---|
163 | mpicc -shared mpi.o -o mpi.so |
---|
164 | |
---|
165 | On Linux (using LAM-MPI) it is |
---|
166 | |
---|
167 | mpicc -c mpi.c -I/opt/Python-2.1/include/python2.1/ |
---|
168 | mpicc -shared mpi.o -o mpi.so |
---|
169 | |
---|
170 | Start processors using |
---|
171 | lamboot -v lamhosts |
---|
172 | |
---|
173 | DOCUMENTATION |
---|
174 | |
---|
175 | See the file DOC for an introduction to pypar. |
---|
176 | See also examples demo.py and pytiming |
---|
177 | as well as documentation in pypar.py. |
---|
178 | |
---|
179 | |
---|
180 | HISTORY |
---|
181 | version 1.9.1 (15 Dec 2003) |
---|
182 | Consistent naming (all lower case, no abbreviations) |
---|
183 | version 1.9 (3 Dec 2003) |
---|
184 | Obsoleted raw forms of communication as they were confusing. |
---|
185 | The semantics of send, receive, scatter, gather etc is now that |
---|
186 | one can optionally specify a buffer to use if desired. |
---|
187 | Bypass forms added. |
---|
188 | |
---|
189 | version 1.8.2 (16 November 2003) |
---|
190 | Fixed scatter, gather and reduce calls to automatically |
---|
191 | figure out buffer lengths. Also tested scatter and gather for |
---|
192 | complex and multidimensional data. |
---|
193 | version 1.8.1 (13 November 2003) |
---|
194 | Added direct support (i.e. not using the vanilla protocol) |
---|
195 | for multidimensional Numeric arrays of type Complex. |
---|
196 | version 1.8 (11 November 2003) |
---|
197 | Changed status object to be (optionally) returned from receive and |
---|
198 | raw_receive rather maintaining a global state where one instance of |
---|
199 | the status object is modified. |
---|
200 | This was suggested by the audience at presentation at Department of |
---|
201 | Computer Science, Australian National University, 18 June 2003. |
---|
202 | |
---|
203 | version 1.7 (7 November 2003) |
---|
204 | Added support for Numerical arrays of arbitrary dimension |
---|
205 | in send, receive and bcast. |
---|
206 | The need for this obvious functionality was pointed by Michal Kaukic. |
---|
207 | |
---|
208 | version 1.6.5 (30 August 2003) |
---|
209 | Added NULL commandline argument as required by LAM 7.0 and |
---|
210 | identified by Doug Orr and Dave Reed. |
---|
211 | version 1.6.4 (10 Jan 2003) |
---|
212 | Comments and review of installation |
---|
213 | version 1.6.3 (10 Jan 2003) |
---|
214 | Minor issues and clean-up |
---|
215 | version 1.6.2 (29 Oct 2002) |
---|
216 | Added Windows platform to installation as contributed by |
---|
217 | Simon Frost |
---|
218 | version 1.6.0 (18 Oct 2002) |
---|
219 | Changed installation to distutils as contributed by |
---|
220 | Prabhu Ramachandran |
---|
221 | |
---|
222 | version 1.5 (30 April 2002) |
---|
223 | Got pypar to work with MPICH/Linux and cleaned up initialisation |
---|
224 | version 1.4 (4 March 2002) |
---|
225 | Fixed-up and ran testpypar on 22 processors on Sun |
---|
226 | version 1.3 (21 February 2002) |
---|
227 | Added gather and reduce fixed up testpypar.py |
---|
228 | |
---|
229 | version 1.2.2, 1.2.3 (17 February 2002) |
---|
230 | Minor fixes in distribution |
---|
231 | version 1.2.1 (16 February 2002) |
---|
232 | Status block, MPI_ANY_TAG, MPI_ANY_SOURCE exported |
---|
233 | Version 1.2 (15 February 2002) |
---|
234 | Scatter added by Gian Paolo Ciceri |
---|
235 | Version 1.1 (14 February 2002) |
---|
236 | Bcast added by Gian Paolo Ciceri |
---|
237 | Version 1.0.2 (10 February 2002) |
---|
238 | Modified by Gian Paulo Ciceri to allow pypar run under Python 2.2 |
---|
239 | Version 1.0.1 (8 February 2002) |
---|
240 | Modified to install on SUN enterprise systems under Mpich |
---|
241 | Version 1.0 (7 February 2002) |
---|
242 | First public release for Python 2.1 (OMN) |
---|
243 | |
---|
244 | TODO |
---|
245 | max_tag is set to 32767. This works for Linux/LAM |
---|
246 | I couldn't use MPI_TAG_UB as it returned 0. |
---|
247 | I would like a general solution. |
---|
248 | |
---|
249 | |
---|
250 | Scatter needs to send buffer specified on all processes |
---|
251 | even though it is ignored by all non-root processes. |
---|
252 | How could we overcome that? |
---|
253 | Similar problem for gather |
---|
254 | |
---|
255 | Gather an scatter: One should be able to specify along which axis |
---|
256 | arrays should be concatenated. |
---|
257 | |
---|
258 | |
---|
259 | KNOWN BUGS |
---|
260 | Scatter for the moment works only properly when the amount of data is a |
---|
261 | multiple of the number of processors (as does the underlying MPI_Scatter). |
---|
262 | I am working on a more general scatter (and gather) which will |
---|
263 | distribute data as evenly as possible for all amounts of data. |
---|
264 | |
---|
265 | |
---|
266 | LICENSE |
---|
267 | This program is free software; you can redistribute it and/or modify |
---|
268 | it under the terms of the GNU General Public License as published by |
---|
269 | the Free Software Foundation; either version 2 of the License, or |
---|
270 | (at your option) any later version. |
---|
271 | |
---|
272 | This program is distributed in the hope that it will be useful, |
---|
273 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
274 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
275 | GNU General Public License (http://www.gnu.org/copyleft/gpl.html) |
---|
276 | for more details. |
---|
277 | |
---|
278 | You should have received a copy of the GNU General Public License |
---|
279 | along with this program; if not, write to the Free Software |
---|
280 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
281 | |
---|
282 | |
---|
283 | Contact address: Ole.Nielsen@anu.edu.au |
---|
284 | |
---|
285 | ============================================================================= |
---|
286 | |
---|
287 | ACKNOWLEDGEMENTS |
---|
288 | This work was supported by School of Mathematical Sciences at |
---|
289 | the Australian National University and funded by Australian |
---|
290 | Partnership for Advanced Computing (APAC). |
---|
291 | Many thanks go to |
---|
292 | |
---|
293 | Gian Paolo Ciceri (gp.ciceri@acm.org) |
---|
294 | for fixing pypar to run under Python 2.2 and for adding all the |
---|
295 | collective communication stuff from version 1.1 and onwards. |
---|
296 | Prabhu Ramachandran (prabhu@aero.iitm.ernet.in) |
---|
297 | for making a proper distutils installation procedure |
---|
298 | Simon D. W. Frost (sdfrost@ucsd.edu) |
---|
299 | for testing pypar under Windows and adding installation procedure |
---|
300 | Jakob Schiotz (schiotz@fysik.dtu.dk) and Steven Farcy (steven@artabel.net) |
---|
301 | for pointing out initial problems with pypar and MPICH. |
---|
302 | Markus Hegland (Markus.Hegland@anu.edu.au) |
---|
303 | for supporting the work. |
---|
304 | Doug Orr (doug@arbor.net) |
---|
305 | for identifying and fixing problem with LAM 7.0 requiring |
---|
306 | last commandline argumnet to be NULL. |
---|
307 | Dave Reed (dreed@capital.edu) |
---|
308 | for pointing out problem with LAM 7.0 and for testing the fix. |
---|
309 | Matthew Wakefield (matthew.wakefield@anu.edu.au) |
---|
310 | for pointing out and fixing support for Mac OS X (darwin) |
---|
311 | David Brown (David.L.Brown@kla-tencor.com) |
---|
312 | for contributing to the Windows/Cygwin installation procedure |
---|
313 | Michal Kaukic (mike@frcatel.fri.utc.sk) |
---|
314 | for pointing out the need for multi dimensional arrays and |
---|
315 | for suggesting an implementation in the 2D case. |
---|
316 | |
---|
317 | |
---|
318 | |
---|
319 | |
---|
320 | |
---|
321 | |
---|
322 | |
---|
323 | |
---|
324 | |
---|
325 | |
---|
326 | |
---|
327 | |
---|
328 | |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | |
---|