GNU Parallel: Difference between revisions
No edit summary |
|||
Line 3: | Line 3: | ||
==Usage== | ==Usage== | ||
[https://www.gnu.org/software/parallel/parallel_tutorial.html parallel tutorial] | [https://www.gnu.org/software/parallel/parallel_tutorial.html parallel tutorial] | ||
* <code>-j</code> lets you manually specify the number of parallel jobs. | |||
** By default this is the number of CPU cores. | |||
** You may want to decrease this to reduce memory usage or increase it if you're not CPU/IO bound. | |||
;Progress | |||
* <code>--progress</code> shows some progress information | |||
* <code>--bar</code> shows a progress bar | |||
==Replacement strings== | ==Replacement strings== |
Revision as of 17:10, 23 April 2024
GNU Parallel is useful for running multiple processes over an input list, similar to xargs.
Usage
-j
lets you manually specify the number of parallel jobs.- By default this is the number of CPU cores.
- You may want to decrease this to reduce memory usage or increase it if you're not CPU/IO bound.
- Progress
--progress
shows some progress information--bar
shows a progress bar
Replacement strings
Parallel includes a handful of default replacement strings:
--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:\.[^/.]+$::'
- Parent dirname
--rpl '{//} s:.*/(.*)/[^/]*:\1:;'