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 | |
by marioroy (Prior) on Nov 17, 2021 at 01:48 UTC |