2015-04-04 14:37:32 +00:00
|
|
|
### test parallel_tutorial
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -k echo ::: A B C > abc-file
|
|
|
|
parallel -k echo ::: D E F > def-file
|
|
|
|
perl -e 'printf "A\0B\0C\0"' > abc0-file
|
|
|
|
perl -e 'printf "A_B_C_"' > abc_-file
|
|
|
|
perl -e 'printf "f1\tf2\nA\tB\nC\tD\n"' > tsv-file.tsv
|
|
|
|
perl -e 'for(1..8){print "$_\n"}' > num8
|
|
|
|
perl -e 'for(1..128){print "$_\n"}' > num128
|
|
|
|
perl -e 'for(1..30000){print "$_\n"}' > num30000
|
|
|
|
perl -e 'for(1..1000000){print "$_\n"}' > num1000000
|
|
|
|
(echo %head1; echo %head2; perl -e 'for(1..10){print "$_\n"}') > num_%header
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
sleep .3
|
|
|
|
|
|
|
|
parallel echo ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -a abc-file echo
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
cat abc-file | parallel echo
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo ::: A B C ::: D E F
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -a abc-file -a def-file echo
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
cat abc-file | parallel -a - -a def-file echo
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
cat abc-file | parallel echo :::: - def-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo ::: A B C :::: def-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --xapply echo ::: A B C ::: D E F
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
B E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --xapply echo ::: A B C D E ::: F G
|
2015-04-04 14:37:32 +00:00
|
|
|
A F
|
|
|
|
B G
|
|
|
|
C F
|
|
|
|
D G
|
|
|
|
E F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --arg-sep ,, echo ,, A B C :::: def-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --arg-file-sep // echo ::: A B C // def-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A D
|
|
|
|
A E
|
|
|
|
A F
|
|
|
|
B D
|
|
|
|
B E
|
|
|
|
B F
|
|
|
|
C D
|
|
|
|
C E
|
|
|
|
C F
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -d _ echo :::: abc_-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -d '\0' echo :::: abc0-file
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -E stop echo ::: A B stop C D
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
2015-04-09 23:20:51 +00:00
|
|
|
(echo 1; echo; echo 2) | parallel --no-run-if-empty echo
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel ::: ls 'echo foo' pwd
|
2015-04-04 14:37:32 +00:00
|
|
|
abc-file
|
|
|
|
abc0-file
|
|
|
|
abc_-file
|
|
|
|
def-file
|
|
|
|
num1000000
|
|
|
|
num128
|
|
|
|
num30000
|
|
|
|
num8
|
|
|
|
num_%header
|
|
|
|
tsv-file.tsv
|
|
|
|
foo
|
|
|
|
/home/tange/privat/parallel/testsuite/tmp
|
2015-04-09 23:20:51 +00:00
|
|
|
my_func() {
|
|
|
|
echo in my_func $1
|
|
|
|
}
|
|
|
|
export -f my_func
|
|
|
|
parallel my_func ::: 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
in my_func 1
|
|
|
|
in my_func 2
|
|
|
|
in my_func 3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A/B.C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {} ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A/B.C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {.} ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A/B
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {/} ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
B.C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {//} ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {/.} ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
B
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo {#} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -j 2 echo {%} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
1
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -I ,, echo ,, ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A/B.C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --extensionreplace ,, echo ,, ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A/B
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --basenamereplace ,, echo ,, ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
B.C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --dirnamereplace ,, echo ,, ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --basenameextensionreplace ,, echo ,, ::: A/B.C
|
2015-04-04 14:37:32 +00:00
|
|
|
B
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --seqreplace ,, echo ,, ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -j2 --slotreplace ,, echo ,, ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
1
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo '{= s:\.[^.]+$::;s:\.[^.]+$::; =}' ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --parens ,,,, echo ',, s:\.[^.]+$::;s:\.[^.]+$::; ,,' ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --rpl '.. s:\.[^.]+$::;s:\.[^.]+$::;' echo '..' ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --rpl '{..} s:\.[^.]+$::;s:\.[^.]+$::;' echo '{..}' ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
--rpl '{} '
|
|
|
|
--rpl '{#} $_=$job->seq()'
|
|
|
|
--rpl '{%} $_=$job->slot()'
|
|
|
|
--rpl '{/} s:.*/::'
|
|
|
|
--rpl '{//} $Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);'
|
|
|
|
--rpl '{/.} s:.*/::; s:\.[^/.]+$::;'
|
|
|
|
--rpl '{.} s:\.[^/.]+$::'
|
|
|
|
/bin/bash: --rpl: command not found
|
|
|
|
/bin/bash: line 1: --rpl: command not found
|
|
|
|
/bin/bash: line 2: --rpl: command not found
|
|
|
|
/bin/bash: line 3: --rpl: command not found
|
|
|
|
/bin/bash: line 4: --rpl: command not found
|
|
|
|
/bin/bash: line 5: --rpl: command not found
|
|
|
|
/bin/bash: line 6: --rpl: command not found
|
|
|
|
parallel echo {1} and {2} ::: A B ::: C D
|
2015-04-04 14:37:32 +00:00
|
|
|
A and C
|
|
|
|
A and D
|
|
|
|
B and C
|
|
|
|
B and D
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo /={1/} //={1//} /.={1/.} .={1.} ::: A/B.C D/E.F
|
2015-04-04 14:37:32 +00:00
|
|
|
/=B.C //=A /.=B .=A/B
|
|
|
|
/=E.F //=D /.=E .=D/E
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo 1={1} 2={2} 3={3} -1={-1} -2={-2} -3={-3} ::: A B ::: C D ::: E F
|
2015-04-04 14:37:32 +00:00
|
|
|
1=A 2=C 3=E -1=E -2=C -3=A
|
|
|
|
1=A 2=C 3=F -1=F -2=C -3=A
|
|
|
|
1=A 2=D 3=E -1=E -2=D -3=A
|
|
|
|
1=A 2=D 3=F -1=F -2=D -3=A
|
|
|
|
1=B 2=C 3=E -1=E -2=C -3=B
|
|
|
|
1=B 2=C 3=F -1=F -2=C -3=B
|
|
|
|
1=B 2=D 3=E -1=E -2=D -3=B
|
|
|
|
1=B 2=D 3=F -1=F -2=D -3=B
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel echo '{=2 s:\.[^.]+$::;s:\.[^.]+$::; =} {1}' ::: bar ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo bar
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --rpl '{..} s:\.[^.]+$::;s:\.[^.]+$::;' echo '{2..} {1}' ::: bar ::: foo.tar.gz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo bar
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --colsep '\t' echo 1={1} 2={2} :::: tsv-file.tsv
|
2015-04-04 14:37:32 +00:00
|
|
|
1=f1 2=f2
|
|
|
|
1=A 2=B
|
|
|
|
1=C 2=D
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --header : echo f1={f1} f2={f2} ::: f1 A B ::: f2 C D
|
2015-04-04 14:37:32 +00:00
|
|
|
f1=A f2=C
|
|
|
|
f1=A f2=D
|
|
|
|
f1=B f2=C
|
|
|
|
f1=B f2=D
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --header : --colsep '\t' echo f1={f1} f2={f2} :::: tsv-file.tsv
|
2015-04-04 14:37:32 +00:00
|
|
|
f1=A f2=B
|
|
|
|
f1=C f2=D
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num30000 | parallel --xargs echo | wc -l
|
2015-04-04 14:37:32 +00:00
|
|
|
2
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num30000 | parallel --xargs -s 10000 echo | wc -l
|
2015-04-04 14:37:32 +00:00
|
|
|
17
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num30000 | parallel --jobs 4 -m echo | wc -l
|
2015-04-04 14:37:32 +00:00
|
|
|
5
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --jobs 4 -m echo ::: 1 2 3 4 5 6 7 8 9 10
|
2015-04-04 14:37:32 +00:00
|
|
|
1 2 3
|
|
|
|
4 5 6
|
|
|
|
7 8 9
|
|
|
|
10
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --jobs 4 -X echo pre-{}-post ::: A B C D E F G
|
2015-04-04 14:37:32 +00:00
|
|
|
pre-A-post pre-B-post
|
|
|
|
pre-C-post pre-D-post
|
|
|
|
pre-E-post pre-F-post
|
|
|
|
pre-G-post
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -N3 echo ::: A B C D E F G H
|
2015-04-04 14:37:32 +00:00
|
|
|
A B C
|
|
|
|
D E F
|
|
|
|
G H
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -N3 echo 1={1} 2={2} 3={3} ::: A B C D E F G H
|
2015-04-04 14:37:32 +00:00
|
|
|
1=A 2=B 3=C
|
|
|
|
1=D 2=E 3=F
|
|
|
|
1=G 2=H 3=
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -N0 echo foo ::: 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
|
|
|
foo
|
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
perl -e 'print "@ARGV\n"' A
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel perl -e 'print "@ARGV\n"' ::: This wont work
|
|
|
|
|
|
|
|
parallel: Warning: Input is read from the terminal. Only experts do this on purpose. Press CTRL-D to exit.
|
|
|
|
perl -e 'print "@ARGV\n"'
|
|
|
|
[CTRL-D]
|
|
|
|
|
|
|
|
/bin/bash: line 1: parallel:: command not found
|
|
|
|
/bin/bash: line 3: [CTRL-D]: command not found
|
2015-04-04 14:37:32 +00:00
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --trim r echo pre-{}-post ::: ' A '
|
2015-04-04 14:37:32 +00:00
|
|
|
pre- A-post
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --trim l echo pre-{}-post ::: ' A '
|
2015-04-04 14:37:32 +00:00
|
|
|
pre-A -post
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --trim lr echo pre-{}-post ::: ' A '
|
2015-04-04 14:37:32 +00:00
|
|
|
pre-A-post
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --tag echo foo-{} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A foo-A
|
|
|
|
B foo-B
|
|
|
|
C foo-C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --tagstring {}-bar echo foo-{} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A-bar foo-A
|
|
|
|
B-bar foo-B
|
|
|
|
C-bar foo-C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --dryrun echo {} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
echo A
|
|
|
|
echo B
|
|
|
|
echo C
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --verbose echo {} ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
echo A
|
|
|
|
echo B
|
|
|
|
echo C
|
|
|
|
parallel -j2 'printf "%s-start\n%s" {} {};sleep {};printf "%s\n" -middle;echo {}-end' ::: 4 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
4-start
|
|
|
|
4-middle
|
|
|
|
4-end
|
|
|
|
2-start
|
|
|
|
2-middle
|
|
|
|
2-end
|
|
|
|
1-start
|
|
|
|
1-middle
|
|
|
|
1-end
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -j2 --ungroup 'printf "%s-start\n%s" {} {};sleep {};printf "%s\n" -middle;echo {}-end' ::: 4 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
4-start
|
|
|
|
42-start
|
|
|
|
2-middle
|
|
|
|
2-end
|
|
|
|
1-start
|
|
|
|
1-middle
|
|
|
|
1-end
|
|
|
|
-middle
|
|
|
|
4-end
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -j2 --linebuffer 'printf "%s-start\n%s" {} {};sleep {};printf "%s\n" -middle;echo {}-end' ::: 4 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
4-start
|
|
|
|
2-start
|
|
|
|
2-middle
|
|
|
|
2-end
|
|
|
|
1-start
|
|
|
|
1-middle
|
|
|
|
1-end
|
|
|
|
4-middle
|
|
|
|
4-end
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -j2 -k 'printf "%s-start\n%s" {} {};sleep {};printf "%s\n" -middle;echo {}-end' ::: 4 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
4-start
|
|
|
|
4-middle
|
|
|
|
4-end
|
|
|
|
2-start
|
|
|
|
2-middle
|
|
|
|
2-end
|
|
|
|
1-start
|
|
|
|
1-middle
|
|
|
|
1-end
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --files echo ::: A B C
|
2015-04-20 22:08:08 +00:00
|
|
|
/tmp/parallel-tutorial/parXXXXX.par
|
|
|
|
/tmp/parallel-tutorial/parXXXXX.par
|
|
|
|
/tmp/parallel-tutorial/parXXXXX.par
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --tmpdir /var/tmp --files echo ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
/var/tmp/parXXXXX.par
|
|
|
|
/var/tmp/parXXXXX.par
|
|
|
|
/var/tmp/parXXXXX.par
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --results outdir echo ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
outdir/1/A/stderr
|
|
|
|
outdir/1/A/stdout
|
|
|
|
outdir/1/B/stderr
|
|
|
|
outdir/1/B/stdout
|
|
|
|
outdir/1/C/stderr
|
|
|
|
outdir/1/C/stdout
|
|
|
|
/bin/bash: outdir/1/A/stderr: No such file or directory
|
|
|
|
/bin/bash: line 1: outdir/1/A/stdout: No such file or directory
|
|
|
|
/bin/bash: line 2: outdir/1/B/stderr: No such file or directory
|
|
|
|
/bin/bash: line 3: outdir/1/B/stdout: No such file or directory
|
|
|
|
/bin/bash: line 4: outdir/1/C/stderr: No such file or directory
|
|
|
|
/bin/bash: line 5: outdir/1/C/stdout: No such file or directory
|
|
|
|
parallel --header : --results outdir echo ::: f1 A B ::: f2 C D
|
2015-04-04 14:37:32 +00:00
|
|
|
A C
|
|
|
|
A D
|
|
|
|
B C
|
|
|
|
B D
|
2015-04-09 23:20:51 +00:00
|
|
|
outdir/f1/A/f2/C/stderr
|
|
|
|
outdir/f1/A/f2/C/stdout
|
|
|
|
outdir/f1/A/f2/D/stderr
|
|
|
|
outdir/f1/A/f2/D/stdout
|
|
|
|
outdir/f1/B/f2/C/stderr
|
|
|
|
outdir/f1/B/f2/C/stdout
|
|
|
|
outdir/f1/B/f2/D/stderr
|
|
|
|
outdir/f1/B/f2/D/stdout
|
|
|
|
/bin/bash: outdir/f1/A/f2/C/stderr: No such file or directory
|
|
|
|
/bin/bash: line 1: outdir/f1/A/f2/C/stdout: No such file or directory
|
|
|
|
/bin/bash: line 2: outdir/f1/A/f2/D/stderr: No such file or directory
|
|
|
|
/bin/bash: line 3: outdir/f1/A/f2/D/stdout: No such file or directory
|
|
|
|
/bin/bash: line 4: outdir/f1/B/f2/C/stderr: No such file or directory
|
|
|
|
/bin/bash: line 5: outdir/f1/B/f2/C/stdout: No such file or directory
|
|
|
|
/bin/bash: line 6: outdir/f1/B/f2/D/stderr: No such file or directory
|
|
|
|
/bin/bash: line 7: outdir/f1/B/f2/D/stdout: No such file or directory
|
|
|
|
/usr/bin/time -f %e parallel -N0 -j64 sleep 1 :::: num128
|
2015-04-04 14:37:32 +00:00
|
|
|
2
|
2015-04-09 23:20:51 +00:00
|
|
|
/usr/bin/time -f %e parallel -N0 sleep 1 :::: num128
|
2015-04-04 14:37:32 +00:00
|
|
|
16
|
2015-04-09 23:20:51 +00:00
|
|
|
/usr/bin/time -f %e parallel -N0 --jobs 200% sleep 1 :::: num128
|
2015-04-04 14:37:32 +00:00
|
|
|
8
|
2015-04-09 23:20:51 +00:00
|
|
|
/usr/bin/time -f %e parallel -N0 --jobs 0 sleep 1 :::: num128
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
2015-04-09 23:20:51 +00:00
|
|
|
echo 50% > my_jobs
|
|
|
|
/usr/bin/time -f %e parallel -N0 --jobs my_jobs sleep 1 :::: num128 &
|
|
|
|
sleep 1
|
|
|
|
echo 0 > my_jobs
|
|
|
|
wait
|
2015-04-04 14:37:32 +00:00
|
|
|
3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --use-cpus-instead-of-cores -N0 sleep 1 :::: num8
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel --shuf echo ::: 1 2 3 ::: a b c ::: A B C
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
|
|
|
123 abc ABC
|
2015-04-09 23:20:51 +00:00
|
|
|
|
|
|
|
seq 10 20 | parallel --tmux 'echo start {}; sleep {}; echo done {}'
|
2015-05-21 21:02:55 +00:00
|
|
|
See output with: tmux -S /tmp/parallel-tutorial/tmsXXXXX attach
|
|
|
|
tmux -S /tmp/tmsXXXXX attach
|
2015-04-04 14:37:32 +00:00
|
|
|
no sessions
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --delay 2.5 echo Starting {}\;date ::: 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
Starting 1
|
|
|
|
DATE OUTPUT
|
|
|
|
Starting 2
|
|
|
|
DATE OUTPUT
|
|
|
|
Starting 3
|
|
|
|
DATE OUTPUT
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --timeout 4.1 sleep {}\; echo {} ::: 2 4 6 8
|
2015-04-04 14:37:32 +00:00
|
|
|
2
|
2015-04-09 23:20:51 +00:00
|
|
|
4
|
|
|
|
parallel --timeout 200% sleep {}\; echo {} ::: 2.1 2.2 3 7 2.3
|
2015-04-04 14:37:32 +00:00
|
|
|
2
|
|
|
|
2
|
|
|
|
3
|
|
|
|
2
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --eta sleep ::: 1 3 2 2 1 3 3 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
|
|
|
|
Computers / CPU cores / Max jobs to run
|
|
|
|
1:local / 8 / 8
|
|
|
|
|
|
|
|
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
|
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --progress sleep ::: 1 3 2 2 1 3 3 2 1
|
2015-04-04 14:37:32 +00:00
|
|
|
|
|
|
|
Computers / CPU cores / Max jobs to run
|
|
|
|
1:local / 8 / 8
|
|
|
|
|
|
|
|
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
|
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
seq 1000 | parallel -j10 --bar '(echo -n {};sleep 0.1)' 2> >(zenity --timeout=12 --progress --auto-kill)
|
|
|
|
BASE64 parallel --joblog /tmp/log exit ::: 1 2 3 0
|
2015-04-14 22:55:09 +00:00
|
|
|
cat /tmp/log;
|
|
|
|
parallel --joblog /tmp/log exit ::: 1 2 3 0
|
|
|
|
cat /tmp/log; parallel --resume --joblog /tmp/log exit ::: 1 2 3 0 0 0
|
|
|
|
cat /tmp/log;
|
|
|
|
parallel --resume-failed --joblog /tmp/log exit ::: 1 2 3 0 0 0
|
|
|
|
cat /tmp/log;
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel -j2 --halt soon,fail=1 echo {}\; exit {} ::: 0 0 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
Seq Host Starttime JobRuntime Send Receive Exitval Signal Command
|
|
|
|
1 : TIMESTAMP 9.999 0 0 1 0 exit 1
|
|
|
|
2 : TIMESTAMP 9.999 0 0 2 0 exit 2
|
|
|
|
3 : TIMESTAMP 9.999 0 0 3 0 exit 3
|
|
|
|
4 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
Seq Host Starttime JobRuntime Send Receive Exitval Signal Command
|
|
|
|
1 : TIMESTAMP 9.999 0 0 1 0 exit 1
|
|
|
|
2 : TIMESTAMP 9.999 0 0 2 0 exit 2
|
|
|
|
3 : TIMESTAMP 9.999 0 0 3 0 exit 3
|
|
|
|
4 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
Seq Host Starttime JobRuntime Send Receive Exitval Signal Command
|
|
|
|
1 : TIMESTAMP 9.999 0 0 1 0 exit 1
|
|
|
|
2 : TIMESTAMP 9.999 0 0 2 0 exit 2
|
|
|
|
3 : TIMESTAMP 9.999 0 0 3 0 exit 3
|
|
|
|
4 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
5 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
6 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
Seq Host Starttime JobRuntime Send Receive Exitval Signal Command
|
|
|
|
1 : TIMESTAMP 9.999 0 0 1 0 exit 1
|
|
|
|
2 : TIMESTAMP 9.999 0 0 2 0 exit 2
|
|
|
|
3 : TIMESTAMP 9.999 0 0 3 0 exit 3
|
|
|
|
4 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
5 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
6 : TIMESTAMP 9.999 0 0 0 0 exit 0
|
|
|
|
1 : TIMESTAMP 9.999 0 0 1 0 exit 1
|
|
|
|
2 : TIMESTAMP 9.999 0 0 2 0 exit 2
|
|
|
|
3 : TIMESTAMP 9.999 0 0 3 0 exit 3
|
|
|
|
0
|
|
|
|
0
|
|
|
|
1
|
2015-04-09 23:20:51 +00:00
|
|
|
2
|
2015-05-02 23:22:34 +00:00
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-02 23:22:34 +00:00
|
|
|
parallel: Starting no more jobs. Waiting for 1 jobs to finish.
|
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel -j2 --halt now,fail=1 echo {}\; exit {} ::: 0 0 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
0
|
|
|
|
0
|
|
|
|
1
|
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel -j2 --halt soon,fail=20% echo {}\; exit {} ::: 0 1 2 3 4 5 6 7 8 9
|
2015-04-04 14:37:32 +00:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
2015-05-02 23:22:34 +00:00
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-02 23:22:34 +00:00
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-02 23:22:34 +00:00
|
|
|
parallel: Starting no more jobs. Waiting for 1 jobs to finish.
|
|
|
|
parallel: This job failed:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel -j2 --halt soon,success=1 echo {}\; exit {} ::: 1 2 3 0 4 5 6
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
0
|
|
|
|
4
|
|
|
|
parallel: This job succeeded:
|
2015-05-25 00:27:30 +00:00
|
|
|
echo X; exit X
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel: Starting no more jobs. Waiting for 1 jobs to finish.
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -k --retries 3 'echo tried {} >>/tmp/runs; echo completed {}; exit {}' ::: 1 2 0
|
|
|
|
cat /tmp/runs
|
2015-04-04 14:37:32 +00:00
|
|
|
completed 1
|
|
|
|
completed 2
|
|
|
|
completed 0
|
|
|
|
tried 1
|
|
|
|
tried 0
|
|
|
|
tried 1
|
|
|
|
tried 1
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --load 100% echo load is less than {} job per cpu ::: 1
|
2015-04-04 14:37:32 +00:00
|
|
|
load is less than 1 job per cpu
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --noswap echo the system is not swapping ::: now
|
2015-04-04 14:37:32 +00:00
|
|
|
the system is not swapping now
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --nice 17 echo this is being run with nice -n ::: 17
|
2015-04-04 14:37:32 +00:00
|
|
|
this is being run with nice -n 17
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S $SERVER1 echo running on ::: $SERVER1
|
2015-04-04 14:37:32 +00:00
|
|
|
running on parallel@lo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S $SERVER1 echo running on ::: username@$SERVER1
|
2015-04-04 14:37:32 +00:00
|
|
|
running on username@parallel@lo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S : echo running on ::: the_local_machine
|
2015-04-04 14:37:32 +00:00
|
|
|
running on the_local_machine
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S '/usr/bin/ssh '$SERVER1 echo custom ::: ssh
|
2015-04-04 14:37:32 +00:00
|
|
|
custom ssh
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S $SERVER1 -S $SERVER2 echo ::: running on more hosts
|
2015-04-04 14:37:32 +00:00
|
|
|
running
|
|
|
|
on
|
|
|
|
more
|
|
|
|
hosts
|
2015-04-09 23:20:51 +00:00
|
|
|
echo $SERVER1 > nodefile
|
|
|
|
# Force 4 cores, special ssh-command, username
|
|
|
|
echo 4//usr/bin/ssh $SERVER2 >> nodefile
|
|
|
|
parallel --sshloginfile nodefile echo ::: running on more hosts
|
2015-04-04 14:37:32 +00:00
|
|
|
running
|
|
|
|
on
|
|
|
|
more
|
|
|
|
hosts
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S 4/$SERVER1 echo force {} cpus on server ::: 4
|
2015-04-04 14:37:32 +00:00
|
|
|
force 4 cpus on server
|
2015-05-21 21:02:55 +00:00
|
|
|
parallel --hostgroup -S @grp1/$SERVER1 -S @grp2/$SERVER2 echo {} ::: run_on_grp1@grp1 run_on_grp2@grp2
|
|
|
|
run_on_grp1
|
|
|
|
run_on_grp2
|
2015-04-09 23:20:51 +00:00
|
|
|
echo This is input_file > input_file
|
|
|
|
parallel -S $SERVER1 --transfer cat ::: input_file
|
2015-04-04 14:37:32 +00:00
|
|
|
This is input_file
|
2015-04-09 23:20:51 +00:00
|
|
|
echo This is input_file > input_file
|
|
|
|
parallel -S $SERVER1 --transfer --return {}.out cat {} ">"{}.out ::: input_file
|
|
|
|
cat input_file.out
|
2015-04-04 14:37:32 +00:00
|
|
|
This is input_file
|
2015-04-09 23:20:51 +00:00
|
|
|
echo This is input_file > input_file
|
|
|
|
parallel -S $SERVER1 --transfer --return {}.out --cleanup cat {} ">"{}.out ::: input_file
|
|
|
|
cat input_file.out
|
2015-04-04 14:37:32 +00:00
|
|
|
This is input_file
|
2015-04-09 23:20:51 +00:00
|
|
|
echo This is input_file > input_file
|
|
|
|
parallel -S $SERVER1 --trc {}.out cat {} ">"{}.out ::: input_file
|
|
|
|
cat input_file.out
|
2015-04-04 14:37:32 +00:00
|
|
|
This is input_file
|
2015-04-09 23:20:51 +00:00
|
|
|
echo common data > common_file
|
|
|
|
parallel --basefile common_file -S $SERVER1 cat common_file\; echo {} ::: foo
|
2015-04-04 14:37:32 +00:00
|
|
|
common data
|
|
|
|
foo
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S $SERVER1 pwd ::: ""
|
|
|
|
parallel --workdir . -S $SERVER1 pwd ::: ""
|
|
|
|
parallel --workdir ... -S $SERVER1 pwd ::: ""
|
2015-04-04 14:37:32 +00:00
|
|
|
/home/parallel
|
|
|
|
/home/parallel/privat/parallel/testsuite/tmp
|
|
|
|
/home/parallel/.TMPWORKDIR
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel -S $SERVER1 --sshdelay 0.2 echo ::: 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --controlmaster -S $SERVER1 echo ::: 1 2 3
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --filter-hosts -S 173.194.32.46,$SERVER1 echo ::: bar
|
2015-04-04 14:37:32 +00:00
|
|
|
bar
|
2015-05-15 06:47:44 +00:00
|
|
|
parallel: Warning: Removed 173.194.32.46.
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --onall -S $SERVER1,$SERVER2 echo ::: foo bar
|
2015-04-04 14:37:32 +00:00
|
|
|
foo
|
|
|
|
bar
|
|
|
|
foo
|
|
|
|
bar
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --nonall --tag -S $SERVER1,$SERVER2 echo foo bar
|
2015-04-04 14:37:32 +00:00
|
|
|
csh@lo foo bar
|
|
|
|
parallel@lo foo bar
|
2015-04-09 23:20:51 +00:00
|
|
|
MYVAR='foo bar'
|
|
|
|
export MYVAR
|
|
|
|
parallel --env MYVAR -S $SERVER1 echo '$MYVAR' ::: baz
|
2015-04-04 14:37:32 +00:00
|
|
|
foo bar baz
|
2015-04-09 23:20:51 +00:00
|
|
|
my_func() {
|
|
|
|
echo in my_func $1
|
|
|
|
}
|
|
|
|
export -f my_func
|
|
|
|
parallel --env my_func -S $SERVER1 my_func ::: baz
|
2015-04-04 14:37:32 +00:00
|
|
|
in my_func baz
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --record-env
|
|
|
|
cat ~/.parallel/ignored_vars|sort
|
|
|
|
BASH_FUNC_run_test%%
|
2015-04-04 14:37:32 +00:00
|
|
|
CLUTTER_IM_MODULE
|
|
|
|
COLORFGBG
|
|
|
|
DBUS_SESSION_BUS_ADDRESS
|
|
|
|
DEBEMAIL
|
|
|
|
DEBFULLNAME
|
|
|
|
DEFAULTS_PATH
|
|
|
|
DESKTOP_SESSION
|
|
|
|
DISPLAY
|
|
|
|
DM_CONTROL
|
|
|
|
GLADE_CATALOG_PATH
|
|
|
|
GLADE_MODULE_PATH
|
|
|
|
GLADE_PIXMAP_PATH
|
|
|
|
GPG_AGENT_INFO
|
|
|
|
GTK_IM_MODULE
|
|
|
|
HISTCONTROL
|
|
|
|
HOME
|
|
|
|
IM_CONFIG_PHASE
|
|
|
|
INSTANCE
|
|
|
|
JAVA_HOME
|
|
|
|
JDK_HOME
|
|
|
|
JOB
|
|
|
|
KONSOLE_DBUS_SERVICE
|
|
|
|
KONSOLE_DBUS_SESSION
|
|
|
|
KONSOLE_DBUS_WINDOW
|
|
|
|
KONSOLE_PROFILE_NAME
|
|
|
|
LANG
|
|
|
|
LANGUAGE
|
|
|
|
LESS
|
|
|
|
LESSCLOSE
|
|
|
|
LESSOPEN
|
|
|
|
LOGNAME
|
|
|
|
LS_COLORS
|
|
|
|
MAKEFLAGS
|
|
|
|
MAKELEVEL
|
|
|
|
MANDATORY_PATH
|
|
|
|
MFLAGS
|
|
|
|
MOZ_NO_REMOTE
|
|
|
|
ORACLE_HOME
|
|
|
|
ORACLE_SID
|
|
|
|
PARALLEL
|
2015-04-09 23:20:51 +00:00
|
|
|
PARALLEL_PID
|
|
|
|
PARALLEL_SEQ
|
2015-05-14 15:17:02 +00:00
|
|
|
PARALLEL_TMP
|
2015-04-04 14:37:32 +00:00
|
|
|
PATH
|
|
|
|
PERL_MB_OPT
|
|
|
|
PERL_MM_OPT
|
|
|
|
PROFILEHOME
|
|
|
|
PWD
|
|
|
|
QT4_IM_MODULE
|
|
|
|
QT_IM_MODULE
|
|
|
|
SELINUX_INIT
|
|
|
|
SERVER1
|
|
|
|
SERVER2
|
|
|
|
SESSION
|
|
|
|
SESSIONTYPE
|
|
|
|
SESSION_MANAGER
|
|
|
|
SHELL
|
|
|
|
SHELL_SESSION_ID
|
|
|
|
SHLVL
|
|
|
|
SSH_AGENT_PID
|
|
|
|
SSH_AUTH_SOCK
|
|
|
|
TERM
|
|
|
|
TEXTDOMAIN
|
|
|
|
TEXTDOMAINDIR
|
|
|
|
TIMEOUT
|
|
|
|
TMPDIR
|
2015-04-15 20:32:46 +00:00
|
|
|
TRIES
|
2015-04-04 14:37:32 +00:00
|
|
|
UPSTART_EVENTS
|
|
|
|
UPSTART_INSTANCE
|
|
|
|
UPSTART_JOB
|
|
|
|
UPSTART_SESSION
|
|
|
|
USER
|
|
|
|
VISUAL
|
|
|
|
WINDOWID
|
|
|
|
WINDOWPATH
|
|
|
|
XDG_CONFIG_DIRS
|
|
|
|
XDG_CURRENT_DESKTOP
|
|
|
|
XDG_DATA_DIRS
|
|
|
|
XDG_MENU_PREFIX
|
|
|
|
XDG_RUNTIME_DIR
|
|
|
|
XDG_SEAT
|
|
|
|
XDG_SESSION_ID
|
|
|
|
XDG_VTNR
|
|
|
|
XDM_MANAGED
|
|
|
|
XMODIFIERS
|
|
|
|
_
|
2015-04-09 23:20:51 +00:00
|
|
|
# The function is only copied if using Bash
|
|
|
|
my_func2() {
|
|
|
|
echo in my_func2 $VAR $1
|
|
|
|
}
|
|
|
|
export -f my_func2
|
|
|
|
VAR=foo
|
|
|
|
export VAR
|
|
|
|
parallel --env _ -S $SERVER1 'echo $VAR; my_func2' ::: bar
|
|
|
|
|
|
|
|
/bin/bash: my_func2: command not found
|
|
|
|
parallel -vv -S $SERVER1 echo ::: bar
|
2015-05-25 00:27:30 +00:00
|
|
|
ssh parallel@lo exec perl\ -e\ \\\$ENV\\\{\\\"PARALLEL_PID\\\"\\\}\\\=\\\"000000\\\"\\\;\\\$ENV\\\{\\\"PARALLEL_SEQ\\\"\\\}\\\=\\\"1\\\"\\\;\\\$bashfunc\\\ \\\=\\\ \\\"\\\"\\\;@ARGV\\\=\\\"echo\\\ bar\\\"\\\;\\\$shell\\\=\\\"\\\$ENV\\\{SHELL\\\}\\\"\\\;\\\$tmpdir\\\=\\\"/tmp/parallel-tutorial\\\"\\\;do\\\{\\\$ENV\\\{PARALLEL_TMP\\\}\\\=\\\$tmpdir.\\\"/par\\\".join\\\"\\\",map\\\{\\\(0..9,\\\"a\\\"..\\\"z\\\",\\\"A\\\"..\\\"Z\\\"\\\)\\\[rand\\\(62\\\)\\\]\\\}\\\(1..5\\\)\\\;\\\}while\\\(-e\\\$ENV\\\{PARALLEL_TMP\\\}\\\)\\\;\\\$SIG\\\{CHLD\\\}\\\=sub\\\{\\\$done\\\=1\\\;\\\}\\\;\\\$pid\\\=fork\\\;unless\\\(\\\$pid\\\)\\\{setpgrp\\\;exec\\\$shell,\\\"-c\\\",\\\(\\\$bashfunc.\\\"@ARGV\\\"\\\)\\\;die\\\"exec:\\\$\\\!\\\\n\\\"\\\;\\\}do\\\{\\\$s\\\=\\\$s\\\<1\\\?0.001+\\\$s\\\*1.03:\\\$s\\\;select\\\(undef,undef,undef,\\\$s\\\)\\\;\\\}until\\\(\\\$done\\\|\\\|getppid\\\=\\\=1\\\)\\\;kill\\\(SIGHUP,-\\\$\\\{pid\\\}\\\)unless\\\$done\\\;wait\\\;exit\\\(\\\$\\\?\\\&127\\\?128+\\\(\\\$\\\?\\\&127\\\):1+\\\$\\\?\\\>\\\>8\\\);
|
2015-04-04 14:37:32 +00:00
|
|
|
bar
|
2015-04-09 23:20:51 +00:00
|
|
|
my_func3() {
|
|
|
|
echo in my_func $1 > $1.out
|
|
|
|
}
|
|
|
|
export -f my_func3
|
|
|
|
parallel -vv --workdir ... --nice 17 --env _ --trc {}.out -S $SERVER1 my_func3 {} ::: abc-file
|
2015-04-04 14:37:32 +00:00
|
|
|
( ssh parallel@lo mkdir -p ./.TMPWORKDIR;rsync --protocol 30 -rlDzR -essh ./abc-file parallel@lo:./.TMPWORKDIR );ssh parallel@lo exec perl -e \''@GNU_Parallel=("use","IPC::Open3;","use","MIME::Base64");eval"@GNU_Parallel";$SIG{CHLD}="IGNORE";my$zip=(grep{-x$_}"/usr/local/bin/bzip2")[0]||"bzip2";my($in,$out,$eval);open3($in,$out,">&STDERR",$zip,"-dc");if(my$perlpid=fork){close$in;$eval=join"",<$out>;close$out;}else{close$out;print$in(decode_base64(join"",@ARGV));close$in;exit;}wait;eval$eval;'\' BASE64;_EXIT_status=$?; mkdir -p ./.; rsync --protocol 30 --rsync-path=cd\ ./.TMPWORKDIR/./.\;\ rsync -rlDzR -essh parallel@lo:./abc-file.out ./.;ssh parallel@lo \(rm\ -f\ ./.TMPWORKDIR/abc-file\;\ sh\ -c\ \'rmdir\ ./.TMPWORKDIR/\ ./.parallel/tmp/\ ./.parallel/\ 2\>/dev/null\'\;rm\ -rf\ ./.TMPWORKDIR\;\);ssh parallel@lo \(rm\ -f\ ./.TMPWORKDIR/abc-file.out\;\ sh\ -c\ \'rmdir\ ./.TMPWORKDIR/\ ./.parallel/tmp/\ ./.parallel/\ 2\>/dev/null\'\;rm\ -rf\ ./.TMPWORKDIR\;\);ssh parallel@lo rm -rf .TMPWORKDIR; exit $_EXIT_status;
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num1000000 | parallel --pipe wc
|
2015-04-04 14:37:32 +00:00
|
|
|
165668 165668 1048571
|
|
|
|
149797 149797 1048579
|
|
|
|
149796 149796 1048572
|
|
|
|
149797 149797 1048579
|
|
|
|
149797 149797 1048579
|
|
|
|
149796 149796 1048572
|
|
|
|
85349 85349 597444
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num1000000 | parallel --pipe --block 2M wc
|
2015-04-04 14:37:32 +00:00
|
|
|
315465 315465 2097150
|
|
|
|
299593 299593 2097151
|
|
|
|
299593 299593 2097151
|
|
|
|
85349 85349 597444
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num1000000 | parallel --pipe -j4 --round-robin wc
|
2015-04-04 14:37:32 +00:00
|
|
|
315465 315465 2097150
|
|
|
|
299593 299593 2097151
|
|
|
|
235145 235145 1646016
|
|
|
|
149797 149797 1048579
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num1000000 | parallel --pipe -N140000 wc
|
2015-04-04 14:37:32 +00:00
|
|
|
140000 140000 868895
|
|
|
|
140000 140000 980000
|
|
|
|
140000 140000 980000
|
|
|
|
140000 140000 980000
|
|
|
|
140000 140000 980000
|
|
|
|
140000 140000 980000
|
|
|
|
140000 140000 980000
|
|
|
|
20000 20000 140001
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num1000000 | parallel --pipe -L75 wc
|
2015-04-04 14:37:32 +00:00
|
|
|
165600 165600 1048095
|
|
|
|
149850 149850 1048950
|
|
|
|
149775 149775 1048425
|
|
|
|
149775 149775 1048425
|
|
|
|
149850 149850 1048950
|
|
|
|
149775 149775 1048425
|
|
|
|
85350 85350 597450
|
|
|
|
25 25 176
|
2015-04-09 23:20:51 +00:00
|
|
|
echo /foo, bar/, /baz, qux/, | parallel -kN1 --recend ', ' --pipe echo JOB{#}\;cat\;echo END
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
/foo, END
|
|
|
|
JOB2
|
|
|
|
bar/, END
|
|
|
|
JOB3
|
|
|
|
/baz, END
|
|
|
|
JOB4
|
|
|
|
qux/,
|
|
|
|
END
|
2015-04-09 23:20:51 +00:00
|
|
|
echo /foo, bar/, /baz, qux/, | parallel -kN1 --recstart '/' --pipe echo JOB{#}\;cat\;echo END
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
/foo, barEND
|
|
|
|
JOB2
|
|
|
|
/, END
|
|
|
|
JOB3
|
|
|
|
/baz, quxEND
|
|
|
|
JOB4
|
|
|
|
/,
|
|
|
|
END
|
2015-04-09 23:20:51 +00:00
|
|
|
echo /foo, bar/, /baz, qux/, | parallel -kN1 --recend ', ' --recstart '/' --pipe echo JOB{#}\;cat\;echo END
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
/foo, bar/, END
|
|
|
|
JOB2
|
|
|
|
/baz, qux/,
|
|
|
|
END
|
2015-04-09 23:20:51 +00:00
|
|
|
echo foo,bar,_baz,__qux, | parallel -kN1 --regexp --recend ',_+' --pipe echo JOB{#}\;cat\;echo END
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
foo,bar,_END
|
|
|
|
JOB2
|
|
|
|
baz,__END
|
|
|
|
JOB3
|
|
|
|
qux,
|
|
|
|
END
|
2015-04-09 23:20:51 +00:00
|
|
|
echo foo,bar,_baz,__qux, | parallel -kN1 --rrs --regexp --recend ',_+' --pipe echo JOB{#}\;cat\;echo END
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
foo,barEND
|
|
|
|
JOB2
|
|
|
|
bazEND
|
|
|
|
JOB3
|
|
|
|
qux,
|
|
|
|
END
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num_%header | parallel --header '(%.*\n)*' --pipe -N3 echo JOB{#}\;cat
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
JOB2
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
JOB3
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
JOB4
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
10
|
2015-04-09 23:20:51 +00:00
|
|
|
cat num_%header | parallel --header 2 --pipe -N3 echo JOB{#}\;cat
|
2015-04-04 14:37:32 +00:00
|
|
|
JOB1
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
JOB2
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
JOB3
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
JOB4
|
|
|
|
%head1
|
|
|
|
%head2
|
|
|
|
10
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --pipepart -a num1000000 --block 3m wc
|
2015-04-04 14:37:32 +00:00
|
|
|
444444 444444 3000003
|
|
|
|
428572 428572 3000004
|
|
|
|
126984 126984 888889
|
2015-04-09 23:20:51 +00:00
|
|
|
cat input_file | parallel command
|
2015-04-04 14:37:32 +00:00
|
|
|
/bin/bash: This is input_file: command not found
|
2015-04-09 23:20:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#!/usr/bin/parallel --shebang -r echo
|
|
|
|
foo
|
|
|
|
bar
|
|
|
|
baz
|
|
|
|
/bin/bash: foo: command not found
|
|
|
|
/bin/bash: line 1: bar: command not found
|
|
|
|
/bin/bash: line 2: baz: command not found
|
|
|
|
cat input_file | parallel command
|
|
|
|
parallel command ::: foo bar
|
2015-04-04 14:37:32 +00:00
|
|
|
/bin/bash: This is input_file: command not found
|
|
|
|
/bin/bash: foo: command not found
|
|
|
|
/bin/bash: bar: command not found
|
2015-04-09 23:20:51 +00:00
|
|
|
cat input_file | command
|
|
|
|
command foo bar
|
|
|
|
/bin/bash: line 1: foo: command not found
|
|
|
|
#!/usr/bin/perl
|
|
|
|
print "@ARGV\n"
|
2015-04-04 14:37:32 +00:00
|
|
|
Warning: unknown mime-type for "@ARGV\n" -- using "application/octet-stream"
|
|
|
|
Error: no such file "@ARGV\n"
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel perl_echo ::: foo bar
|
2015-04-04 14:37:32 +00:00
|
|
|
/bin/bash: perl_echo: command not found
|
|
|
|
/bin/bash: perl_echo: command not found
|
2015-04-09 23:20:51 +00:00
|
|
|
#!/usr/bin/parallel --shebang-wrap /usr/bin/perl
|
|
|
|
print "@ARGV\n"
|
2015-04-04 14:37:32 +00:00
|
|
|
Warning: unknown mime-type for "@ARGV\n" -- using "application/octet-stream"
|
|
|
|
Error: no such file "@ARGV\n"
|
2015-04-09 23:20:51 +00:00
|
|
|
perl_echo foo bar
|
|
|
|
/bin/bash: perl_echo: command not found
|
|
|
|
sem 'sleep 1; echo The first finished' &&
|
|
|
|
echo The first is now running in the background &&
|
|
|
|
sem 'sleep 1; echo The second finished' &&
|
|
|
|
echo The second is now running in the background
|
|
|
|
sem --wait
|
2015-04-04 14:37:32 +00:00
|
|
|
The first is now running in the background
|
|
|
|
The first finished
|
|
|
|
The second is now running in the background
|
|
|
|
The second finished
|
2015-04-09 23:20:51 +00:00
|
|
|
sem --fg 'sleep 1; echo The first finished' &&
|
|
|
|
echo The first finished running in the foreground &&
|
|
|
|
sem --fg 'sleep 1; echo The second finished' &&
|
|
|
|
echo The second finished running in the foreground
|
|
|
|
sem --wait
|
2015-04-04 14:37:32 +00:00
|
|
|
The first finished
|
|
|
|
The first finished running in the foreground
|
|
|
|
The second finished
|
|
|
|
The second finished running in the foreground
|
2015-04-09 23:20:51 +00:00
|
|
|
sem --id my_id -u 'echo First started; sleep 10; echo The first finished'
|
2015-04-04 14:37:32 +00:00
|
|
|
First started
|
|
|
|
The first finished
|
2015-04-09 23:20:51 +00:00
|
|
|
sem --id my_id -u 'echo Second started; sleep 10; echo The second finished'
|
|
|
|
sem --jobs 3 --id my_id -u 'echo First started; sleep 5; echo The first finished' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Second started; sleep 6; echo The second finished' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Third started; sleep 7; echo The third finished' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Fourth started; sleep 8; echo The fourth finished' &&
|
|
|
|
sem --wait --id my_id
|
2015-04-04 14:37:32 +00:00
|
|
|
First started
|
|
|
|
The first finished
|
|
|
|
Third started
|
|
|
|
The second finished
|
|
|
|
Fourth started
|
|
|
|
The third finished
|
|
|
|
The fourth finished
|
2015-05-21 21:02:55 +00:00
|
|
|
sem --id foo -u 'echo Slow started; sleep 5; echo Slow ended' &&
|
|
|
|
sem --id foo --semaphoretimeout 1 'echo Force this running after 1 sec' &&
|
|
|
|
sem --id foo --semaphoretimeout -2 'echo Give up after 1 sec'
|
|
|
|
sem --id foo --wait
|
|
|
|
Slow started
|
|
|
|
Force this running after 1 sec
|
|
|
|
Slow ended
|
|
|
|
parallel: Warning: Semaphore timed out. Stealing the semaphore.
|
|
|
|
parallel: Warning: Semaphore timed out. Exiting.
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --help
|
2015-04-04 14:37:32 +00:00
|
|
|
Usage:
|
|
|
|
|
|
|
|
parallel [options] [command [arguments]] < list_of_arguments
|
|
|
|
parallel [options] [command [arguments]] (::: arguments|:::: argfile(s))...
|
|
|
|
cat ... | parallel --pipe [options] [command [arguments]]
|
|
|
|
|
|
|
|
-j n Run n jobs in parallel
|
|
|
|
-k Keep same order
|
|
|
|
-X Multiple arguments with context replace
|
|
|
|
--colsep regexp Split input on regexp for positional replacements
|
|
|
|
{} {.} {/} {/.} {#} {%} {= perl code =} Replacement strings
|
|
|
|
{3} {3.} {3/} {3/.} {=3 perl code =} Positional replacement strings
|
|
|
|
With --plus: {} = {+/}/{/} = {.}.{+.} = {+/}/{/.}.{+.} = {..}.{+..} =
|
|
|
|
{+/}/{/..}.{+..} = {...}.{+...} = {+/}/{/...}.{+...}
|
|
|
|
|
|
|
|
-S sshlogin Example: foo@server.example.com
|
|
|
|
--slf .. Use ~/.parallel/sshloginfile as the list of sshlogins
|
|
|
|
--trc {}.bar Shorthand for --transfer --return {}.bar --cleanup
|
|
|
|
--onall Run the given command with argument on all sshlogins
|
|
|
|
--nonall Run the given command with no arguments on all sshlogins
|
|
|
|
|
|
|
|
--pipe Split stdin (standard input) to multiple jobs.
|
|
|
|
--recend str Record end separator for --pipe.
|
|
|
|
--recstart str Record start separator for --pipe.
|
|
|
|
|
|
|
|
See 'man parallel' for details
|
|
|
|
|
|
|
|
Academic tradition requires you to cite works you base your article on.
|
|
|
|
When using programs that use GNU Parallel to process data for publication
|
|
|
|
please cite:
|
|
|
|
|
|
|
|
O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
|
|
|
|
;login: The USENIX Magazine, February 2011:42-47.
|
|
|
|
|
|
|
|
This helps funding further development; and it won't cost you a cent.
|
|
|
|
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.
|
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --version
|
2015-05-10 13:02:07 +00:00
|
|
|
GNU parallel VERSION
|
2015-04-04 14:37:32 +00:00
|
|
|
Copyright (C) 2007,2008,2009,2010,2011,2012,2013,2014,2015 Ole Tange
|
|
|
|
and Free Software Foundation, Inc.
|
|
|
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
|
|
|
This is free software: you are free to change and redistribute it.
|
|
|
|
GNU parallel comes with no warranty.
|
|
|
|
|
|
|
|
Web site: http://www.gnu.org/software/parallel
|
|
|
|
|
|
|
|
When using programs that use GNU Parallel to process data for publication
|
|
|
|
please cite as described in 'parallel --bibtex'.
|
2015-05-10 13:02:07 +00:00
|
|
|
parallel --minversion VERSION && echo Your version is at least VERSION.
|
|
|
|
VERSION
|
|
|
|
Your version is at least VERSION.
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --bibtex
|
2015-04-04 14:37:32 +00:00
|
|
|
Academic tradition requires you to cite works you base your article on.
|
|
|
|
When using programs that use GNU Parallel to process data for publication
|
|
|
|
please cite:
|
|
|
|
|
|
|
|
@article{Tange2011a,
|
2015-05-02 23:22:34 +00:00
|
|
|
title = {GNU Parallel - The Command-Line Power Tool},
|
|
|
|
author = {O. Tange},
|
|
|
|
address = {Frederiksberg, Denmark},
|
|
|
|
journal = {;login: The USENIX Magazine},
|
|
|
|
month = {Feb},
|
|
|
|
number = {1},
|
|
|
|
volume = {36},
|
|
|
|
url = {http://www.gnu.org/s/parallel},
|
|
|
|
year = {2011},
|
|
|
|
pages = {42-47}
|
|
|
|
doi = {10.5281/zenodo.16303}
|
2015-04-04 14:37:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
(Feel free to use \nocite{Tange2011a})
|
|
|
|
|
|
|
|
This helps funding further development; and it won't cost you a cent.
|
|
|
|
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.
|
|
|
|
|
|
|
|
If you send a copy of your published article to tange@gnu.org, it will be
|
|
|
|
mentioned in the release notes of next version of GNU Parallel.
|
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --max-line-length-allowed
|
2015-04-04 14:37:32 +00:00
|
|
|
131071
|
2015-04-09 23:20:51 +00:00
|
|
|
parallel --number-of-cpus
|
|
|
|
parallel --number-of-cores
|
2015-04-04 14:37:32 +00:00
|
|
|
1
|
|
|
|
8
|
2015-04-09 23:20:51 +00:00
|
|
|
echo '--nice 17' > ~/.parallel/nicetimeout
|
|
|
|
echo '--timeout 300%' >> ~/.parallel/nicetimeout
|
|
|
|
parallel --profile nicetimeout echo ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2015-04-09 23:20:51 +00:00
|
|
|
echo '-vv --dry-run' > ~/.parallel/dryverbose
|
|
|
|
parallel --profile dryverbose --profile nicetimeout echo ::: A B C
|
2015-04-04 14:37:32 +00:00
|
|
|
\nice -n17 /bin/bash -c echo\ A
|
|
|
|
\nice -n17 /bin/bash -c echo\ B
|
|
|
|
\nice -n17 /bin/bash -c echo\ C
|
2015-05-06 22:40:36 +00:00
|
|
|
7
|