summaryrefslogtreecommitdiff
path: root/parallel.docbook
blob: bd490e2d3cde03942366b58b7221cac0229f45ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?xml version="1.0" encoding="utf-8"?>

<!--

Written by Joey Hess

-->

<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
[]>

<refentry>
	<refentryinfo>
		<address>
			<email>joey@kitenet.net</email>
		</address>
		<author>
			<firstname>Joey</firstname>
			<surname>Hess</surname>
		</author>
		<date>2009-07-02</date>
	</refentryinfo>

	<refmeta>
		<refentrytitle>parallel</refentrytitle>
		<manvolnum>1</manvolnum>
		<refmiscinfo class="manual">moreutils</refmiscinfo>
		<refmiscinfo class="source">moreutils</refmiscinfo>
	</refmeta>

	<refnamediv>
		<refname>parallel</refname> 
		<refpurpose>run programs in parallel</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
		<cmdsynopsis>
			<command>parallel</command>
			<arg>options</arg>
			<arg>command</arg>
			<command>--</command>
			<arg>argument ...</arg>
		</cmdsynopsis>
		<cmdsynopsis>
			<command>parallel</command>
			<arg>options</arg>
			<command>--</command>
			<arg>command ...</arg>
		</cmdsynopsis>
	</refsynopsisdiv>
	
	<refsect1>
		<title>DESCRIPTION</title>
		
		<para><command>parallel</command> runs the specified command,
		passing it a single one of the specified arguments. This is
		repeated for each argument. Jobs may be run in
		parallel. The default is to run one job per CPU.</para>

		<para>If no command is specified before the --,
		the commands after it are instead run in parallel.</para>

	</refsect1>
	
	<refsect1>
		<title>OPTIONS</title>
		
		<variablelist>
		
		<varlistentry>
			<term><option>-j maxjobs</option></term>
			<listitem>
				<para>Use to limit the number of jobs
				that are run at the same time.</para>
			</listitem>
		</varlistentry>
		
		<varlistentry>
			<term><option>-l maxload</option></term>
			<listitem>
				<para>Wait as needed to avoid starting
				new jobs when the system's load average
				is not below the specified limit.</para>
			</listitem>
		</varlistentry>
		
		<varlistentry>
			<term><option>-i</option></term>
			<listitem>
				<para>Normally the command is passed the
				argument at the end of its command line. With
				this option, any instances of "{}" in
				the command are replaced with the argument.</para>
			</listitem>
		</varlistentry>
		
		<varlistentry>
			<term><option>-n</option></term>
			<listitem>
				<para>Number of arguments to pass to a
				command at a time. Default is 1.
				Incompatible with -i</para>
			</listitem>
		</varlistentry>
		
		</variablelist>
		
	</refsect1>

	<refsect1>
		<title>EXAMPLE</title>
		
	<para>
	<cmdsynopsis>
		<command>parallel sh -c "echo hi; sleep 2; echo bye" -- 1 2 3</command>
	</cmdsynopsis>
	</para>

	<para>This runs three subshells that each print a message, delay,
		and print another message. If your system has multiple
		CPUs, parallel will run some of the jobs in parallel,
		which should be clear from the order the messages are
		output.
	</para>
		
	<para>
	<cmdsynopsis>
		<command>parallel -j 3 ufraw -o processed -- *.NEF</command>
	</cmdsynopsis>
	</para>

	<para>This runs three ufraw processes at the same time until
	all of the NEF files have been processed.
	</para>
	
	<para>
	<cmdsynopsis>
		<command>parallel -j 3 -- ls df "echo hi"</command>
	</cmdsynopsis>
	</para>

	<para>This runs three independent commands in parallel.</para>

	</refsect1>

	<refsect1>
		<title>EXIT STATUS</title>


	<para>Its exit status is the combination of the exit statuses of each
	command ran, ORed together. (Thus, if any one command
	exits nonzero, <command>parallel</command> as a whole will exit nonzero.)</para>
		
	</refsect1>
	
	<refsect1>
		<title>AUTHOR</title>
		<para>
			Tollef Fog Heen
		</para>
	</refsect1>

</refentry>