summaryrefslogtreecommitdiff
path: root/parallel.docbook
blob: 9d5714c2b7d404050685861ab5a1f8241711ab88 (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
<?xml version="1.0" encoding="utf-8"?>

<!--

Written by Joey Hess

-->

<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
"file:///usr/share/xml/docbook/schema/dtd/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>
	</refmeta>

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

	<refsynopsisdiv>
		<cmdsynopsis>
			<command>parallel</command>
			<arg>options</arg>
			<arg>command</arg>
			<arg>--</arg>
			<arg>arguments</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 core.</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>Avoid starting new jobs when
				the system's load average is higher
				than 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, the first instance of "{}" in
				the command is replaced with the argument.</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 yours 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>

	</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
	exists nonzero, <command>parallel</command> as a whole will exit nonzero.)</para>
		
	</refsect1>

</refentry>