How to run a job on a remote cluster?
13 次查看(过去 30 天)
显示 更早的评论
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 个评论
Aleksander Lidtke
2015-8-24
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.
回答(1 个)
Edric Ellis
2014-10-6
Parallel Computing Toolbox relies on Java, so you should omit the -nojvm flag from your matlab command-line.
2 个评论
Edric Ellis
2014-10-6
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cluster Configuration 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!