How does MATLAB Parallel computing toolbox work?
조회 수: 7 (최근 30일)
이전 댓글 표시
Dear All,
We have recently installed MATLAB and its parallel toolbox in our clusters for linux. We have transferred all of our scripts to linux in order to run them using the new installed MATLAB. However, we have so many difficulties using the parallel computing toolbox. For instance, we do not know how to change the number of processors in a node! Usually we ask for a single node (each of the nodes has 12 cores) and then run our codes on the requested nodes.
We do want to run our codes using 1 processor and monitor the performance, then run the same script with 2 and etc.Should we do/add anything to our scripts?
Basically how can we generally ask for different number of cores in a single node? How can we submit our jobs and monitor them using parallel toolbox in MATLAB? I know that these question are general but I do appreciate if anyone can help me.
Best,
HRJ
댓글 수: 1
Edric Ellis
2015년 11월 5일
Are you using PCT alone, or are you using MDCS with a scheduler? Are you trying to set up the MJS scheduler? For monitoring jobs in PCT, there's the job monitor...
채택된 답변
Federico Becattini
2015년 11월 5일
The simplest way of running matlab code in parallel is to open a parallel pool specifying the number of cores that you want to use with
parpool(numcores)
and then use a parfor loop instead of a for loop. Of course you have to be sure that your code is parallelizable.
If you are using a cluster you can also submit different jobs to different cores using different matlab instances. For example with Sun Grid Engine you can use qsub to submit jobs. In order to do this with matlab you can write you matlab script with the following line to get the job ID
job_id = getenv('SGE_TASK_ID');
then you have to write a simple .sh file that launches matlab with this script. Something like this:
#!/bin/sh
#$ -cwd
path_to_matlab -nojvm -nodisplay -r scriptname
To submit the jobs you can execute the following command from the command line:
qsub -t 1-num_jobs:1 -o output_path -e error_path matlab_job.sh
where num_jobs is the number of jobs that you want to submit, output_path is the path where you want to print matlab's output and error_path is the path for printing any possible errors. matlab_job.sh is the .sh script defined above.
Hope this is useful.
댓글 수: 0
추가 답변 (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!