paulb@22 | 1 | Introduction
|
paulb@22 | 2 | ------------
|
paulb@22 | 3 |
|
paulb@40 | 4 | The pprocess module provides elementary support for parallel programming in
|
paulb@22 | 5 | Python using a fork-based process creation model in conjunction with a
|
paulb@68 | 6 | channel-based communications model implemented using socketpair and poll. On
|
paulb@68 | 7 | systems with multiple CPUs or multicore CPUs, processes should take advantage
|
paulb@68 | 8 | of as many CPUs or cores as the operating system permits.
|
paulb@22 | 9 |
|
paulb@22 | 10 | Quick Start
|
paulb@22 | 11 | -----------
|
paulb@22 | 12 |
|
paulb@100 | 13 | Try running the simple examples:
|
paulb@68 | 14 |
|
paulb@68 | 15 | PYTHONPATH=. python examples/simple.py
|
paulb@100 | 16 | PYTHONPATH=. python examples/simple_create.py
|
paulb@100 | 17 | PYTHONPATH=. python examples/simple_managed.py
|
paulb@100 | 18 | PYTHONPATH=. python examples/simple_map.py
|
paulb@100 | 19 | PYTHONPATH=. python examples/simple_pmap.py
|
paulb@100 | 20 | PYTHONPATH=. python examples/simple_queue.py
|
paulb@68 | 21 |
|
paulb@68 | 22 | (A simple example which shows how a limited number of processes can be used to
|
paulb@100 | 23 | perform a parallel computation. The simple_map.py program is a sequential
|
paulb@100 | 24 | version of the other programs.)
|
paulb@100 | 25 |
|
paulb@100 | 26 | The tutorial provides some information about the examples: docs/tutorial.xhtml
|
paulb@100 | 27 |
|
paulb@100 | 28 | The PyGmy raytracer modified to use pprocess can be run to investigate the
|
paulb@100 | 29 | potential for speed increases:
|
paulb@68 | 30 |
|
paulb@100 | 31 | cd examples/PyGmy
|
paulb@100 | 32 | PYTHONPATH=../..:. python scene.py
|
paulb@100 | 33 |
|
paulb@100 | 34 | (This should produce a file called test.tif - a TIFF file containing a
|
paulb@100 | 35 | raytraced scene image.)
|
paulb@100 | 36 |
|
paulb@100 | 37 | There are some elementary tests:
|
paulb@22 | 38 |
|
paulb@22 | 39 | PYTHONPATH=. python tests/create_loop.py
|
paulb@22 | 40 | PYTHONPATH=. python tests/start_loop.py
|
paulb@22 | 41 |
|
paulb@22 | 42 | (Simple loop demonstrations which use two different ways of creating and
|
paulb@22 | 43 | starting the parallel processes.)
|
paulb@22 | 44 |
|
paulb@36 | 45 | PYTHONPATH=. python tests/start_indexer.py <directory>
|
paulb@22 | 46 |
|
paulb@36 | 47 | (A text indexing demonstration, where <directory> should be a directory
|
paulb@36 | 48 | containing text files to be indexed, although HTML files will also work well
|
paulb@36 | 49 | enough. After indexing the files, a prompt will appear, words or word
|
paulb@36 | 50 | fragments can be entered, and matching words and their locations will be
|
paulb@36 | 51 | shown. Run the program without arguments to see more information.)
|
paulb@22 | 52 |
|
paulb@22 | 53 | Contact, Copyright and Licence Information
|
paulb@22 | 54 | ------------------------------------------
|
paulb@22 | 55 |
|
paulb@22 | 56 | No Web page has yet been made available for this work, but the author can be
|
paulb@22 | 57 | contacted at the following e-mail address:
|
paulb@22 | 58 |
|
paulb@22 | 59 | paul@boddie.org.uk
|
paulb@22 | 60 |
|
paulb@22 | 61 | Copyright and licence information can be found in the docs directory - see
|
paulb@78 | 62 | docs/COPYING.txt, docs/lgpl-3.0.txt and docs/gpl-3.0.txt for more information.
|
paulb@22 | 63 |
|
paulb@48 | 64 | For the PyGmy raytracer example, different copyright and licence information
|
paulb@48 | 65 | is provided in the docs directory - see docs/COPYING-PyGmy.txt and
|
paulb@48 | 66 | docs/LICENCE-PyGmy.txt for more information.
|
paulb@48 | 67 |
|
paulb@22 | 68 | Dependencies
|
paulb@22 | 69 | ------------
|
paulb@22 | 70 |
|
paulb@22 | 71 | This software depends on standard library features which are stated as being
|
paulb@22 | 72 | available only on "UNIX"; it has only been tested on a GNU/Linux system.
|
paulb@22 | 73 |
|
paulb@100 | 74 | New in parallel 0.3 (Changes since parallel 0.2.5)
|
paulb@100 | 75 | --------------------------------------------------
|
paulb@84 | 76 |
|
paulb@84 | 77 | * Added managed callables: wrappers around callables which cause them to be
|
paulb@84 | 78 | automatically managed by the exchange from which they were acquired.
|
paulb@84 | 79 | * Added MakeParallel: a wrapper instantiated around a normal function which
|
paulb@84 | 80 | sends the result of that function over the supplied channel when invoked.
|
paulb@89 | 81 | * Added a Map class which attempts to emulate the built-in map function,
|
paulb@89 | 82 | along with a pmap function using this class.
|
paulb@100 | 83 | * Added a Queue class which provides a simpler iterator-style interface to
|
paulb@100 | 84 | data produced by created processes.
|
paulb@100 | 85 | * Added a create method to the Exchange class and an exit convenience
|
paulb@100 | 86 | function to the module.
|
paulb@100 | 87 | * Changed the Exchange implementation to not block when attempting to start
|
paulb@100 | 88 | new processes beyond the process limit: such requests are queued and
|
paulb@100 | 89 | performed as running processes are completed. This permits programs using
|
paulb@100 | 90 | the start method to proceed to consumption of results more quickly.
|
paulb@84 | 91 | * Extended and updated the examples.
|
paulb@100 | 92 | * Added Ubuntu Feisty (7.04) package support.
|
paulb@84 | 93 |
|
paulb@78 | 94 | New in parallel 0.2.5 (Changes since parallel 0.2.4)
|
paulb@78 | 95 | ----------------------------------------------------
|
paulb@78 | 96 |
|
paulb@78 | 97 | * Added a start method to the Exchange class for more convenient creation of
|
paulb@78 | 98 | processes.
|
paulb@78 | 99 | * Relicensed under the LGPL (version 3 or later) - this also fixes the
|
paulb@78 | 100 | contradictory situation where the GPL was stated in the pprocess module
|
paulb@78 | 101 | (which was not, in fact, the intention) and the LGPL was stated in the
|
paulb@78 | 102 | documentation.
|
paulb@78 | 103 |
|
paulb@73 | 104 | New in parallel 0.2.4 (Changes since parallel 0.2.3)
|
paulb@73 | 105 | ----------------------------------------------------
|
paulb@73 | 106 |
|
paulb@73 | 107 | * Set buffer sizes to zero for the file object wrappers around sockets: this
|
paulb@73 | 108 | may prevent deadlock issues.
|
paulb@73 | 109 |
|
paulb@68 | 110 | New in parallel 0.2.3 (Changes since parallel 0.2.2)
|
paulb@68 | 111 | ----------------------------------------------------
|
paulb@68 | 112 |
|
paulb@68 | 113 | * Added convenient message exchanges, offering methods handling common
|
paulb@68 | 114 | situations at the cost of having to define a subclass of Exchange.
|
paulb@68 | 115 | * Added a simple example of performing a parallel computation.
|
paulb@68 | 116 | * Improved the PyGmy raytracer example to use the newly added functionality.
|
paulb@68 | 117 |
|
paulb@55 | 118 | New in parallel 0.2.2 (Changes since parallel 0.2.1)
|
paulb@55 | 119 | ----------------------------------------------------
|
paulb@55 | 120 |
|
paulb@55 | 121 | * Changed the status testing in the Exchange class, potentially fixing the
|
paulb@55 | 122 | premature closure of channels before all data was read.
|
paulb@55 | 123 | * Fixed the PyGmy raytracer example's process accounting by relying on the
|
paulb@55 | 124 | possibly more reliable Exchange behaviour, whilst also preventing
|
paulb@55 | 125 | erroneous creation of "out of bounds" processes.
|
paulb@58 | 126 | * Added a removed attribute on the Exchange to record which channels were
|
paulb@58 | 127 | removed in the last call to the ready method.
|
paulb@55 | 128 |
|
paulb@48 | 129 | New in parallel 0.2.1 (Changes since parallel 0.2)
|
paulb@48 | 130 | --------------------------------------------------
|
paulb@48 | 131 |
|
paulb@48 | 132 | * Added a PyGmy raytracer example.
|
paulb@53 | 133 | * Updated copyright and licensing details (FSF address, additional works).
|
paulb@48 | 134 |
|
paulb@40 | 135 | New in parallel 0.2 (Changes since parallel 0.1)
|
paulb@40 | 136 | ------------------------------------------------
|
paulb@40 | 137 |
|
paulb@40 | 138 | * Changed the name of the included module from parallel to pprocess in order
|
paulb@40 | 139 | to avoid naming conflicts with PyParallel.
|
paulb@40 | 140 |
|
paulb@22 | 141 | Release Procedures
|
paulb@22 | 142 | ------------------
|
paulb@22 | 143 |
|
paulb@40 | 144 | Update the pprocess __version__ attribute.
|
paulb@22 | 145 | Change the version number and package filename/directory in the documentation.
|
paulb@22 | 146 | Update the release notes (see above).
|
paulb@22 | 147 | Check the release information in the PKG-INFO file.
|
paulb@22 | 148 | Tag, export.
|
paulb@22 | 149 | Archive, upload.
|
paulb@68 | 150 | Update PyPI.
|
paulb@26 | 151 |
|
paulb@26 | 152 | Making Packages
|
paulb@26 | 153 | ---------------
|
paulb@26 | 154 |
|
paulb@44 | 155 | To make Debian-based packages:
|
paulb@26 | 156 |
|
paulb@44 | 157 | 1. Create new package directories under packages if necessary.
|
paulb@26 | 158 | 2. Make a symbolic link in the distribution's root directory to keep the
|
paulb@26 | 159 | Debian tools happy:
|
paulb@26 | 160 |
|
paulb@44 | 161 | ln -s packages/ubuntu-hoary/python2.4-parallel-pprocess/debian/
|
paulb@26 | 162 |
|
paulb@100 | 163 | Or:
|
paulb@100 | 164 |
|
paulb@100 | 165 | ln -s packages/ubuntu-feisty/python-pprocess/debian/
|
paulb@100 | 166 |
|
paulb@26 | 167 | 3. Run the package builder:
|
paulb@26 | 168 |
|
paulb@26 | 169 | dpkg-buildpackage -rfakeroot
|
paulb@26 | 170 |
|
paulb@26 | 171 | 4. Locate and tidy up the packages in the parent directory of the
|
paulb@26 | 172 | distribution's root directory.
|