No BSD License
-
PP_FEVAL(PR_OPTIONS,PR_PATH,P...
RT_PP_SPEC = PP_FEVAL(PR_OPTIONS,PR_PATH,PR_COMMAND,varargin)
-
PP_GET_STATUS(PR_REQUESTS)
[RT_COMPLETE,RT_SERVER,RT_TIME] = PP_GET_STATUS(PR_REQUESTS)
-
PP_SERVER(PR_OPTIONS,PR_REQUE...
PP_SERVER(PR_OPTIONS,PR_REQUEST_PATH)
-
PP_STOP_SERVERS(PR_PATH,PR_SE...
PP_STOP_SERVERS(PR_PATH,PR_SERVER_NAME)
-
[varargout]=PP_GET_RESULTS(PR...
[RT_COMPLETE,RT_RESULTS,RT_ERROR_TEXT] = PP_GET_RESULTS(PR_REQUESTS,PR_PAUSE)
-
View all files
from
DistributePP
by Dr. Michael D. DeVore
A distributed parallel processing toolbox.
|
| [varargout]=PP_GET_RESULTS(PR_REQUESTS,PR_PAUSE) |
function [varargout]=PP_GET_RESULTS(PR_REQUESTS,PR_PAUSE)
%[RT_COMPLETE,RT_RESULTS,RT_ERROR_TEXT] = PP_GET_RESULTS(PR_REQUESTS,PR_PAUSE)
%
% This function returns the results of the request or requests
% indicated in the first parameter and removes any communication
% files related to those requests. The array RT_COMPLETE
% is a logical array with an entry of 1 for every request which
% has completed processing. RT_RESULTS is a cell array with
% the result of computation for each completed request. For
% requests which are not complete, the corresponding entry of
% RT_RESULTS contains a null array. RT_ERROR_TEXT is a cell
% array with the error text, if any, for each completed request.
% For requests which are not complete, the corresponding entry of
% RT_ERROR_TEXT contains a null array.
%
% Parameters:
% PR_REQUESTS - a cell array of PP requests or, optionally,
% a single request or matrix with a request in each row.
% PR_PAUSE - if non-negative, the amount of time which should
% elapse between checks for completed requests. In this
% case, the function will not return until all requests are
% complete. If negative or left unspecified, the function will
% return with the results of only those requests which have
% completed.
% This file and the DistributePP software package were created and
% are maintained by Michael D. DeVore. The package originated in
% November, 1999. Permission is granted by the author for anyone
% to use or modify this software provided that:
% (1) any modified files are documented internally to clearly indicate
% that they have been modified from the original release; and
% (2) it is recognized that neigher Michael D. DeVore nor Washington
% University assumes any liability for the use or misuse of the software.
if nargin < 2
PR_PAUSE = -1;
end
LV_GET_COMPLETED = (nargout > 0);
LV_GET_RESULTS = (nargout > 1);
LV_GET_ERRORS = (nargout > 2);
if ~iscell(PR_REQUESTS)
PR_REQUESTS = cellstr(PR_REQUESTS);
end
RT_COMPLETE = (zeros(size(PR_REQUESTS)) > 1);
if LV_GET_RESULTS
RT_RESULTS = cell(size(PR_REQUESTS));
end
if LV_GET_ERRORS
RT_ERROR_TEXT = cell(size(PR_REQUESTS));
end
% Get a list of all completed requests...
LV_N_REQUESTS = prod(size(PR_REQUESTS));
LV_STOP_LOOPING = 0;
while ~LV_STOP_LOOPING
for LV_ITER = 1:LV_N_REQUESTS
if ~RT_COMPLETE(LV_ITER)
RT_COMPLETE(LV_ITER) = (exist([PR_REQUESTS{LV_ITER} '.req'],'file') == 0);
end
end
LV_STOP_LOOPING = (PR_PAUSE < 0) | (sum(RT_COMPLETE(:)) == LV_N_REQUESTS);
if ~LV_STOP_LOOPING
pause(PR_PAUSE);
end
end
% Collect results, if requested...
if LV_GET_RESULTS
for LV_ITER = 1:LV_N_REQUESTS
if RT_COMPLETE(LV_ITER)
load(PR_REQUESTS{LV_ITER},'LV_PROC_RESULT','LV_LAST_ERR');
RT_RESULTS{LV_ITER} = LV_PROC_RESULT;
if LV_GET_ERRORS
RT_ERROR_TEXT{LV_ITER} = LV_LAST_ERR;
end
end
end
end
if LV_GET_COMPLETED
varargout(1) = {RT_COMPLETE};
end
if LV_GET_RESULTS
varargout(2) = {RT_RESULTS};
end
if LV_GET_ERRORS
varargout(3) = {RT_ERROR_TEXT};
end
% Cleanup files only at the end to minimize the risk of a failure which would result in lost data...
for LV_ITER = 1:LV_N_REQUESTS
if RT_COMPLETE(LV_ITER)
delete([PR_REQUESTS{LV_ITER} '.prc']);
delete([PR_REQUESTS{LV_ITER} '.mat']);
end
end
|
|
Contact us at files@mathworks.com