GUN Parallel quick start
GUN Parallel is a nice job management tool in Linux system. Detail usage of the tool can be found here. Below will give a quick start for using this tool, which took me 2 hours to figure it out.
It is easy to install it in linux system.
-Download the parallel (eg. parallel-20130622.tar.bz2) here. You can choose the latest version.
-Unzip the tar.bz2 file
-Copy the parallel perl file in path parallel-20130622/src to linux /bin/ file.
Then parallel is installed.
An example to use parallel instead of bash "for" loop. Specifically about the array usage.
Loop
#! /bin/bash
group=(a b c)
for $i in $group
do
bash test.sh $i
done
#!/bin/bash
group=(a b c)
parallel --header : bash test.sh {group} ::: group ${group[@]} #use --header
parallel bash test.sh {1} ::: ${group[@]} #not use --header
explanation: --header is used to define the name of the variable which is helpful if there are more variables for the parallel.
Note: space before and after ":::"
It is easy to install it in linux system.
-Download the parallel (eg. parallel-20130622.tar.bz2) here. You can choose the latest version.
-Unzip the tar.bz2 file
-Copy the parallel perl file in path parallel-20130622/src to linux /bin/ file.
Then parallel is installed.
An example to use parallel instead of bash "for" loop. Specifically about the array usage.
Loop
#! /bin/bash
group=(a b c)
for $i in $group
do
bash test.sh $i
done
#!/bin/bash
group=(a b c)
parallel --header : bash test.sh {group} ::: group ${group[@]} #use --header
parallel bash test.sh {1} ::: ${group[@]} #not use --header
explanation: --header is used to define the name of the variable which is helpful if there are more variables for the parallel.
Note: space before and after ":::"
Comments
Post a Comment