Debian Codegraph @

README

raw
1 THE MIDDLEMAN PROJECT
2 =====================
3
4 Homepage http://mdm.berlios.de/
5 Project Summary: http://developer.berlios.de/projects/mdm/
6 Code Repository: http://hg.berlios.de/repos/mdm
7 Forums: http://developer.berlios.de/forum/?group_id=10680
8 Bug Tracker: http://developer.berlios.de/bugs/?group_id=10680
9
10
11 ABOUT THE PROJECT
12 =================
13
14 The Middleman Project (mdm) aims to create utility programs that unleash
15 the power of multi-processor and multi-core computer systems. It does
16 so by helping you parallelize your shell scripts, Makefiles, or any
17 other program that invoke external programs.
18
19
20 SOFTWARE REQUIREMENTS
21 =====================
22
23 To run mdm, you need a modern (2.6+) Linux system, GNU screen and the
24 ncurses library. It should be easy to port to other Unix systems by
25 writing new /proc parsers and fixing some library incompatibilities.
26
27
28 BUILDING AND INSTALLING MDM
29 ===========================
30
31 To build mdm, simply run "make" at the toplevel. This project is simple
32 enough so that there is no need for autoconf and automake. To install,
33 use "make install" as follows:
34
35 $ make install PREFIX=/install/directory/prefix
36
37 Without the PREFIX override, "make install" installs mdm to /usr/local.
38
39
40 HOW DOES IT WORK?
41 =================
42
43 The philosophy behind mdm is that users should benefit from their
44 multi-core systems without making drastic changes to their shell
45 scripts. With mdm, you annotate your scripts to specify which commands
46 might benefit from parallelization, and then you run it under the
47 supervision of the mdm system. At runtime, the mdm system dynamically
48 discovers parallelization opportunities and run the annotated commands
49 in parallel as appropriate.
50
51
52 MDM IN 3 EASY STEPS
53 ===================
54
55 Suppose you use the following shell script (encode.sh) for encoding your
56 music library. It works, but it leaves your quad-core computer mostly
57 idle because it processes only one file at a time.
58
59 #!/bin/bash
60 for i in */*.wav
61 do echo $i
62 ffmpeg -i "$i" "${i%%.wav}.mp3"
63 done
64
65 You can parallelize this shell script in three easy steps.
66
67 1. Find commands that you think are suitable for parallel execution,
68 and annotate them with mdm-run. Here is the modified encode.sh:
69
70 #!/bin/bash
71 for i in *.wav
72 do echo $i
73 mdm-run ffmpeg -i "$i" "${i%%.wav}.mp3"
74 done
75
76 2. Specify the I/O behavior of your parallel commands in an iospec
77 file. You know ffmpeg reads from its -i option argument and writes
78 to its command argument (w/o option), so this is what you write in
79 your iospec file:
80
81 ffmpeg R-i W
82
83 You can skip this step if you are certain the parallel command
84 cannot interfere with any other command in the script.
85
86 3. Run the script under mdm.screen as follows:
87
88 $ mdm.screen -c iospec encode.sh
89
90 You should see a monitoring program (mdm-top) displaying the
91 execution status of your parallel commands, and the encoding process
92 should (hopefully) complete a lot sooner because you are giving all
93 processing cores a good workout!
94
95
96 WHEN NOT TO ANNOTATE WITH MDM-RUN
97 =================================
98
99 There are a few cases where you should not annotate a command with
100 mdm-run. They are:
101
102 1. The command is a shell built-in,
103
104 2. You need to know the exit status of the command, or
105
106 3. You perform I/O redirection on the command
107
108
109 THE I/O SPECIFICATION FILE
110 ==========================
111
112 The I/O specification file (iospec) specifies the I/O behavior of
113 programs. The mdm system use these specifications to decide whether it
114 is okay to run two annotated commands at the same time. Each line of
115 the file describes a program. Here are a few examples:
116
117 ffmpeg R-i W
118 rm W
119 cc W-o 0-c Rbusy R
120 date Wbusy
121
122 In plain English:
123
124 * ffmpeg reads from the option argument of -i and writes to all its
125 non-option arguments,
126
127 * rm writes to all its non-option arguments,
128
129 * cc writes to its -o argument, -c takes no arguments, reads from the
130 (abstract) file "busy" and from its non-option arguments, and
131
132 * date writes to the (abstract) file "busy".
133
134 Adding the abstract file "busy" to the iospec ensures that mdm will
135 never schedule the date command to run when any "cc" command is still
136 running (and vice versa).
137
138 Beware that the iospec format is subject to change in the future.
139
140
141 WHEN TO USE MDM-SYNC
142 ====================
143
144 The mdm-sync command is just like mdm-run, except that it does not
145 submit the command for parallel execution. Use mdm-sync to annotate a
146 command when you don't want it to run in parallel, but you think it
147 might interfere with a command annotated by mdm-run.
148
149
150 QUESTIONS? COMMENTS?
151 =====================
152
153 Please feel free to leave questions or comments on the mdm support forum
154 on BerliOS <http://developer.berlios.de/forum/?group_id=10680>. If you
155 prefer, you can also write to me at <[email protected]>.
156
157
158 --
159 Chuan-kai Lin <[email protected]>
160 Thu Mar 12 16:30:13 PDT 2009