How to run fmincon on a cluster?

조회 수: 1 (최근 30일)
Sina
Sina 2011년 3월 2일
Hi all, I want to run a matlab function, containing "fmincon" on a cluster. I used this code on my PC to use all of 4 cores.
matlabpool open 4
options=optimset('UseParallel','always');
[u,fval,exitflag] =fmincon(J,u0,[],[],[],[],lb,ub,[],options);
matlabpool close
When I want to run the same code on a cluster it returns this error: Error using ==> matlabpool>iVerifyJava at 379 matlabpool is not supported because Java is not currently available.
Error in ==> matlabpool at 92

답변 (2개)

Edric Ellis
Edric Ellis 2011년 3월 2일
How are you running the code on a cluster? It looks like you may be running "matlab -nojvm" on the cluster - as the error message suggests, you need the JVM available to run "matlabpool", so you need to run "matlab -nodisplay" instead.
Rather than using standard MATLAB/PCT licences on the cluster, you may wish to consider using MATLAB Distributed Computing Server licences ( MDCS product page ). That way, you can submit a "matlabpool job" directly from your desktop to the cluster where it will execute consuming only MDCS licences.

Victor
Victor 2011년 3월 2일
Hi all, Actually some times it depends from one cluster to another cluster, but you can try this steps: (Good luck :))
No matter which version you are using, the number of threads can be significantly reduced by turning off MATLAB's Java Virtual Machine (JVM), and forcing it to use a single computation thread. This can be done using the options:
matlab -nodisplay -nojvm -singleCompThread
(Note: -singleCompThread is supported only in MATLAB 7.8 and 7.9.)
If your MATLAB program is using a multithreaded library such as Intel MKL, you should also set the number of threads to one before executing "bsub":
export OMP_NUM_THREADS=1
bsub -n 1 -W HH:MM [...] matlab -nodisplay -nojvm -singleCompThread [...]
If, for any reason, you really want to use multiple threads, you must request an equivalent number of CPUs when you submit your job:
export OMP_NUM_THREADS=N
bsub -n N ...

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by