12 November 2010

GNU Parallel

I discovered GNU Parallel today.  Phenomenal.  Especially for simple post processing on multicore systems.  Watch the video-- it is quite good.  Here are three sample commands taken from a bash script where $1 is set to be a particular prefix...

parallel --eta -j +0 ./gnuplot.sh -g -F {} $1.r???? ::: `seq 1 8`
Runs a custom gnuplot-based shell script eight times against a file glob.  Each time provide a different argument in the  set {1,2,...,7,8}.  The results are stored as $1.f1.gif, $1.f2.gif, etc.
ls -1 $1.r???? | parallel --eta -j +0 'montage -geometry 1280x960 -tile 4x2 {}.f?.gif {}.miff'
Create a tiled montage of the eight output files mentioned above and store the result in $1.miff.
ls -1 $1.r???? | parallel --eta -j +0 'convert {}.miff {}.gif'
Convert the resulting MIFFs into GIFs.

I win.  On my system, 8 - 0.

No comments:

Subscribe Subscribe to The Return of Agent Zlerich