How to use parfor-loop or parallel computation on a cluster?
Show older comments
Dear Matlabers,
I am trying to use parfor-loop on a cluster, therefore I wrote a script to test. the script-1 run successfully, but consumed more time than on my own pc, it seems that it only use one processor; therefore, I invoked matlabpool in the script-2, but this script even doesn't run on the cluster and gave error:
"To get started, type one of these: helpwin, helpdesk, or demo.For product information, visit www.mathworks.com.
Error using matlabpool>iVerifyJava (line 163) matlabpool is not supported because: Java is not currently available.
Error in matlabpool (line 122) iVerifyJava(); Error in TestPara (line 16)matlabpool open;"
Now, my question is how can I change my script to use parfor-loop on a cluster?
thank you in advance!
George
% script-1 parfor-loop
itr = 1E8;
tic;
parfor i = 1:itr
tx (i)= 2*i;
end
t = toc;
fileID = fopen('timeNormal.txt','w');
fprintf(fileID,' Time 1 is: %6.2f seconds \n',t);
fclose(fileID);
% script-2 matlabpool
matlabpool open;
tic,
parfor i = 1:itr
tx (i)= 2*i;
end
t = toc;
fileID = fopen('time2.txt','w');
fprintf(fileID,' Time 2 is: %6.2f seconds \n',t);
fclose(fileID);
matlabpool close
Accepted Answer
More Answers (1)
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!