Subject: | Possible bug on Parallel ForkManager |
Date: | Mon, 30 Jun 2014 07:38:47 +0000 |
To: | "bug-Parallel-ForkManager [...] rt.cpan.org" <bug-Parallel-ForkManager [...] rt.cpan.org> |
From: | <gilles.xiberras [...] orange.com> |
Hello guys,
First of all I want to thank you for this magic library that allows me to use the performances of my hardware the best I can and reduces the processing time of my programs.!
Ok here is my problem ....
I use :
-On Windows 7 Profesionnal
-Active Perl 5.16.3 build 1603
-Parallel Fork Manager 1.06
I've this kind of message : (Program stopped !)
Free to wrong pool 2c49f50 not 3882c0 at c:\perl64\site\lib\Parallel\ForkManager.pm line 513.
My initial PROGRAM :
use strict;
use Parallel::ForkManager;
use warnings;
my $dir_src_data_master_DBM = "../../../DATABASES/MASTER/DBM/";
#open Hash table stored on the Hard disk
my %h_probe_matrix_gxi_original;
dbmopen(%h_probe_matrix_gxi_original, "${dir_src_data_master_DBM}PROBE_MATRIX_GXI", 0444);
my $MAX_PROCESSES = 10; # nb process.
my $pm = Parallel::ForkManager->new ($MAX_PROCESSES);
my $i;
for ($i = 0 ; $i < 100 ; $i++)
{
my $pid = $pm->start and next;
print "Hello\n";
$pm->finish;
}
print "End\n";
Description :
When You open a Hash table that has been stored on your hard drive and if you do not close it before launching the parallel process then you have the error message.
So I suppose that the fact that the Hash table still opened before running the parallel processes is the problem.
How to Solve the issue :
If you want to use this hash table .... You have to do something like that (associate the initial hash table to a new one and close the initial one).
my %h_probe_matrix_gxi;
%h_probe_matrix_gxi = %h_probe_matrix_gxi_original;
dbmclose(%h_probe_matrix_gxi_original);
PERFORMANCE ISSUE :
Loading the hash table as a global var ... degrades the performance drastically.
My Solution :
This does not look fine, as every child will allocate specific memory to load the hash table, however this solves the error message and the performance issue.
use strict;
use Parallel::ForkManager;
use warnings;
my $dir_src_data_master_DBM = "../../../DATABASES/MASTER/DBM/";
my $MAX_PROCESSES = 10 ;
my $pm = Parallel::ForkManager->new ($MAX_PROCESSES);
my $i;
for ($i = 0 ; $i < 100 ; $i++)
{
my $pid = $pm->start and next;
my %h_probe_matrix_gxi_original;
dbmopen(%h_probe_matrix_gxi_original, "${dir_src_data_master_DBM}PROBE_MATRIX_GXI", 0444);
print "Hello\n";
dbmclose(%h_probe_matrix_gxi_original);
$pm->finish;
}
print "End\n";
Do not hesitate to contact me should you require any additional elements.
Best regards Gilles.
Show quoted text
_________________________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.