How to run a job on a remote cluster?
15 views (last 30 days)
Show older comments
I created a bash script that I have uploaded to a remote cluster via scp. In this script I load a Matlab module (version R2014a) which I use to run some Matlab code.
#$ -pe smp 4 //tells the cluster to provide 4 cores local to a single node
module load matlab14/R2014a
matlab -nosplash -nodisplay -r "code I want to run"
Within my Matlab code I am creating a parallel object and running the following (I'm trying to learn how to run a job in parallel on the cluster before writing the real code).
pool = parpool('local',4);
parfor k = 1 : 10000
disp(k); //console input saved is to file to demonstrate I have the general syntax right
end
delete(pool);
When I run my code I get the following error
{^HUndefined variable "com" or class
"com.mathworks.toolbox.distcomp.pmode.SessionInfo.NULL_SESSION_INFO".
Error in parpool (line 96)
sessionInfo =
com.mathworks.toolbox.distcomp.pmode.SessionInfo.NULL_SESSION_INFO;
Error in main (line 4)
pool = parpool('local',4);
Error in run (line 63)
evalin('caller', [script ';']);
}^H
^G{^HError: File: /Users/name/scripts/main.m Line: 4 Column: 1
The input character is not valid in MATLAB statements or expressions.
Error in run (line 63)
evalin('caller', [script ';']);
}^H
^G{^HUndefined variable "com" or class
"com.mathworks.toolbox.distcomp.pmode.SessionInfo.NULL_SESSION_INFO".
Error in parpool (line 96)
sessionInfo =
com.mathworks.toolbox.distcomp.pmode.SessionInfo.NULL_SESSION_INFO;
Error in main (line 4)
pool = parpool('local',4);
Error in run (line 63)
evalin('caller', [script ';']);
}^H
^G
What might I be doing wrong and how might I fix it? I have been able to run other Matlab scripts but I have not been able to run any that implement parallelization. I checked the cluster and the Parallel Computing Toolbox is present.
1 Comment
Aleksander Lidtke
on 24 Aug 2015
Hi, I just ran into the same issue. My supercomputer help page suggests starting Matlab with -nodisplay -nojvm -nosplash options. It turns out that -nojvm causes this error. The variable com the error message mentions is, in fact, some Java module, so it won't work without the Jave Virtual Machine.
Answers (1)
Edric Ellis
on 6 Oct 2014
Parallel Computing Toolbox relies on Java, so you should omit the -nojvm flag from your matlab command-line.
2 Comments
Edric Ellis
on 6 Oct 2014
Hm, the error message that you get (unhelpful though it is) is precisely the error that you see when specifying -nojvm, and I know of no other way to get that error. Perhaps you could try adding
error(javachk('jvm'))
to the start of your script - that will error out if Java is not enabled before you get any further.
See Also
Categories
Find more on Parallel Computing Fundamentals 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!