in reply to Splitting an array into subarrays of size ~n
See Parallel::ForkManager. As in their example:
use Parallel::ForkManager; my $pm = new Parallel::ForkManager($MAX_PROCESSES); # ... foreach my $f (@files) { if ( (-d $f) and ($f ne ".") and ($f ne "..") ){ my $pid = $pm->start and next; chdir ... system ... system ... system ... $pm->finish; } } $pm->wait_all_children;
Update Since ForkManager handles the forking, you will not need to fork/exec mdrun, a system will be fine.
Update Added call to wait_all_children
Good Day,
Dean
|
|---|