Answering my own email... bad form I suppose but I got it working
pretty easily...
parcellfun needs to call waitpid to clear those child processes. Simple fix.
There was a minor bug with the options parsing... it failed when no
options were set. Fixed with a simple protecting if.
I also included a 'VerboseLevel' option which allows for quiet (0),
normal (1), or more (2+) levels of verbosity to the output.
I'd humbly encourage including this in any reasonably complex
function... especially ones where debugging output is frequently
desirable.
Here is a diff against the version of parcellfun.m contained in
general-1.1.2 (the current one on octave-forge)... please drop me a
note if I should instead post the full file.
3a4
> ## Modified by: Travis Collier 31-5-2009
31a33,34
> ## A VerboseLevel option is supported controlling level of output. 0 implies
> quiet and 1 is default.
> ##
60a64
> verbose_level = 1;
66,78c70,89
< do
< if (strcmp (args{nargs-1}, "UniformOutput"))
< uniform_output = args{nargs};
< nargs -= 2;
< continue;
< endif
< if (strcmp (args{nargs-1}, "ErrorHandler"))
< error_handler = args{nargs};
< nargs -= 2;
< continue;
< endif
< break;
< until (nargs < 2);
---
> if( nargs > 1 )
> do
> if (strcmp (args{nargs-1}, "UniformOutput"))
> uniform_output = args{nargs};
> nargs -= 2;
> continue;
> endif
> if (strcmp (args{nargs-1}, "ErrorHandler"))
> error_handler = args{nargs};
> nargs -= 2;
> continue;
> endif
> if (strcmp (args{nargs-1}, "VerboseLevel"))
> verbose_level = args{nargs};
> nargs -= 2;
> continue;
> endif
> break;
> until (nargs < 2);
> end
112a124
> child_pids = zeros(nproc,1); # have to keep track of child process ids
121a134,137
> child_pids(nsuc) = pid;
> if( verbose_level > 1 )
> fprintf(stderr,'parcellfun: child processes %d created\n',
> child_pids(i));
> end
285,286c301,304
< fprintf (stderr, "\rparcellfun: %d/%d jobs done", pjobs -
sum (pending != 0), njobs);
< fflush (stderr);
---
> if( verbose_level > 0 )
> fprintf (stderr, "\rparcellfun: %d/%d jobs done", pjobs - sum
> (pending != 0), njobs);
> fflush (stderr);
> endif
288,289c306,309
< fputs (stderr, "\n");
< fflush (stderr);
---
> if( verbose_level > 0 )
> fputs (stderr, "\n");
> fflush (stderr);
> endif
306a327,334
> ## wait for all child processes to exit
> for i = 1:nproc
> if( verbose_level > 1 )
> fprintf(stderr,'parcellfun: waiting for child processes %d to
> close\n', child_pids(i));
> end
> waitpid(child_pids(i));
> end
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev