Run matlabpool and parfor with qsub on torque

4 views (last 30 days)
Lu Maz
Lu Maz on 19 Mar 2014
Commented: Lu Maz on 20 Mar 2014
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 Comments
Lu Maz
Lu Maz on 20 Mar 2014
ver when I run Matlab on the cluster...
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
MATLAB License Number: ••••••
Operating System: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.2 (R2013b)
Simulink Version 8.2 (R2013b)
Control System Toolbox Version 9.6 (R2013b)
Database Toolbox Version 5.0 (R2013b)
MATLAB Builder JA Version 2.3 (R2013b)
MATLAB Coder Version 2.5 (R2013b)
MATLAB Compiler Version 5.0 (R2013b)
Neural Network Toolbox Version 8.1 (R2013b)
Optimization Toolbox Version 6.4 (R2013b)
Signal Processing Toolbox Version 6.20 (R2013b)
Simulink Coder Version 8.5 (R2013b)
Statistics Toolbox Version 8.3 (R2013b)
Symbolic Math Toolbox Version 5.11 (R2013b)
No PCT! However no bioinformatics toolbox either and the graphshortestpath still works. I compiled the script in the startpost and I always believed all required toolboxes were added to the compiled, standalone program.
So, how is it possible that "graphshortestpath" works and that "matlabpool" does not work? Both related toolboxes are not availabe on the cluster. I used the "which" command to check if a function is present on the cluster. Below is the reuslt.
>> which clear
built-in (/tools/matlab/2013b/x86_64/toolbox/matlab/general/clear)
>> which rand
built-in (/tools/matlab/2013b/x86_64/toolbox/matlab/randfun/rand)
>> which graphshortestpath
'graphshortestpath' not found.
>> which matlabpool
'matlabpool' not found.
Lu Maz
Lu Maz on 20 Mar 2014
I added the "ver" function to the start of the script, which I showed you in the first post.
The output is below. You can see that PCT and bioinformatics toolboxes are present. Both these toolboxes are not installed on the cluster. I guess these toolboxes were added to the standalone program during compilation.
So, it looks like PCT is present, so, why do I get the error I described in my first post?
------------------------------------------
Setting up environment variables
---
LD_LIBRARY_PATH is .:/tools/matlab/2013b/x86_64/runtime/glnxa64:/tools/matlab/2013b/x86_64/bin/glnxa64:/tools/matlab/2013b/x86_64/sys/os/glnxa64
[H[2J----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
MATLAB License Number: unknown
Operating System: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.2 (R2013b)
Bioinformatics Toolbox Version 4.3.1 (R2013b)
Control System Toolbox Version 9.6 (R2013b)
Database Toolbox Version 5.0 (R2013b)
Global Optimization Toolbox Version 3.2.4 (R2013b)
Image Processing Toolbox Version 8.3 (R2013b)
MATLAB Version 8.2 (R2013b)
MATLAB Compiler Version 5.0 (R2013b)
Mapping Toolbox Version 4.0 (R2013b)
Neural Network Toolbox Version 8.1 (R2013b)
Optimization Toolbox Version 6.4 (R2013b)
Parallel Computing Toolbox Version 6.3 (R2013b)
Signal Processing Toolbox Version 6.20 (R2013b)
Statistics Toolbox Version 8.3 (R2013b)
System Identification Toolbox Version 8.3 (R2013b)

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!