mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / pysawsim-manager.mdwn
1 [[!meta  title="pysawsim.manager: parallelization-framework-agnostic testing"]]
2 [[!template id=gitrepo repo=sawsim]]
3
4 Over the past week I've been working up a [[Python]] framework for my
5 [[sawsim]] simulator, to allow parallel execution on a variety of
6 systems.  I think I've got the kinks worked out now, and `sawsim` (or
7 anything else that can subclass `pysawsim.manager.Job` can now be
8 transparently executed in parallel using any of
9
10 * Python's [threading][] module (the `thread` manager).
11 * Python's [multiprocessing][] module (the `subproc` manager).
12 * [[MPI]] (via [mpi4py][], the `mpi` manager).
13 * [[PBS]] (via [pbs_python][], the `pbs` manager).
14
15 Most of the difficulty is in handling systems where not all of these
16 approaches are viable, (e.g. Python 2.5, so no `multiprocessing`
17 module, or an SMP host that wants to use `subproc` without installing
18 mpi4py or pbs_python).  I also ran up against Python's [issue5155][]
19 when I tried to test the `subproc` manager from within a:
20
21     $ nosetests --with-doctest --doctest-tests --processes $N pysawsim
22
23 on a Python 2.6.2 system (it was fixed by 2.6.3).
24
25 Note that Python's [GIL restricts threads to a single core][GIL].  This
26 means that the `thread` manager is basically decorative, but I wrote
27 it anyway because it forms the basis of several other managers, and
28 it's the only manager that will definitely work on Python 2.5.
29
30 [threading]: http://docs.python.org/library/threading.html
31 [multiprocessing]: http://docs.python.org/library/multiprocessing.html
32 [mpi4py]: http://mpi4py.scipy.org/
33 [pbs_python]: https://subtrac.sara.nl/oss/pbs_python
34 [issue5155]: http://bugs.python.org/issue5155
35 [GIL]: http://docs.python.org/faq/library#can-t-we-get-rid-of-the-global-interpreter-lock
36
37
38 [[!tag tags/programming]]
39 [[!tag tags/python]]
40 [[!tag tags/sawsim]]