Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab parfor和spmd不';行不通_Matlab_Parfor_Spmd - Fatal编程技术网

matlab parfor和spmd不';行不通

matlab parfor和spmd不';行不通,matlab,parfor,spmd,Matlab,Parfor,Spmd,脚本如下: Lambdass = [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000]; numcores = feature('numcores'); % get the number of cpu cores num_slices = floor(length(Lambdass)/numcores); % get the number of slices for parallel computing if mod(lengt

脚本如下:

    Lambdass = [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000];
    numcores = feature('numcores'); % get the number of cpu cores
    num_slices = floor(length(Lambdass)/numcores); % get the number of slices for parallel computing
    if mod(length(Lambdass), numcores)~=0
        num_slices = num_slices + 1;
    end
    for slice_i=1:num_slices
        if slice_i~=num_slices
            Lambdas = Lambdass(((slice_i-1)*numcores+1):((slice_i)*numcores));
        else
            Lambdas = Lambdass(((slice_i-1)*numcores+1):end);
        end

        % start the parallel processing
        myparpool = parpool(length(Lambdas))
        parfor li = 1:length(Lambdas)
        % spmd
            lambda = Lambdas(li);
            save_path1 = sprintf('results/lambda_%f/', lambda);
            if ~exist([save_path1, '/fs_results.mat'], 'file') 
                do_something_and_save_results(lambda, save_path1);
            end
        end
        delete(myparpool)
    end
此脚本可以在一台计算机上正确运行,但在另一台计算机上,
parfor
似乎无法正常工作,并且有如下一些警告信息,
parfor
最终在没有并行模式的情况下运行,而
for
似乎是按顺序运行的。谁能帮我提些建议吗

    Starting parallel pool (parpool) using the 'local' profile ... Warning: Could not launch SMPD process manager. Using fallback parallel mechanism.
    > In SmpdGateway>SmpdGateway.canUseSmpd at 81
    In Local.hSubmitCommunicatingJob at 15
    In CJSCommunicatingJob>CJSCommunicatingJob.submitOneJob at 81
    In Job.Job>Job.submit at 302
    In InteractiveClient>InteractiveClient.start at 327
    In Pool.Pool>iStartClient at 537
    In Pool.Pool>Pool.hBuildPool at 434
    In parpool at 104

那么,计算机之间的区别是什么?(硬件、操作系统、MATLAB版本)。原因大概就在那里,而不是你的代码的细节。我投票结束这个问题,因为这是一个软件安装问题或系统配置问题,而不是编程问题。@Edric,因此应该在超级用户上?@hubber winston:尝试重新安装并行计算工具箱。或者尝试MathWorks论坛:。