Programs: mm_pbsa Description: - make parallel version finish cleanly even if no STOP parameter is specified; (the original version spawned new threads even if no more snapshots were available; these extra threads never finished) - workaround for information exchange between master and spawned threads to allow processing of more than 255 snapshots per program execution (the problem was that the exit code was compared with the snapshot number; however, exit codes are limited to the range of 0-255 on Linux/Unix) - ignore leading spaces in the input file, i.e. accept e.g. " STOP 100" as well as "STOP 100" ------------------------------------------------------------------------------ --- src/mm_pbsa/mm_pbsa_calceneent.pm.orig 2010-07-22 13:54:52.000000000 +0200 +++ src/mm_pbsa/mm_pbsa_calceneent.pm 2010-07-22 15:06:30.000000000 +0200 @@ -164,13 +164,14 @@ my $mol = $nmol . $number; $procs_data{$number}->{mol} = $mol; + my $ncrdfile = $ncrd . "$number"; + last if(! -e $ncrdfile); # exit the loop (before forking a new thread) if there is no new input file + # Start fork ############ $pnumber++; $pm->start($pnumber) and next; - my $ncrdfile = $ncrd . "$number"; - last if(! -e $ncrdfile); print " Calc contrib for $ncrdfile\n"; if($number == $r_gen->{"START"} && ($r_gen->{"MM"} || $r_gen->{"GB"} || $r_gen->{"PB"} || $r_gen->{"MS"} || $r_gen->{"NM"})){ @@ -234,9 +235,9 @@ unlink $npdb . $number; } - # Finish fork + # Finish fork (ATTENTION: valid exit codes are only 0-255) ############# - $pm->finish($pnumber); + $pm->finish($pnumber%256); # Delete procs_data ################### @@ -279,7 +280,8 @@ my $exit_code = shift; my $pnumber = shift; - if($pnumber != $exit_code){ + # ATTENTION: exit codes can only be in the range of 0-255, thus, do a modulo on the snapshot number + if($pnumber%256 != $exit_code){ die("Finished process $pnumber with PID $pid has wrong exit code $exit_code\nFor details see: $HTMLPATH#ana_finished_proc\n"); } --- src/mm_pbsa/mm_pbsa_readinput.pm.orig 2010-04-26 14:21:22.000000000 +0200 +++ src/mm_pbsa/mm_pbsa_readinput.pm 2010-07-22 15:19:42.000000000 +0200 @@ -62,6 +62,7 @@ while(defined($line = )){ next if($line =~ /^\#/ || $line =~ /^$/); chomp($line); + $line =~ s/^\s+//; # remove leading whitespace # Get @-entry if($line !~ /^@/ && $atflg eq ""){