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.bz2here. 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

Popular posts from this blog

install postgreSQL in ubuntu 16.04

timestamp with 16, 13 and 10 digits to Qlik date

install ipython in Cloudera VM using pip