S
Stuart Kendrick
Hi,
I'm not quite sure what 'feature' i'm looking for ... any input
appreciated.
I want to parallelize a particular task.
#/usr/bin/perl -w
use strict;
my @target;
our @result;
for (my $i = 0; $i < @target; $i++) {
$result[$i] = &do_some_work($target[$i]);
}
&report_results;
....
&do_some_work requires a minute or so to complete. @target contains
several hundred elements. Therefore, total execution time runs in the
hundreds of minutes.
Also, @target is not ordered ... e.g. there are no dependencies within
@target ... if &do_some_work finishes processing $target[159] before
it starts (or finishes) $target[17], no problems.
I figure that if i could find a way to spawn lots of copies of
&do_some_work ... that i could reduce total execution time. Assuming
that my machine has sufficient resources, I might even get total
execution time down to a minute or so. This would be a major win for
me -- I would like this app to complete within ten minutes at the
outside.
What Perl 'feature' should I explore to do this? Am I walking into
'threads' here?
--sk
Stuart Kendrick
FHCRC
I'm not quite sure what 'feature' i'm looking for ... any input
appreciated.
I want to parallelize a particular task.
#/usr/bin/perl -w
use strict;
my @target;
our @result;
for (my $i = 0; $i < @target; $i++) {
$result[$i] = &do_some_work($target[$i]);
}
&report_results;
....
&do_some_work requires a minute or so to complete. @target contains
several hundred elements. Therefore, total execution time runs in the
hundreds of minutes.
Also, @target is not ordered ... e.g. there are no dependencies within
@target ... if &do_some_work finishes processing $target[159] before
it starts (or finishes) $target[17], no problems.
I figure that if i could find a way to spawn lots of copies of
&do_some_work ... that i could reduce total execution time. Assuming
that my machine has sufficient resources, I might even get total
execution time down to a minute or so. This would be a major win for
me -- I would like this app to complete within ten minutes at the
outside.
What Perl 'feature' should I explore to do this? Am I walking into
'threads' here?
--sk
Stuart Kendrick
FHCRC