NAME

cpumax - Run as many commands as there are CPUs


SYNOPSIS

cpumax [OPTIONS]

cpumax reads command lines from STDIN, and runs as many in parallel as there are available CPUs.


DESCRIPTION

maxcpu reads command lines from STDIN, and executes as many in parallel as there are detected CPUs.

To portably detect how many CPUs are available, the POSIX system call ``sysconf'' is available. Unfortunately, Perl's POSIX module doesn't include the constant required for CPU detection (_SC_NPROCESSORS_ONLN). As a result, maxcpu uses Inline::C to execute the detection function.


OPTIONS

-c, --cpus=NUM
Override the number of detected CPUs.

-d, --debug
Turns on process debugging.

-v, --verbose
Reports commands as they are executed.

-h, --help
Shows help documentation.

-V, --version
Reports version


EXAMPLE

To execute CPU-intensive tasks in parallel, a list of tasks can be created by the shell and fed into maxcpu:

        (for i in *.jpg; do
                echo convert -geometry 640x480 -quality 70 $i $i
        done) | maxcpu


AUTHOR

 Kees Cook, <kees@outflux.net>


SEE ALSO

perl(1), sysconf(3), Inline::C(1).


COPYRIGHT

maxcpu is Copyright (c) 2003, by Kees Cook, <kees@outflux.net>.

All rights reserved. You may distribute this code under the terms of the GNU General Public License.