summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2021-11-20 17:44:02 +0100
committergregor herrmann <gregoa@debian.org>2021-11-20 17:44:02 +0100
commit50c542895e2c980b3688284a53f500f409d455ab (patch)
tree917ab0f10a4db55dc8665f42463405f0847798bb
parent76d5ee9009939f9ec7b4b5520e9cad0e8c999d8e (diff)
parentac6e1436b70fdbb80d202c253f360147cad9fea9 (diff)
Update upstream source from tag 'upstream/1.875'
Update to upstream version '1.875' with Debian dir c303594660f7badc257fab5f0400d7e2767dfd78
-rw-r--r--Changes8
-rw-r--r--MANIFEST1
-rw-r--r--META.json62
-rw-r--r--META.yml62
-rw-r--r--Makefile.PL62
-rw-r--r--README.md4
-rw-r--r--lib/MCE.pm2
-rw-r--r--lib/MCE.pod4
-rw-r--r--lib/MCE/Candy.pm4
-rw-r--r--lib/MCE/Channel.pm6
-rw-r--r--lib/MCE/Channel/Mutex.pm4
-rw-r--r--lib/MCE/Channel/Simple.pm4
-rw-r--r--lib/MCE/Channel/Threads.pm4
-rw-r--r--lib/MCE/Child.pm4
-rw-r--r--lib/MCE/Core.pod20
-rw-r--r--lib/MCE/Core/Input/Generator.pm4
-rw-r--r--lib/MCE/Core/Input/Handle.pm4
-rw-r--r--lib/MCE/Core/Input/Iterator.pm4
-rw-r--r--lib/MCE/Core/Input/Request.pm4
-rw-r--r--lib/MCE/Core/Input/Sequence.pm4
-rw-r--r--lib/MCE/Core/Manager.pm4
-rw-r--r--lib/MCE/Core/Validation.pm14
-rw-r--r--lib/MCE/Core/Worker.pm4
-rw-r--r--lib/MCE/Examples.pod2
-rw-r--r--lib/MCE/Flow.pm4
-rw-r--r--lib/MCE/Grep.pm4
-rw-r--r--lib/MCE/Loop.pm4
-rw-r--r--lib/MCE/Map.pm4
-rw-r--r--lib/MCE/Mutex.pm4
-rw-r--r--lib/MCE/Mutex/Channel.pm4
-rw-r--r--lib/MCE/Mutex/Channel2.pm4
-rw-r--r--lib/MCE/Mutex/Flock.pm4
-rw-r--r--lib/MCE/Queue.pm4
-rw-r--r--lib/MCE/Relay.pm4
-rw-r--r--lib/MCE/Signal.pm4
-rw-r--r--lib/MCE/Step.pm4
-rw-r--r--lib/MCE/Stream.pm4
-rw-r--r--lib/MCE/Subs.pm4
-rw-r--r--lib/MCE/Util.pm4
-rw-r--r--t/03_max_workers.t155
40 files changed, 342 insertions, 168 deletions
diff --git a/Changes b/Changes
index bb5b97d..df9bb57 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,14 @@
Revision history for Perl module MCE.
+1.875 Tue Nov 16 04:00:00 EST 2021
+
+ * Specify a percentage for max_workers.
+ Thank you, kcott@PerlMonks (Ken) for the idea.
+ https://www.perlmonks.org/?node_id=11134439
+
+ * Added t/03_max_workers.t
+
1.874 Tue Aug 18 16:00:00 EST 2020
* Improved MCE->yield when used together with MCE::Relay.
diff --git a/MANIFEST b/MANIFEST
index ca99c68..a8dfbe4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -53,6 +53,7 @@ t/01_mutex_flock.t
t/02_do_callback_args.t
t/02_do_callback_result.t
t/03_chunk_size.t
+t/03_max_workers.t
t/03_user_args.t
t/04_norm_que_manager.t
t/04_norm_que_worker.t
diff --git a/META.json b/META.json
index 1044eef..59628ca 100644
--- a/META.json
+++ b/META.json
@@ -65,123 +65,123 @@
"provides" : {
"MCE" : {
"file" : "lib/MCE.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Candy" : {
"file" : "lib/MCE/Candy.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Channel" : {
"file" : "lib/MCE/Channel.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Channel::Mutex" : {
"file" : "lib/MCE/Channel/Mutex.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Channel::Simple" : {
"file" : "lib/MCE/Channel/Simple.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Channel::Threads" : {
"file" : "lib/MCE/Channel/Threads.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Child" : {
"file" : "lib/MCE/Child.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Input::Generator" : {
"file" : "lib/MCE/Core/Input/Generator.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Input::Handle" : {
"file" : "lib/MCE/Core/Input/Handle.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Input::Iterator" : {
"file" : "lib/MCE/Core/Input/Iterator.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Input::Request" : {
"file" : "lib/MCE/Core/Input/Request.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Input::Sequence" : {
"file" : "lib/MCE/Core/Input/Sequence.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Manager" : {
"file" : "lib/MCE/Core/Manager.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Validation" : {
"file" : "lib/MCE/Core/Validation.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Core::Worker" : {
"file" : "lib/MCE/Core/Worker.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Flow" : {
"file" : "lib/MCE/Flow.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Grep" : {
"file" : "lib/MCE/Grep.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Loop" : {
"file" : "lib/MCE/Loop.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Map" : {
"file" : "lib/MCE/Map.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Mutex" : {
"file" : "lib/MCE/Mutex.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Mutex::Channel" : {
"file" : "lib/MCE/Mutex/Channel.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Mutex::Channel2" : {
"file" : "lib/MCE/Mutex/Channel2.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Mutex::Flock" : {
"file" : "lib/MCE/Mutex/Flock.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Queue" : {
"file" : "lib/MCE/Queue.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Relay" : {
"file" : "lib/MCE/Relay.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Signal" : {
"file" : "lib/MCE/Signal.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Step" : {
"file" : "lib/MCE/Step.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Stream" : {
"file" : "lib/MCE/Stream.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Subs" : {
"file" : "lib/MCE/Subs.pm",
- "version" : "1.874"
+ "version" : "1.875"
},
"MCE::Util" : {
"file" : "lib/MCE/Util.pm",
- "version" : "1.874"
+ "version" : "1.875"
}
},
"release_status" : "stable",
@@ -197,5 +197,5 @@
"url" : "https://github.com/marioroy/mce-perl.git"
}
},
- "version" : "1.874"
+ "version" : "1.875"
}
diff --git a/META.yml b/META.yml
index 642a068..3b79292 100644
--- a/META.yml
+++ b/META.yml
@@ -25,94 +25,94 @@ no_index:
provides:
MCE:
file: lib/MCE.pm
- version: '1.874'
+ version: '1.875'
MCE::Candy:
file: lib/MCE/Candy.pm
- version: '1.874'
+ version: '1.875'
MCE::Channel:
file: lib/MCE/Channel.pm
- version: '1.874'
+ version: '1.875'
MCE::Channel::Mutex:
file: lib/MCE/Channel/Mutex.pm
- version: '1.874'
+ version: '1.875'
MCE::Channel::Simple:
file: lib/MCE/Channel/Simple.pm
- version: '1.874'
+ version: '1.875'
MCE::Channel::Threads:
file: lib/MCE/Channel/Threads.pm
- version: '1.874'
+ version: '1.875'
MCE::Child:
file: lib/MCE/Child.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Input::Generator:
file: lib/MCE/Core/Input/Generator.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Input::Handle:
file: lib/MCE/Core/Input/Handle.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Input::Iterator:
file: lib/MCE/Core/Input/Iterator.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Input::Request:
file: lib/MCE/Core/Input/Request.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Input::Sequence:
file: lib/MCE/Core/Input/Sequence.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Manager:
file: lib/MCE/Core/Manager.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Validation:
file: lib/MCE/Core/Validation.pm
- version: '1.874'
+ version: '1.875'
MCE::Core::Worker:
file: lib/MCE/Core/Worker.pm
- version: '1.874'
+ version: '1.875'
MCE::Flow:
file: lib/MCE/Flow.pm
- version: '1.874'
+ version: '1.875'
MCE::Grep:
file: lib/MCE/Grep.pm
- version: '1.874'
+ version: '1.875'
MCE::Loop:
file: lib/MCE/Loop.pm
- version: '1.874'
+ version: '1.875'
MCE::Map:
file: lib/MCE/Map.pm
- version: '1.874'
+ version: '1.875'
MCE::Mutex:
file: lib/MCE/Mutex.pm
- version: '1.874'
+ version: '1.875'
MCE::Mutex::Channel:
file: lib/MCE/Mutex/Channel.pm
- version: '1.874'
+ version: '1.875'
MCE::Mutex::Channel2:
file: lib/MCE/Mutex/Channel2.pm
- version: '1.874'
+ version: '1.875'
MCE::Mutex::Flock:
file: lib/MCE/Mutex/Flock.pm
- version: '1.874'
+ version: '1.875'
MCE::Queue:
file: lib/MCE/Queue.pm
- version: '1.874'
+ version: '1.875'
MCE::Relay:
file: lib/MCE/Relay.pm
- version: '1.874'
+ version: '1.875'
MCE::Signal:
file: lib/MCE/Signal.pm
- version: '1.874'
+ version: '1.875'
MCE::Step:
file: lib/MCE/Step.pm
- version: '1.874'
+ version: '1.875'
MCE::Stream:
file: lib/MCE/Stream.pm
- version: '1.874'
+ version: '1.875'
MCE::Subs:
file: lib/MCE/Subs.pm
- version: '1.874'
+ version: '1.875'
MCE::Util:
file: lib/MCE/Util.pm
- version: '1.874'
+ version: '1.875'
recommends:
Sereal::Decoder: '3.015'
Sereal::Encoder: '3.015'
@@ -139,4 +139,4 @@ resources:
homepage: https://github.com/marioroy/mce-perl
license: http://dev.perl.org/licenses/
repository: https://github.com/marioroy/mce-perl.git
-version: '1.874'
+version: '1.875'
diff --git a/Makefile.PL b/Makefile.PL
index 1d82a04..a326756 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -17,7 +17,7 @@ WriteMakefile(
ABSTRACT => 'Many-Core Engine for Perl providing parallel processing capabilities',
AUTHOR => 'Mario E. Roy <marioeroy AT gmail DOT com>',
NAME => 'MCE',
- VERSION => '1.874',
+ VERSION => '1.875',
EXE_FILES => [ @exe_files ],
@@ -68,123 +68,123 @@ WriteMakefile(
'provides' => {
'MCE' => {
'file' => 'lib/MCE.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Candy' => {
'file' => 'lib/MCE/Candy.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Channel' => {
'file' => 'lib/MCE/Channel.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Channel::Mutex' => {
'file' => 'lib/MCE/Channel/Mutex.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Channel::Simple' => {
'file' => 'lib/MCE/Channel/Simple.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Channel::Threads' => {
'file' => 'lib/MCE/Channel/Threads.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Child' => {
'file' => 'lib/MCE/Child.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Input::Generator' => {
'file' => 'lib/MCE/Core/Input/Generator.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Input::Handle' => {
'file' => 'lib/MCE/Core/Input/Handle.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Input::Iterator' => {
'file' => 'lib/MCE/Core/Input/Iterator.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Input::Request' => {
'file' => 'lib/MCE/Core/Input/Request.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Input::Sequence' => {
'file' => 'lib/MCE/Core/Input/Sequence.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Manager' => {
'file' => 'lib/MCE/Core/Manager.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Validation' => {
'file' => 'lib/MCE/Core/Validation.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Core::Worker' => {
'file' => 'lib/MCE/Core/Worker.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Flow' => {
'file' => 'lib/MCE/Flow.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Grep' => {
'file' => 'lib/MCE/Grep.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Loop' => {
'file' => 'lib/MCE/Loop.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Map' => {
'file' => 'lib/MCE/Map.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Mutex' => {
'file' => 'lib/MCE/Mutex.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Mutex::Channel' => {
'file' => 'lib/MCE/Mutex/Channel.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Mutex::Channel2' => {
'file' => 'lib/MCE/Mutex/Channel2.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Mutex::Flock' => {
'file' => 'lib/MCE/Mutex/Flock.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Queue' => {
'file' => 'lib/MCE/Queue.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Relay' => {
'file' => 'lib/MCE/Relay.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Signal' => {
'file' => 'lib/MCE/Signal.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Step' => {
'file' => 'lib/MCE/Step.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Stream' => {
'file' => 'lib/MCE/Stream.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Subs' => {
'file' => 'lib/MCE/Subs.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
},
'MCE::Util' => {
'file' => 'lib/MCE/Util.pm',
- 'version' => '1.874'
+ 'version' => '1.875'
}
},
'prereqs' => {
diff --git a/README.md b/README.md
index e4334e5..b3af8e6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## Many-Core Engine for Perl
-This document describes MCE version 1.874.
+This document describes MCE version 1.875.
Many-Core Engine (MCE) for Perl helps enable a new level of performance by
maximizing all available cores.
@@ -177,7 +177,7 @@ for more recipes.
### Copyright and Licensing
-Copyright (C) 2012-2020 by Mario E. Roy <marioeroy AT gmail DOT com>
+Copyright (C) 2012-2021 by Mario E. Roy <marioeroy AT gmail DOT com>
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself:
diff --git a/lib/MCE.pm b/lib/MCE.pm
index cf31729..1f2c788 100644
--- a/lib/MCE.pm
+++ b/lib/MCE.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
diff --git a/lib/MCE.pod b/lib/MCE.pod
index e2f9352..c550d7b 100644
--- a/lib/MCE.pod
+++ b/lib/MCE.pod
@@ -5,7 +5,7 @@ MCE - Many-Core Engine for Perl providing parallel processing capabilities
=head1 VERSION
-This document describes MCE version 1.874
+This document describes MCE version 1.875
Many-Core Engine (MCE) for Perl helps enable a new level of performance by
maximizing all available cores.
@@ -301,7 +301,7 @@ Mario E. Roy, S<E<lt>marioeroy AT gmail DOT comE<gt>>
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2012-2020 by Mario E. Roy
+Copyright (C) 2012-2021 by Mario E. Roy
MCE is released under the same license as Perl.
diff --git a/lib/MCE/Candy.pm b/lib/MCE/Candy.pm
index 95f8c73..5f72a26 100644
--- a/lib/MCE/Candy.pm
+++ b/lib/MCE/Candy.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
our @CARP_NOT = qw( MCE );
@@ -240,7 +240,7 @@ MCE::Candy - Sugar methods and output iterators
=head1 VERSION
-This document describes MCE::Candy version 1.874
+This document describes MCE::Candy version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Channel.pm b/lib/MCE/Channel.pm
index ece501d..2b515a8 100644
--- a/lib/MCE/Channel.pm
+++ b/lib/MCE/Channel.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (TestingAndDebugging::ProhibitNoStrict)
@@ -127,7 +127,7 @@ MCE::Channel - Queue-like and two-way communication capability
=head1 VERSION
-This document describes MCE::Channel version 1.874
+This document describes MCE::Channel version 1.875
=head1 SYNOPSIS
@@ -713,7 +713,7 @@ Mario E. Roy, S<E<lt>marioeroy AT gmail DOT comE<gt>>
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2019-2020 by Mario E. Roy
+Copyright (C) 2019-2021 by Mario E. Roy
MCE::Channel is released under the same license as Perl.
diff --git a/lib/MCE/Channel/Mutex.pm b/lib/MCE/Channel/Mutex.pm
index bb6d251..b7f8095 100644
--- a/lib/MCE/Channel/Mutex.pm
+++ b/lib/MCE/Channel/Mutex.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use base 'MCE::Channel';
use MCE::Mutex ();
@@ -304,7 +304,7 @@ MCE::Channel::Mutex - Channel for producer(s) and many consumers
=head1 VERSION
-This document describes MCE::Channel::Mutex version 1.874
+This document describes MCE::Channel::Mutex version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Channel/Simple.pm b/lib/MCE/Channel/Simple.pm
index 443f1cb..13d4309 100644
--- a/lib/MCE/Channel/Simple.pm
+++ b/lib/MCE/Channel/Simple.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use base 'MCE::Channel';
@@ -300,7 +300,7 @@ MCE::Channel::Simple - Channel tuned for one producer and one consumer
=head1 VERSION
-This document describes MCE::Channel::Simple version 1.874
+This document describes MCE::Channel::Simple version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Channel/Threads.pm b/lib/MCE/Channel/Threads.pm
index cc0a7b5..e408d0a 100644
--- a/lib/MCE/Channel/Threads.pm
+++ b/lib/MCE/Channel/Threads.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use threads;
use threads::shared;
@@ -320,7 +320,7 @@ MCE::Channel::Threads - Channel for producer(s) and many consumers
=head1 VERSION
-This document describes MCE::Channel::Threads version 1.874
+This document describes MCE::Channel::Threads version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Child.pm b/lib/MCE/Child.pm
index 1c7d193..54113e2 100644
--- a/lib/MCE/Child.pm
+++ b/lib/MCE/Child.pm
@@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized once redefine );
package MCE::Child;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitExplicitReturnUndef)
@@ -982,7 +982,7 @@ MCE::Child - A threads-like parallelization module compatible with Perl 5.8
=head1 VERSION
-This document describes MCE::Child version 1.874
+This document describes MCE::Child version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Core.pod b/lib/MCE/Core.pod
index 7379d1b..34c8641 100644
--- a/lib/MCE/Core.pod
+++ b/lib/MCE/Core.pod
@@ -5,7 +5,7 @@ MCE::Core - Documentation describing the core MCE API
=head1 VERSION
-This document describes MCE::Core version 1.874
+This document describes MCE::Core version 1.875
=head1 SYNOPSIS
@@ -52,17 +52,19 @@ Below, a new instance is configured with all available options.
max_workers => 8, ## Default 1
- # Number of workers to spawn. This can be set automatically
- # with MCE 1.412 and later releases.
-
- # MCE 1.521 sets an upper-limit of 8 for 'auto'.
- # See MCE::Util::get_ncpu for more info.
+ # Number of workers to spawn.
+ # MCE sets an upper-limit of 8 for 'auto'. MCE 1.521+.
# max_workers => 'auto', ## # of lcores, 8 maximum
- # max_workers => 'auto-1', ## 7 on HW with 16-lcores
- # max_workers => 'auto-1', ## 3 on HW with 4-lcores
+ # max_workers => 'auto-1', ## 7 on HW with 16 lcores
+ # max_workers => 'auto-1', ## 3 on HW with 4 lcores
+
+ # Specify a percentage. MCE 1.875+.
+ # max_workers => '25%', ## 4 on HW with 16 lcores
+ # max_workers => '50%', ## 8 on HW with 16 lcores
- # max_workers => MCE::Util::get_ncpu, # run on all lcores
+ # Run on all logical cores.
+ # max_workers => MCE::Util::get_ncpu(),
chunk_size => 2000, ## Default 1
diff --git a/lib/MCE/Core/Input/Generator.pm b/lib/MCE/Core/Input/Generator.pm
index f3a2118..1df47ff 100644
--- a/lib/MCE/Core/Input/Generator.pm
+++ b/lib/MCE/Core/Input/Generator.pm
@@ -15,7 +15,7 @@ package MCE::Core::Input::Generator;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -220,7 +220,7 @@ MCE::Core::Input::Generator - Sequence of numbers (for task_id > 0)
=head1 VERSION
-This document describes MCE::Core::Input::Generator version 1.874
+This document describes MCE::Core::Input::Generator version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Input/Handle.pm b/lib/MCE/Core/Input/Handle.pm
index 21a3ba5..9a6a5e2 100644
--- a/lib/MCE/Core/Input/Handle.pm
+++ b/lib/MCE/Core/Input/Handle.pm
@@ -14,7 +14,7 @@ package MCE::Core::Input::Handle;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -280,7 +280,7 @@ MCE::Core::Input::Handle - File path and Scalar reference input reader
=head1 VERSION
-This document describes MCE::Core::Input::Handle version 1.874
+This document describes MCE::Core::Input::Handle version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Input/Iterator.pm b/lib/MCE/Core/Input/Iterator.pm
index 92bc8e8..22db9d0 100644
--- a/lib/MCE/Core/Input/Iterator.pm
+++ b/lib/MCE/Core/Input/Iterator.pm
@@ -14,7 +14,7 @@ package MCE::Core::Input::Iterator;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -128,7 +128,7 @@ MCE::Core::Input::Iterator - Iterator reader
=head1 VERSION
-This document describes MCE::Core::Input::Iterator version 1.874
+This document describes MCE::Core::Input::Iterator version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Input/Request.pm b/lib/MCE/Core/Input/Request.pm
index 8e5fb14..226b1ae 100644
--- a/lib/MCE/Core/Input/Request.pm
+++ b/lib/MCE/Core/Input/Request.pm
@@ -14,7 +14,7 @@ package MCE::Core::Input::Request;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -199,7 +199,7 @@ MCE::Core::Input::Request - Array reference and Glob reference input reader
=head1 VERSION
-This document describes MCE::Core::Input::Request version 1.874
+This document describes MCE::Core::Input::Request version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Input/Sequence.pm b/lib/MCE/Core/Input/Sequence.pm
index 99bb0b9..b61de7a 100644
--- a/lib/MCE/Core/Input/Sequence.pm
+++ b/lib/MCE/Core/Input/Sequence.pm
@@ -14,7 +14,7 @@ package MCE::Core::Input::Sequence;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -231,7 +231,7 @@ MCE::Core::Input::Sequence - Sequence of numbers (for task_id == 0)
=head1 VERSION
-This document describes MCE::Core::Input::Sequence version 1.874
+This document describes MCE::Core::Input::Sequence version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Manager.pm b/lib/MCE/Core/Manager.pm
index e4e3056..a5974d5 100644
--- a/lib/MCE/Core/Manager.pm
+++ b/lib/MCE/Core/Manager.pm
@@ -14,7 +14,7 @@ package MCE::Core::Manager;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (TestingAndDebugging::ProhibitNoStrict)
@@ -1041,7 +1041,7 @@ MCE::Core::Manager - Core methods for the manager process
=head1 VERSION
-This document describes MCE::Core::Manager version 1.874
+This document describes MCE::Core::Manager version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Validation.pm b/lib/MCE/Core/Validation.pm
index edebc42..c9f3e2a 100644
--- a/lib/MCE/Core/Validation.pm
+++ b/lib/MCE/Core/Validation.pm
@@ -14,7 +14,7 @@ package MCE::Core::Validation;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## Items below are folded into MCE.
@@ -347,7 +347,7 @@ sub _parse_max_workers {
$_ncpu_ul = $_ncpu = MCE::Util::get_ncpu();
$_ncpu_ul = 8 if ($_ncpu_ul > 8);
- if ($1 && $2) {
+ if (defined($1) && defined($2)) {
local $@; $_max_workers = eval "int($_ncpu_ul $1 $2 + 0.5)"; ## no critic
$_max_workers = 1 if (!$_max_workers || $_max_workers < 1);
$_max_workers = $_ncpu if ($_max_workers > $_ncpu);
@@ -356,6 +356,14 @@ sub _parse_max_workers {
$_max_workers = $_ncpu_ul;
}
}
+ elsif ($_max_workers =~ /^([0-9.]+)%$/) {
+ my $_percent = $1 / 100;
+ my $_ncpu = MCE::Util::get_ncpu();
+
+ $_max_workers = int($_ncpu * $_percent + 0.5);
+ $_max_workers = 1 if ($_max_workers < 1);
+ $_max_workers = $_ncpu if ($_max_workers > $_ncpu);
+ }
return $_max_workers;
}
@@ -391,7 +399,7 @@ MCE::Core::Validation - Core validation methods for Many-Core Engine
=head1 VERSION
-This document describes MCE::Core::Validation version 1.874
+This document describes MCE::Core::Validation version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Core/Worker.pm b/lib/MCE/Core/Worker.pm
index 8725c45..45f1091 100644
--- a/lib/MCE/Core/Worker.pm
+++ b/lib/MCE/Core/Worker.pm
@@ -14,7 +14,7 @@ package MCE::Core::Worker;
use strict;
use warnings;
-our $VERSION = '1.874';
+our $VERSION = '1.875';
my $_tid = $INC{'threads.pm'} ? threads->tid() : 0;
@@ -714,7 +714,7 @@ MCE::Core::Worker - Core methods for the worker process
=head1 VERSION
-This document describes MCE::Core::Worker version 1.874
+This document describes MCE::Core::Worker version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Examples.pod b/lib/MCE/Examples.pod
index fcdce12..f55b131 100644
--- a/lib/MCE/Examples.pod
+++ b/lib/MCE/Examples.pod
@@ -5,7 +5,7 @@ MCE::Examples - Various examples and demonstrations
=head1 VERSION
-This document describes MCE::Examples version 1.874
+This document describes MCE::Examples version 1.875
=head1 INCLUDED WITH THE DISTRIBUTION
diff --git a/lib/MCE/Flow.pm b/lib/MCE/Flow.pm
index 2c8cc74..ebf171c 100644
--- a/lib/MCE/Flow.pm
+++ b/lib/MCE/Flow.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -479,7 +479,7 @@ MCE::Flow - Parallel flow model for building creative applications
=head1 VERSION
-This document describes MCE::Flow version 1.874
+This document describes MCE::Flow version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Grep.pm b/lib/MCE/Grep.pm
index 6ca1a23..7fe1c96 100644
--- a/lib/MCE/Grep.pm
+++ b/lib/MCE/Grep.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -434,7 +434,7 @@ MCE::Grep - Parallel grep model similar to the native grep function
=head1 VERSION
-This document describes MCE::Grep version 1.874
+This document describes MCE::Grep version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Loop.pm b/lib/MCE/Loop.pm
index 014ba97..e809d55 100644
--- a/lib/MCE/Loop.pm
+++ b/lib/MCE/Loop.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -349,7 +349,7 @@ MCE::Loop - MCE model for building parallel loops
=head1 VERSION
-This document describes MCE::Loop version 1.874
+This document describes MCE::Loop version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Map.pm b/lib/MCE/Map.pm
index 7b34758..98ca1f8 100644
--- a/lib/MCE/Map.pm
+++ b/lib/MCE/Map.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -434,7 +434,7 @@ MCE::Map - Parallel map model similar to the native map function
=head1 VERSION
-This document describes MCE::Map version 1.874
+This document describes MCE::Map version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Mutex.pm b/lib/MCE/Mutex.pm
index a7da981..36122d5 100644
--- a/lib/MCE/Mutex.pm
+++ b/lib/MCE/Mutex.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (TestingAndDebugging::ProhibitNoStrict)
@@ -76,7 +76,7 @@ MCE::Mutex - Locking for Many-Core Engine
=head1 VERSION
-This document describes MCE::Mutex version 1.874
+This document describes MCE::Mutex version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Mutex/Channel.pm b/lib/MCE/Mutex/Channel.pm
index 54b416a..9e80a3d 100644
--- a/lib/MCE/Mutex/Channel.pm
+++ b/lib/MCE/Mutex/Channel.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use base 'MCE::Mutex';
use Scalar::Util qw(weaken);
@@ -139,7 +139,7 @@ MCE::Mutex::Channel - Mutex locking via a pipe or socket
=head1 VERSION
-This document describes MCE::Mutex::Channel version 1.874
+This document describes MCE::Mutex::Channel version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Mutex/Channel2.pm b/lib/MCE/Mutex/Channel2.pm
index 0b8f64e..e8b940b 100644
--- a/lib/MCE/Mutex/Channel2.pm
+++ b/lib/MCE/Mutex/Channel2.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use base 'MCE::Mutex::Channel';
use MCE::Util ();
@@ -116,7 +116,7 @@ MCE::Mutex::Channel2 - Provides two mutexes using a single channel
=head1 VERSION
-This document describes MCE::Mutex::Channel2 version 1.874
+This document describes MCE::Mutex::Channel2 version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Mutex/Flock.pm b/lib/MCE/Mutex/Flock.pm
index 57c1dad..14f05e8 100644
--- a/lib/MCE/Mutex/Flock.pm
+++ b/lib/MCE/Mutex/Flock.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
use base 'MCE::Mutex';
use Fcntl ':flock';
@@ -183,7 +183,7 @@ MCE::Mutex::Flock - Mutex locking via Fcntl
=head1 VERSION
-This document describes MCE::Mutex::Flock version 1.874
+This document describes MCE::Mutex::Flock version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Queue.pm b/lib/MCE/Queue.pm
index e51e6bc..e302bce 100644
--- a/lib/MCE/Queue.pm
+++ b/lib/MCE/Queue.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (Subroutines::ProhibitExplicitReturnUndef)
## no critic (TestingAndDebugging::ProhibitNoStrict)
@@ -1395,7 +1395,7 @@ MCE::Queue - Hybrid (normal and priority) queues
=head1 VERSION
-This document describes MCE::Queue version 1.874
+This document describes MCE::Queue version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Relay.pm b/lib/MCE/Relay.pm
index 4a4672d..dcc6f33 100644
--- a/lib/MCE/Relay.pm
+++ b/lib/MCE/Relay.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized numeric );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -368,7 +368,7 @@ MCE::Relay - Extends Many-Core Engine with relay capabilities
=head1 VERSION
-This document describes MCE::Relay version 1.874
+This document describes MCE::Relay version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Signal.pm b/lib/MCE/Signal.pm
index 8706c18..3036d53 100644
--- a/lib/MCE/Signal.pm
+++ b/lib/MCE/Signal.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized once );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
@@ -438,7 +438,7 @@ MCE::Signal - Temporary directory creation/cleanup and signal handling
=head1 VERSION
-This document describes MCE::Signal version 1.874
+This document describes MCE::Signal version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Step.pm b/lib/MCE/Step.pm
index 10ecab4..30cb292 100644
--- a/lib/MCE/Step.pm
+++ b/lib/MCE/Step.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -697,7 +697,7 @@ MCE::Step - Parallel step model for building creative steps
=head1 VERSION
-This document describes MCE::Step version 1.874
+This document describes MCE::Step version 1.875
=head1 DESCRIPTION
diff --git a/lib/MCE/Stream.pm b/lib/MCE/Stream.pm
index 7dcdacf..e148cd1 100644
--- a/lib/MCE/Stream.pm
+++ b/lib/MCE/Stream.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
## no critic (Subroutines::ProhibitSubroutinePrototypes)
@@ -671,7 +671,7 @@ MCE::Stream - Parallel stream model for chaining multiple maps and greps
=head1 VERSION
-This document describes MCE::Stream version 1.874
+This document describes MCE::Stream version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Subs.pm b/lib/MCE/Subs.pm
index c376491..9aeb8f2 100644
--- a/lib/MCE/Subs.pm
+++ b/lib/MCE/Subs.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (Subroutines::ProhibitSubroutinePrototypes)
## no critic (TestingAndDebugging::ProhibitNoStrict)
@@ -204,7 +204,7 @@ MCE::Subs - Exports functions mapped directly to MCE methods
=head1 VERSION
-This document describes MCE::Subs version 1.874
+This document describes MCE::Subs version 1.875
=head1 SYNOPSIS
diff --git a/lib/MCE/Util.pm b/lib/MCE/Util.pm
index c85b687..53dd46b 100644
--- a/lib/MCE/Util.pm
+++ b/lib/MCE/Util.pm
@@ -11,7 +11,7 @@ use warnings;
no warnings qw( threads recursion uninitialized numeric );
-our $VERSION = '1.874';
+our $VERSION = '1.875';
## no critic (BuiltinFunctions::ProhibitStringyEval)
@@ -429,7 +429,7 @@ MCE::Util - Utility functions
=head1 VERSION
-This document describes MCE::Util version 1.874
+This document describes MCE::Util version 1.875
=head1 SYNOPSIS
diff --git a/t/03_max_workers.t b/t/03_max_workers.t
new file mode 100644
index 0000000..bc183ff
--- /dev/null
+++ b/t/03_max_workers.t
@@ -0,0 +1,155 @@
+#!/usr/bin/env perl
+
+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; }
+}
+
+{
+ # Going higher than the HW ncpu limit is possible. Simply specify the
+ # number of workers desired. The minimum number of workers is 1.
+
+ my $mce = MCE->new(max_workers => 0);
+ is($mce->max_workers(), 1, "check that max_workers=>0 is 1");
+
+ $mce = MCE->new(max_workers => 5);
+ is($mce->max_workers(), 5, "check that max_workers=>5 is 5");
+
+ $mce = MCE->new(max_workers => 20);
+ is($mce->max_workers(), 20, "check that max_workers=>20 is 20");
+}
+
+{
+ # The limit for 'auto' is 8 including on HW with more than 8 logical cores.
+ # The minimum number of workers is 1.
+
+ my $mce = MCE->new(max_workers => 'auto');
+ is($mce->max_workers(), 8,
+ "check that max_workers=>'auto' is 8 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto-8');
+ is($mce->max_workers(), 1,
+ "check that max_workers=>'auto-8' is 1 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto-1');
+ is($mce->max_workers(), 7,
+ "check that max_workers=>'auto-1' is 7 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto+1');
+ is($mce->max_workers(), 9,
+ "check that max_workers=>'auto+1' is 9 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto/2');
+ is($mce->max_workers(), 4,
+ "check that max_workers=>'auto/2' is 4 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto*0');
+ is($mce->max_workers(), 1,
+ "check that max_workers=>'auto*0' is 1 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => 'auto*2');
+ is($mce->max_workers(), 16,
+ "check that max_workers=>'auto*2' is 16 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(user_tasks => [
+ { max_workers => 1 },
+ { max_workers => 'auto/2' },
+ { max_workers => 'auto+2' },
+ ]);
+
+ is($mce->{user_tasks}[0]{max_workers}, 1,
+ "check that task 0 max_workers=>'1' is 1 on HW with 16 logical cores"
+ );
+ is($mce->{user_tasks}[1]{max_workers}, 4,
+ "check that task 1 max_workers=>'auto/2' is 4 on HW with 16 logical cores"
+ );
+ is($mce->{user_tasks}[2]{max_workers}, 10,
+ "check that task 2 max_workers=>'auto+2' is 10 on HW with 16 logical cores"
+ );
+}
+
+{
+ # One may specify a percentage starting with MCE 1.875.
+ # Thanks to kcott@PerlMonks (Ken) for the idea.
+ # https://www.perlmonks.org/?node_id=11134439
+ # The min-max number of workers is 1 and MCE::Util::get_ncpu().
+
+ my $mce = MCE->new(max_workers => '0%');
+ is($mce->max_workers(), 1,
+ "check that max_workers=>'0%' is 1 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => '1%');
+ is($mce->max_workers(), 1,
+ "check that max_workers=>'1%' is 1 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => '25%');
+ is($mce->max_workers(), 4,
+ "check that max_workers=>'25%' is 4 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => '37.5%');
+ is($mce->max_workers(), 6,
+ "check that max_workers=>'37.5%' is 6 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => '100%');
+ is($mce->max_workers(), 16,
+ "check that max_workers=>'100%' is 16 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(max_workers => '200%');
+ is($mce->max_workers(), 16,
+ "check that max_workers=>'200%' is 16 on HW with 16 logical cores"
+ );
+
+ $mce = MCE->new(user_tasks => [
+ { max_workers => 1 },
+ { max_workers => '25%' },
+ { max_workers => '50%' },
+ ]);
+
+ is($mce->{user_tasks}[0]{max_workers}, 1,
+ "check that task 0 max_workers=>'1' is 1 on HW with 16 logical cores"
+ );
+ is($mce->{user_tasks}[1]{max_workers}, 4,
+ "check that task 1 max_workers=>'25%' is 4 on HW with 16 logical cores"
+ );
+ is($mce->{user_tasks}[2]{max_workers}, 8,
+ "check that task 2 max_workers=>'50%' is 8 on HW with 16 logical cores"
+ );
+}
+
+{
+ 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 workers");
+
+ MCE::Flow->finish();
+}
+
+done_testing;
+