簡體   English   中英

Matlab:parfeval與獨立可執行文件(MCC)組合

[英]Matlab: parfeval in combination with standalone executable (MCC)

我正在嘗試創建一個包含parfeval語句和一個waitbar的matlab獨立可執行文件。 以下代碼在matlab運行時中完美運行。 但是,使用mcc -m test_mcc.m進行編譯后,我收到以下錯誤:

錯誤:

    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

有什么線索嗎?

顯然,它是R2014a中的錯誤。 Mathworks為我提供了以下支持:

您收到的錯誤是由並行計算工具箱中的錯誤引起的。 “ parfeval”要求將某些組件編譯到獨立應用程序中,但是默認情況下,這些組件對於MATLAB Compiler中的依賴性分析不可見。 此錯誤已在版本R2014b中修復。

要在當前的MATLAB版本中解決此問題,請將以下行添加到M文件中,然后使用“ mcc”重新編譯獨立的應用程序:

%#function parallel.internal.queue.evaluateRequest

該行將允許編譯器將正確的依賴項包含到獨立應用程序中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM