Job submission with Matlab Parallel Computing: Error message

Hi,
I try to submit a parallel job to a cluster via Matlab. I use a test script provided by the cluster administration. I follow their instruction but I get the following error message:
ID: 1
State: finished
Function: @parallel.internal.cluster.executeScript
Parent: Job 1
StartTime: Thu May 30 10:32:42 EDT 2013
Running Duration: 0 days 0h 0m 33s
ErrorIdentifier: MATLAB:undefinedVarOrClass
ErrorMessage: Undefined variable "TestParfor" or class
"TestParfor.m".
Error Stack: <no stack>
"TestParfor" is the name of the script. Its not a variable.
The command I use to submit the job is:
myCluster = parcluster('Guillimin');
j = batch(myCluster,'TestParfor.m', 'matlabpool', 4, 'CurrentDirectory', '~');
The script/function is:
function TestParfor;
clear all;
N=100;
filename='~/output_test_parfor_r2013a.txt';
outfile = fopen(filename,'w');
fprintf(outfile, 'CALCULATION LOG: \n\n');
tic;
for k=1:10
Ham(:,:,k)=rand(N)+i*rand(N);
fprintf(outfile,'Serial: Doing K-point : %3i\n', k);
inv(Ham(:,:,k));
end
t2=toc;
fprintf(outfile, 'Time serial = %12f\n', t2);
fclose(outfile);
tic;
parfor k=1:10
Ham(:,:,k)=rand(N)+i*rand(N);
outfile = fopen(filename,'a');
fprintf(outfile,'Parallel: Doing K-point : %3i\n', k);
fclose(outfile);
inv(Ham(:,:,k));
end
t2=toc;
outfile = fopen(filename,'a');
fprintf(outfile, 'Time parallel = %12f\n', t2);
fprintf(outfile, 'CALCULATIONS DONE ... \n\n');
fclose(outfile);
I hope anybody can explain me what might cause the error message. Is it something with my local Matlab installation or a communication problem with the cluster?
Thanks a lot!

回答(1 个)

That error message is because you've asked to execute 'TestParfor.m'. If you toe exactly that in MATLAB (including the '.m'), you'll get the same error. Instead you should specify 'TestParfor', I.e.
j = batch(myCluster, 'TestParfor', ...);

1 个评论

Thanks a lot! That solved the problem, indeed. Little mistake, big effect...

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品

提问:

2013-5-31

Community Treasure Hunt

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

Start Hunting!

Translated by