Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to get Perl to use all CPU cores
with MCE. I have read and tried some
examples but can't
seem to grasp it. Can anyone explain MCE
for dummies? I was hoping this would produce a
large number but it only prints 0:
#!/usr/bin/perl use strict; use warnings; use MCE::Loop; our $fu = 0; MCE::Loop::init { max_workers => 8, chunk_size => 1000 }; mce_loop { do_work($_) } 1..10000000; print "Done: $fu\n"; sub do_work { $fu += $_[0] }
Back to
Seekers of Perl Wisdom