0

i'm trying to create a matlab stand-alone executable containing parfeval statements and a waitbar. The following code runs perfectly within the matlab runtime. However, after compilation using mcc -m test_mcc.m I receive the following error:

error:

    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

code:

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

any clues?

Joost Moesker
  • 661
  • 3
  • 7
  • 1
    @AnderBiguri The syntax of `parfeval` is that the second input argument specifies the number of output arguments to be requested from the function passed as the first argument - so in this case, the `parfeval` call is entirely correct. – Edric Oct 27 '15 at 13:08
  • 1
    Hm, I tried that code in R2015b on WIN64, and it worked fine for me. What release of MATLAB/PCT are you using, what platform etc.? – Edric Oct 27 '15 at 13:30
  • I'm using R2014a on win64, apparently its a bug in R2014a. Mathworks provided me with a workaround. Thnxs – Joost Moesker Oct 28 '15 at 14:32

1 Answers1

1

Apparently its a bug in R2014a. Mathworks provided me with the following support:

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.

Joost Moesker
  • 661
  • 3
  • 7