Parpool fails to run in between other lines of code

조회 수: 2 (최근 30일)
Richard Fiifi Annan
Richard Fiifi Annan 2021년 12월 6일
댓글: Richard Fiifi Annan 2021년 12월 7일
The following code returns the error below in MATLAB R2020b, Windows 10.
However, after restarting MATLAB and running only ppp=parpool(4) on a fresh script, it works. Has anyone ever experienced such a thing? I need to perform same operation on 6 other climate variables, so speed is of the essence. Running a normal for-loop is slow; therefore, is very discouraging.
Precips = ".\ECMWF_Datasets\cru_ts_4.05\data\pre\cru_ts4.05.1901.2020.pre.dat.nc"
Times = ncread(Precips, "time");
Times = double(Times) * 24 * 3600;
ref_date = datestr('1900-01-01 00:00:00.0');
Times = datetime(Times,'ConvertFrom','epochtime','Epoch',ref_date);
XXX = ncread(Precips, "pre"); % 720 x 360 x 1440
ppp = parpool(4); % returns the error below
parfor i = 1:length(Times)
"Perform some operations on XXX"
end
delete(ppp);
Error using parpool (line 149)
Parallel pool failed to start with the following error. For more detailed information, validate the profile 'local' in the Cluster Profile Manager.
Caused by:
Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line 678)
Failed to start pool.
Error using parallel.Job/submit (line 355)
Unable to use a value of type cell as an index.

채택된 답변

Raymond Norris
Raymond Norris 2021년 12월 6일
I'm guessing it's something to do with your environment. When I test with example.nc, it works fine. Is your code in a script or a function? If a script, save it as a function and rerun your code to see if that shields it from the error.
  댓글 수: 1
Richard Fiifi Annan
Richard Fiifi Annan 2021년 12월 7일
Hello @Raymond Norris, thanks very much for the response. You're right, the culprit was some directories which I had added to MATLAB's path at the beginning of the script. I just had to comment those lines out.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by