in reply to Re^3: Getting started with MCE (the Many-Core Engine)
in thread Getting started with MCE (the Many-Core Engine)
https://github.com/marioroy/mce-perl/blob/master/README.md#!/usr/bin/perl use strict; use warnings; use MCE; use MCE::Candy; my $volume = 26*26; my $max_workers = 4; my $chunk_size = int $volume / $max_workers; my @results; my $mce = MCE->new( max_workers => $max_workers, chunk_size => $chunk_size, gather => MCE::Candy::out_iter_array(\@results), user_func => sub { my ($mce, $chunk_ref, $chunk_id) = @_; my @output; foreach my $item (@{ $chunk_ref }) { push @output, $item++; } $mce->gather($chunk_id, @output); } ); $mce->process([ 'aa' .. 'zz' ]); print "$_, " for @results; print scalar @results, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Getting started with MCE (the Many-Core Engine)
by marioroy (Prior) on Jun 13, 2018 at 13:37 UTC | |
by Anonymous Monk on Jun 13, 2018 at 15:30 UTC | |
by marioroy (Prior) on Jun 13, 2018 at 20:04 UTC |