in reply to Re^2: MCE - max_workers
in thread MCE - max_workers

Hi Ken,

MCE 1.875 was released moments ago. Folks may specify a percentage for max_workers. I enjoyed writing the MCE::Flow test in 03_max_workers.t.

use strict; use warnings; use Test::More; BEGIN { use_ok 'MCE'; use_ok 'MCE::Flow'; } { no warnings 'redefine'; sub MCE::Util::get_ncpu { return 16; } } # ... lots more tests not shown here { MCE::Flow::init(max_workers => [1, '25%']); my @res; mce_flow { gather => \@res }, sub { MCE->gather('a'.MCE->task_wid()); }, # 1 worker sub { MCE->gather('b'.MCE->task_wid()); }; # 4 workers @res = sort @res; is("@res", "a1 b1 b2 b3 b4", "check that MCE::Flow ran with 5 worke +rs"); MCE::Flow->finish(); } done_testing;

Thanks,

Replies are listed 'Best First'.
Re^4: MCE - max_workers
by kcott (Archbishop) on Nov 16, 2021 at 12:27 UTC

    G'day Mario,

    ++ Thanks for the incredibly fast response and provision of an updated version with this percentage enhancement. I'm only sorry that I'm not allowed to upvote this more than once.

    I've updated my version locally (Cygwin; Perl 5.34) without any issues at all:

    $ cpan ... cpan[1]> install MCE ... MARIOROY/MCE-1.875.tar.gz /usr/bin/make install -- OK

    [That'll you get you a green patch on the testers matrix when it's next updated.]

    Again, many thanks. I'm very impressed with your amazingly quick response.

    — Ken

      Hi Ken,

      You're very welcome! Thank you! The max_workers percentage is a nice enhancement. Yes, I see the Cygwin test. That's very cool.