2015-10-27 2 views
0

Я пытаюсь создать автономный исполняемый файл matlab, содержащий parfeval statements и waitbar. Следующий код отлично работает в среде исполнения Matlab. Тем не менее, после компиляции с использованием McC -m test_mcc.m я получаю следующее сообщение об ошибке:Matlab: parfeval в сочетании с автономным исполняемым файлом (MCC)

ошибка:

Error using parallel.FevalFuture/fetchNext (line 243) 
The function evaluation completed with an error. 

Error in test_mcc (line 11) 



Caused by: 
    An error occurred interpreting the results of the function evaluation. 

parallel:fevalqueue:FetchNextFutureErrored 

код:

function test_mcc() 
    N = 100; 
    for idx = N:-1:1 
     % Compute the rank of N magic squares 
     F(idx) = parfeval(@rank,1,magic(idx)); 
    end 
    % Build a waitbar to track progress 
    h = waitbar(0,'Waiting for FevalFutures to complete...'); 
    results = zeros(1,N); 
    for idx = 1:N 
     [completedIdx,thisResult] = fetchNext(F); 
     % store the result 
     results(completedIdx) = thisResult; 
     % update waitbar 
     waitbar(idx/N,h,sprintf('Latest result: %d',thisResult)); 
    end 
    delete(h) 
end 

любые улики?

+1

@AnderBiguri Синтаксис 'parfeval' является то, что второй входной аргумент указывает число выходных аргументов, запрашиваемая из функции, переданной в качестве первого аргумента - так что в этом случае , вызов 'parfeval' является полностью правильным. – Edric

+1

Хм, я пробовал этот код в R2015b на WIN64, и он отлично работал для меня. Какой выпуск MATLAB/PCT вы используете, какую платформу и т. Д.? – Edric

+0

Я использую R2014a на win64, по-видимому, это ошибка в R2014a. Математика предоставила мне обходной путь. Thnxs –

ответ

1

Видимо, его ошибка в R2014a. Mathworks предоставил мне следующую поддержку:

The error which you are receiving is caused by a bug in the Parallel Computing Toolbox. "parfeval" requires certain components to be compiled into the standalone application but these components by default are not visible to the dependency analysis in MATLAB Compiler. This bug has been fixed in release R2014b.

To work around this issue in your current MATLAB release, add the following line to your M-file and then recompile the standalone application using "mcc":

%#function parallel.internal.queue.evaluateRequest

This line will allow the compiler to include the correct dependencies into the standalone application.