Run matlabpool and parfor with qsub on torque
2 次查看(过去 30 天)
显示 更早的评论
I am not able to create a matlabpool on a cluster. I hope somebody can help me.
This is my code...
clear all
close all
clc
fid = fopen('output.txt','wt');
fprintf(fid,'output \n');
fprintf(fid,'###')
fprintf(fid,strcat(pwd,'\n'));
fprintf(fid,'###')
p = rand(1,10);
q = ones(10);
save('pqfile.mat','p','q')
W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21];
DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5],W)
[dist,path,pred] = graphshortestpath(DG,1,6)
fprintf(fid,strcat(num2str(dist),'\n'))
fprintf(fid,'###')
fprintf(fid,strcat(num2str(path),'\n'))
fprintf(fid,'###')
fprintf(fid,strcat(num2str(pred),'\n'))
fprintf(fid,'###')
tic
for i=1:10
i
eig(rand(1000));
end
a = toc
if matlabpool('size') == 0 %%%%%THIS IS LINE 35 %%%%
matlabpool open 2
end
tic
parfor i=1:10
i
eig(rand(1000));
end
b = toc
matlabpool close
fprintf(fid,strcat(num2str(a),'\n'))
fprintf(fid,'###')
fprintf(fid,strcat(num2str(b),'\n'))
fprintf(fid,'###')
fclose(fid);
I have written this code on an Ubuntu-machine in Matlab 2013b. I used the Application Compiler to create a standalone program in which all required toolboxes are present.
I use qsub to launch the next bit of code.
#!/bin/bash
#PBS -m a
#PBS -l nodes=1:ppn=2
echo "Hello world!"
for_testing/run_main01parfor.sh /tools/matlab/2013b/x86_64 > for_testing/log.txt 2>&1
The log-file contains the information below...
Error using matlabpool (line 151)
Undefined variable "com" or class "com.mathworks.toolbox.distcomp.pmode.SessionFactory.getCurrentSession".
Error in main01 (line 35)
MATLAB:undefinedVarOrClass
Is this related to a missing toolbox on the server or is it something else? Can this be solved on my side or is this problem related to the way the cluster has been designed?
3 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!